Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
PHP/Apache Segmentation fault
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
STEagleEye
n00b
n00b


Joined: 20 May 2007
Posts: 16

PostPosted: Wed Jan 30, 2013 10:09 am    Post subject: PHP/Apache Segmentation fault Reply with quote

Hi
since 2 weeks I had an issue, the mediawiki on my server crashes. In the error-log of the apache I get that:
Code:
[Tue Jan 29 09:18:07 2013] [notice] child pid 345 exit signal Segmentation fault (11)
[Tue Jan 29 09:18:07 2013] [notice] child pid 346 exit signal Segmentation fault (11)

Since that I rebuild several times the apache, php and other libraries, but it doesn't getting better. Now I used the gdb and saw that php crashes:
Code:

Reading symbols from /lib64/libnss_db.so.2...(no debugging symbols found)...done                                                                                                                     .
Loaded symbols for /lib64/libnss_db.so.2
0x00007fee48c0859d in read () from /lib64/libpthread.so.0
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fee36ffd700 (LWP 487)]
0x00007fee40d12fbd in file_check_mem ()
   from /usr/lib64/apache2/modules/libphp5.so
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x00007fee40d12fbd in file_check_mem ()
   from /usr/lib64/apache2/modules/libphp5.so
(gdb) c
Continuing.
[Thread 0x7fee37fff700 (LWP 482) exited]


Did anybody has an idea how to fix it?
_________________
Byte-Welt.de
Back to top
View user's profile Send private message
TheZog
n00b
n00b


Joined: 17 Aug 2002
Posts: 57
Location: Sunny Seattle

PostPosted: Thu Feb 21, 2013 9:39 pm    Post subject: Reply with quote

I have the exact same issue with MediaWiki 1.20.2 (and 1.20.1) throwing an Apache segmentation fault.
I've tried other versions of PHP (5.4.8, 5.4.9 & 5.4.10) with the same results. I'm currently using dev-lang/php-5.4.11-r2

I've completely recompiled all the installed packages with the exact same outcome. It's really causing us grief at work to have our internal wiki down.
Other PHP apps like phpmyadmin work just fine.

Any help/advise would be much appreciated!
Back to top
View user's profile Send private message
toralf
Advocate
Advocate


Joined: 01 Feb 2004
Posts: 2744
Location: Hamburg/Germany

PostPosted: Tue Mar 05, 2013 3:51 pm    Post subject: Reply with quote

Under a user mode linux image I could convince apache's php module to not segfault by adding this configure option to /etc/apache2/httpd.conf:
Code:
CoreDumpDirectory /tmp/apache2-gdb-dump
(sic!)
Back to top
View user's profile Send private message
damato
n00b
n00b


Joined: 07 Apr 2004
Posts: 24
Location: Dresden, Germany

PostPosted: Sun Apr 28, 2013 2:51 pm    Post subject: Re: PHP/Apache Segmentation fault Reply with quote

STEagleEye wrote:
Hi
Program received signal SIGSEGV, Segmentation fault.
0x00007fee40d12fbd in file_check_mem ()
from /usr/lib64/apache2/modules/libphp5.so
(gdb) c
Continuing.
[Thread 0x7fee37fff700 (LWP 482) exited]
[/code]

Did anybody has an idea how to fix it?


As it seems I am suffering from the exact same problems here. My apache also segfaults in libphp5.so in file_check_mem() which seems to be triggered by using the fileinfo module of php. Since this topic was opened in january and some time has passed. Did someone find a solution yet? I tried recompiling everything from scratch and all involved third-party library without any success. I can easily reproduce the problem by using an own php like this:

Code:

<?php
 $mime_type = @mime_content_type("/tmp/blah.txt");
 echo $mime_type . "\n";
?>


all you have to do is generate a textfile in /tmp/blah.txt. When executing this php script via apache it instantly segfault. Interesting enough it doesn't crash when executing it from command-line. In fact, I can see the same crash happening when using fileinfo directly like that:

Code:

<?php
 $finfo = finfo_open(FILEINFO_MIME);
 if($finfo)
 {
   $mime_type = finfo_file($finfo, "/tmp/blah.txt");
   echo $mime_type . "\n";

   finfo_close($finfo);
 }
?>


this also causes a crash here with also referencing file_check_mem() as you can see here:

Code:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f84167fc700 (LWP 32480)]
0x00007f842639c309 in file_check_mem () from /usr/lib64/apache2/modules/libphp5.so
(gdb) bt
#0  0x00007f842639c309 in file_check_mem () from /usr/lib64/apache2/modules/libphp5.so
#1  0x00007f842639e58c in ?? () from /usr/lib64/apache2/modules/libphp5.so
#2  0x00007f842639e4d6 in file_softmagic () from /usr/lib64/apache2/modules/libphp5.so
#3  0x00007f842639bcd2 in file_buffer () from /usr/lib64/apache2/modules/libphp5.so
#4  0x00007f842639d25c in ?? () from /usr/lib64/apache2/modules/libphp5.so
#5  0x00007f842639d005 in magic_stream () from /usr/lib64/apache2/modules/libphp5.so
#6  0x00007f842638f396 in ?? () from /usr/lib64/apache2/modules/libphp5.so
#7  0x00007f842638f6e6 in zif_mime_content_type () from /usr/lib64/apache2/modules/libphp5.so
#8  0x00007f84268161ae in ?? () from /usr/lib64/apache2/modules/libphp5.so
#9  0x00007f842681b979 in ?? () from /usr/lib64/apache2/modules/libphp5.so
#10 0x00007f842681510f in execute () from /usr/lib64/apache2/modules/libphp5.so
#11 0x00007f84267cdbef in zend_execute_scripts () from /usr/lib64/apache2/modules/libphp5.so
#12 0x00007f842670b829 in php_execute_script () from /usr/lib64/apache2/modules/libphp5.so
#13 0x00007f842689251b in ?? () from /usr/lib64/apache2/modules/libphp5.so
#14 0x000000000044eea6 in ap_invoke_handler ()
#15 0x00000000004646ea in ap_process_async_request ()
#16 0x000000000046474f in ap_process_request ()
#17 0x00000000004612bb in ?? ()
#18 0x0000000000459198 in ap_process_connection ()
#19 0x000000000046e3aa in ?? ()
#20 0x00007f842f7dbf3b in start_thread () from /lib64/libpthread.so.0


So anyone here that can reproduce this or knows how to fix it?!?
Back to top
View user's profile Send private message
STEagleEye
n00b
n00b


Joined: 20 May 2007
Posts: 16

PostPosted: Sun Apr 28, 2013 3:12 pm    Post subject: Reply with quote

currently I've no solution found.

yes for me it's the same result
_________________
Byte-Welt.de
Back to top
View user's profile Send private message
damato
n00b
n00b


Joined: 07 Apr 2004
Posts: 24
Location: Dresden, Germany

PostPosted: Sun Apr 28, 2013 3:14 pm    Post subject: Reply with quote

STEagleEye wrote:
currently I've no solution found.

yes for me it's the same result


:( so you can reproduce the problem using my example php scripts?
Back to top
View user's profile Send private message
STEagleEye
n00b
n00b


Joined: 20 May 2007
Posts: 16

PostPosted: Sun Apr 28, 2013 3:14 pm    Post subject: Reply with quote

jep :(
_________________
Byte-Welt.de
Back to top
View user's profile Send private message
damato
n00b
n00b


Joined: 07 Apr 2004
Posts: 24
Location: Dresden, Germany

PostPosted: Sun Apr 28, 2013 3:17 pm    Post subject: Reply with quote

STEagleEye wrote:
jep :(


ok, I just created a bug report for that issue. see here:

https://bugs.gentoo.org/show_bug.cgi?id=467756

perhaps you can comment there to somewhat raise priority on the matter.
Back to top
View user's profile Send private message
damato
n00b
n00b


Joined: 07 Apr 2004
Posts: 24
Location: Dresden, Germany

PostPosted: Sun Apr 28, 2013 9:51 pm    Post subject: Reply with quote

damato wrote:
STEagleEye wrote:
jep :(


ok, I just created a bug report for that issue. see here:

https://bugs.gentoo.org/show_bug.cgi?id=467756

perhaps you can comment there to somewhat raise priority on the matter.


btw: I just found out that the problem seems to be related more closely to mod_php used with apache as I reconfigured apache to use php with fpm support (fastcgi) and after starting apache with fpm support my example scripts doesn't crash apache anymore.
Back to top
View user's profile Send private message
xaviermiller
Administrator
Administrator


Joined: 23 Jul 2004
Posts: 5709
Location: ~Brussels - Belgique

PostPosted: Wed May 15, 2013 9:09 am    Post subject: Reply with quote

Hello,

I have the same problem with "vanilla" Apache, calling just default index.html.

It works fine on a ~amd64 config (with PHP 5), but not on a ~x86 config/

I did a strace on a one-thread session of APACHE :
Code:
strace /usr/sbin/apache2 -X -D DEFAULT_VHOST -d /usr/lib/apache2 -f /etc/apache2/httpd.conf

it ends with when I open http://localhost/
Code:
gettimeofday({1368598430, 9341}, NULL)  = 0
epoll_create1(EPOLL_CLOEXEC)            = 8
epoll_ctl(8, EPOLL_CTL_ADD, 4, {...})   = 0
semop(1769498, {{0, -1, SEM_UNDO}}, 1)  = 0
accept4(4, {sa_family=AF_INET6, sin6_port=htons(55266), inet_pton(AF_INET6, "::1", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, [28], SOCK_CLOEXEC) = 9
semop(1769498, {{0, 1, SEM_UNDO}}, 1)   = 0
getsockname(9, {sa_family=AF_INET6, sin6_port=htons(80), inet_pton(AF_INET6, "::1", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, [28]) = 0
fcntl64(9, F_GETFL)                     = 0x2 (flags O_RDWR)
fcntl64(9, F_SETFL, O_RDWR|O_NONBLOCK)  = 0
read(9, "GET / HTTP/1.1\r\nHost: n0n4m3.alc"..., 8000) = 327
gettimeofday({1368598432, 684568}, NULL) = 0
stat64("/var/www/localhost/htdocs/", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/var/www/localhost/htdocs/.htaccess", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat64("/var/www/localhost/htdocs/index.html", {st_mode=S_IFREG|0644, st_size=45, ...}) = 0
open("/var/www/localhost/htdocs/index.html", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 10
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_ACCERR, si_addr=0x8064450} ---
+++ killed by SIGSEGV +++

_________________
Kind regards,
Xavier Miller
Back to top
View user's profile Send private message
xaviermiller
Administrator
Administrator


Joined: 23 Jul 2004
Posts: 5709
Location: ~Brussels - Belgique

PostPosted: Wed May 15, 2013 10:22 am    Post subject: Reply with quote

in my case, I added USE=nss for apr-utils and it worked.
_________________
Kind regards,
Xavier Miller
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum