Forum Moderators: coopster

Message Too Old, No Replies

Segfault help - reorder module load order?

         

gnetcon

5:08 pm on Dec 29, 2008 (gmt 0)

10+ Year Member



Hello all!

I have a script I inherited that runs fine when called via a web browser, but when I run it via the command-line (for cron'd reports) I get core dumps. When I run gdb on the dump file and run a backtrace, I get the following:


Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 46922786682688 (LWP 32652)]
0x00002aad15062bc0 in ? ()
(gdb) bt
#0 0x00002aad15062bc0 in ? ()
#1 0x00000034248a038f in ERR_get_implementation () from /lib64/libcrypto.so.6
#2 0x0000003422420439 in Curl_ossl_cleanup () from /usr/lib64/libcurl.so.3
#3 0x000000342242fbe2 in Curl_ssl_cleanup () from /usr/lib64/libcurl.so.3
#4 0x0000003422428513 in curl_global_cleanup () from /usr/lib64/libcurl.so.3
#5 0x000000000044f229 in zm_shutdown_curl ()
#6 0x000000000057c218 in module_destructor ()
#7 0x0000000000581ae7 in zend_hash_quick_find ()
#8 0x0000000000581da8 in zend_hash_graceful_reverse_destroy ()
#9 0x0000000000578a68 in zend_shutdown ()
#10 0x000000000053c41f in php_module_shutdown ()
#11 0x00000000005f0c80 in main ()

So, in researching the problem, I came across a PHP bug posted that mentions one should reorder the modules for postgres and libcurl.


[bugs.php.net...]

anyway, there's a pretty simple workaround for the time being. if you
reverse the module loading so order so that pgsql is loaded first (and
thus unloaded last by the current php engine), then the callback
function never references invalid memory and no segfault happens.

How would one go about re-ordering them so that the Postgres module loads first, before the libpq module?

TIA!

coopster

4:18 pm on Jan 1, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Or, patch Postgresql, from the same bug report ....


PostgreSQL fixed this bug.

[archives.postgresql.org...]

Fix will be available in PostgreSQL version 8.4+

Scratch that, looks like it may not be *officially* released and/or supported yet.

I think the reordering of the modules being referred must be the dynamic module extensions that get loaded in php.ini. Here is a note from a default php.ini file ...

;;;; 
; Note: packaged extension modules are now loaded via the .ini files
; found in the directory /etc/php.d; these are loaded by default.
;;;;

Ah, now I am beginning to see your predicament. I've never had to deal with this before so I am at a loss myself. I'll take a quick look through that bug report to see if anything pops out.

coopster

4:22 pm on Jan 1, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



OK, the temporary workaround is to load the extensions as specified in the Debian bug report.
[bugs.debian.org...]
... specifically:
[bugs.debian.org...]

gnetcon

4:24 pm on Jan 1, 2009 (gmt 0)

10+ Year Member



---

[edited by: gnetcon at 4:46 pm (utc) on Jan. 1, 2009]

gnetcon

4:39 pm on Jan 1, 2009 (gmt 0)

10+ Year Member



Thanks for the feedback, coopster.

I took a look, but the server doesn't have a curl.ini file to edit to load the postgres extension first. It seems curl is compiled directly into PHP. So I'm still screwed, it seems. : (

coopster

4:55 pm on Jan 1, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Reaching for straws here, but how about adding it to the directory? I'd have to search and pull the docs in the manual to be certain this is the correct protocol, but it's worth a shot.

gnetcon

5:02 pm on Jan 1, 2009 (gmt 0)

10+ Year Member



I'll try it. Thanks!