Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: PHP5 + oci8 consistently segfaults on script exit

2 views
Skip to first unread message

Simun Mikecin

unread,
Jul 28, 2007, 10:20:04 AM7/28/07
to tsr...@gmail.com, freebsd-...@freebsd.org
>I'm running FreeBSD 6.2-RELEASE-p1 and PHP 5.2.2 built with the oci8
>extension which is built against the oracle8-client port version
>0.1.1_1.

>Connecting to and working with an Oracle database works well so far, but
>PHP segfaults whenever any script that uses the oci8 extension is run
>and exits (regardless of success or failure). The segfault _only_
>occurs when PHP is tearing everything down after the script runs.
>Therefore scripts run successfully, but my kernel logs look like this:

>Jul 25 16:59:17 kernel: pid 89667 (php), uid 1003: exited on signal 11
>Jul 25 17:00:11 kernel: pid 89725 (php), uid 1003: exited on signal 11
>Jul 25 17:01:38 kernel: pid 89729 (php), uid 1003: exited on signal 11
>Jul 25 17:02:58 kernel: pid 89732 (php), uid 1003: exited on signal 11

Could you please try these and send feedback:

1) Try the same using PDO_OCI instead of oci8 extension
2) Try with this combination: apache 2.0 (port compiled with WITH_THREADS) + php + oci8 extension
3) Try with this combination: apache 2.0 (port compiled with WITH_THREADS) + php + PDO_OCI

2) and 3) should be triggered by HTTP request.


____________________________________________________________________________________Ready for the edge of your seat?
Check out tonight's top picks on Yahoo! TV.
http://tv.yahoo.com/

Gordon Stratton

unread,
Jul 28, 2007, 2:59:18 PM7/28/07
to Simun Mikecin, freebsd-...@freebsd.org
On 7/28/07, Simun Mikecin <numi...@yahoo.com> wrote:
> Could you please try these and send feedback:
>
> 1) Try the same using PDO_OCI instead of oci8 extension
> 2) Try with this combination: apache 2.0 (port compiled with WITH_THREADS) + php + oci8 extension
> 3) Try with this combination: apache 2.0 (port compiled with WITH_THREADS) + php + PDO_OCI
>
> 2) and 3) should be triggered by HTTP request.

Hey Simun,

1) Segfaults on exit, same as oci8.

2) Does not segfault.

3) Does not segfault.

In my situation, everything works like a charm up until the module is
unloaded via dlclose(3). My guess is that since mod_php doesn't
unload/reload PHP modules across requests that this is the reason it is
not segfaulting with httpd, but segfaulting with CLI PHP.

Thanks,

Gordon

Gordon Stratton

unread,
Sep 13, 2007, 1:47:14 AM9/13/07
to freebsd-...@freebsd.org
I've implemented a solution that works around the problem. I'm fairly
sure that the Oracle shared library is doing something incorrect such as
registering functions via atexit(3). When the module is unloaded and PHP
exits, the called functions have since been unmapped so calling them
results in a segfault. Does this sound plausible? In any case, my
workaround is to comment out the call to the macro DL_UNLOAD in
Zend/zend_API.c (the macro expands to the call to dlclose(3) on FreeBSD
and other platforms). Doing it at that point works out because PHP
always exits after dlclose(3)ing all of its extensions (hence the
segfault), but clearly it is not an elegant or clean solution.

I have prepared a patch which I am using in my local ports tree that
comments out DL_UNLOAD as I mentioned earlier, and everything is working
just fine (CLI and mod_php) on FreeBSD 6.2 with PHP 5.2.3 and
oracle8-client-0.1.1_1.

If anyone is interested in this patch, contact me off-list.

Gordon

0 new messages