in reply to Do XS-components require special considerations with CGI? [SOLVED]

The confusion continues...

Within the error-output (that I am now able to see), I have forced it to generate the output of a ldd command for mysql.so and separately also for libmysqlclient.so.15, after confirming that there are no conflicting libraries in sight.

With or without an LD_LIBRARY_PATH in place, the output of both ldd commands contains no “not found” messages. All of the dependencies point to corresponding libraries. This suggests that I am not, in fact, looking at a search-path issue.

I have even gone so far as to use dl_load_file() (from DynaLoader) in order to force the libraries to be loaded early. (Note that I did not (yet) do this in a .bs file...) When I did that, (a) all of them succeeded, but (b) I got an out of memory message(!) when the library tried to connect.

So... I am by now really “I'm confused as hell and I'm not gonna take it any more” here. It works just fine interactively; it fails with only these cryptic messages in Apache. Nothing I have tried has succeeded as “a workaround, however crude.”

Replies are listed 'Best First'.
Re^2: Do XS-components require special considerations with CGI?
by locked_user sundialsvc4 (Abbot) on Feb 27, 2009 at 21:21 UTC

    Oh... now this thing is getting weirder and weirder...

    I inserted some prologue-code that would issue a DBI->connect() call, before doing anything else, and...

    • The connect() succeeds...
    • The earlier message does not appear.
    • The DBI->installed_drivers list (originally empty...) expands to include both mysql and DBI::dr=HASH(0x83a81a8) (?!)
    • The out of memory message appears, just as it did earlier.
    • And yet, everything works just fine in command-line!

      Calm down. Stop spinning, and ignoring advice you've been given. If it works from command line and not cgi, stop guessing, and figure out what the differences are, its that simple. Write a program to load DBI/mysql, connect, disconnect, then dump @INC, %INC, %ENV, %::... and compare the output from commandline and from cgi. If you can't figure it out, post the code and output here.

        Sage advice. Thanks.

        Trust me, I'm not ignoring anything. I've already determined that DBI/mysql can connect, that the XS-modules are being loaded... from the correct locations (i.e. the site's local CPAN). This much I now know. The CGI-environment, only, throws the _login mesage. I have examined INC, and ENV, (what's %::?) very closely throughout.

        The crux of the question is:   what in the heck is different about this environment vs. the command line?” I can see that I have lots of XS-modules that are working just fine.

        As I read perldoc DBI::DBD, I see that “The variables $DBD::Driver::{dr|db|st}::imp_data_size are not defined here, but in the XS code, because they declare the size of certain C structures.“, this is obviously a very-direct clue when considered in light of the messages that “imp_data_size was unexpectedly expanded.” I see that DBI.so and mysql.so both contain this symbol, viz:

        grep -rilw imp_data_size . | grep \.so | xargs grep imp_data_size

        BTW, there is method to my bulldog-madness. I'm “chatting” on this thread partly because I well know that there are interested-parties. These are not written to be “rants.” Anyone who (follows|has followed) in this rocky path will (see|have seen) these same rocks. When this thread finally reaches its successful conclusion, I hope it will be useful both in its final-post and in the posts leading up to it. That's my intention, anyway.