|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-04-14 02:16 UTC] imprec at gmail dot com
Description: ------------ When running example code from eio_open documentation, I sometimes encounter a segmentation fault System : Ubuntu server PHP 5.4.6-1ubuntu1.2 (cli) (built: Mar 11 2013 14:57:54) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies romain@ubuntu:~$ php --ri eio eio eio support => enabled Debug support => disabled Version => 1.2.1 Here are two gdb dumps : GNU gdb (GDB) 7.5-ubuntu Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /usr/bin/php...Reading symbols from /usr/lib/debug/usr/bin/php5...done. done. (gdb) (gdb) Starting program: /usr/bin/php eio.php [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [New Thread 0x7ffff7e58700 (LWP 15599)] string(4) "open" array(13) { ["dev"]=> int(64512) ["ino"]=> int(35081) ["mode"]=> int(33188) ["nlink"]=> int(1) ["uid"]=> int(0) ["size"]=> int(0) ["gid"]=> int(0) ["rdev"]=> int(0) ["blksize"]=> int(4096) ["blocks"]=> int(0) ["atime"]=> int(1365905382) ["mtime"]=> int(1365905382) ["ctime"]=> int(1365905382) } Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7ffff7e58700 (LWP 15599)] 0x00007ffff54ffd98 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux- gnu/libpthread.so.0 (gdb) #0 0x00007ffff54ffd98 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0 No symbol table info available. #1 0x00007ffff4d19c39 in ?? () No symbol table info available. #2 0x0000000000000000 in ?? () No symbol table info available. And : GNU gdb (GDB) 7.5-ubuntu Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /usr/bin/php...Reading symbols from /usr/lib/debug/usr/bin/php5...done. done. (gdb) (gdb) Starting program: /usr/bin/php eio.php [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [New Thread 0x7ffff7e58700 (LWP 15663)] string(4) "open" array(13) { ["dev"]=> int(64512) ["ino"]=> int(35081) ["mode"]=> int(33188) ["nlink"]=> int(1) ["uid"]=> int(0) ["size"]=> int(0) ["gid"]=> int(0) ["rdev"]=> int(0) ["blksize"]=> int(4096) ["blocks"]=> int(0) ["atime"]=> int(1365905444) ["mtime"]=> int(1365905444) ["ctime"]=> int(1365905444) } Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7ffff7e58700 (LWP 15663)] 0x00007ffff4d19d34 in ?? () (gdb) #0 0x00007ffff4d19d34 in ?? () No symbol table info available. #1 0x0000000000000000 in ?? () No symbol table info available. Test script: --------------- / Create temporary file $tmp_filename = dirname(__FILE__) ."/eio-file.tmp"; touch($tmp_filename); /* Is called when eio_fstat() done */ function my_res_cb($data, $result) { // Should output array with stat info var_dump($result); if ($data['fd']) { // Close temporary file eio_close($data['fd']); eio_event_loop(); } // Remove temporary file @unlink($data['file']); } /* Is called when eio_open() done */ function my_open_cb($data, $result) { var_dump('open'); // Prepare data for callback $d = array( 'fd' => $result, 'file'=> $data ); // Request stat info eio_fstat($result, EIO_PRI_DEFAULT, "my_res_cb", $d); // Process request(s) eio_event_loop(); } // Open temporary file eio_open($tmp_filename, EIO_O_RDONLY, NULL, EIO_PRI_DEFAULT, "my_open_cb", $tmp_filename); eio_event_loop(); PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 08 06:00:01 2025 UTC |
Re, no, I'm not using pthreads... I supposed it's used by eio. Actually, as I got a pthread error when loading the library I found this option in ./configure --help of PHP. I've rebuilt a PHP 5.4.14 from scratch with : romain@ubuntu:~/php-5.4.14$ php -i|grep configure Configure Command => './configure' '--enable-debug' '--enable-maintainer-zts' romain@ubuntu:~/php-5.4.14$ php -v PHP 5.4.14 (cli) (built: Apr 14 2013 19:38:49) (DEBUG) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies romain@ubuntu:~/php-5.4.14$ php -m [PHP Modules] Core ctype date dom eio ereg fileinfo filter hash iconv json libxml pcre PDO pdo_sqlite Phar posix Reflection session SimpleXML SPL sqlite3 standard tokenizer xml xmlreader xmlwriter [Zend Modules] romain@ubuntu:~/php-5.4.14$ php --ri eio eio eio support => enabled Debug support => enabled Version => 1.2.1 Yes I run the script I provided (that is a direct copy/paste of PHP eio doc) : // Create temporary file $tmp_filename = dirname(__FILE__) ."/eio-file.tmp"; touch($tmp_filename); /* Is called when eio_fstat() done */ function my_res_cb($data, $result) { // Should output array with stat info var_dump($result); if ($data['fd']) { // Close temporary file eio_close($data['fd']); eio_event_loop(); } // Remove temporary file @unlink($data['file']); } /* Is called when eio_open() done */ function my_open_cb($data, $result) { var_dump('open'); // Prepare data for callback $d = array( 'fd' => $result, 'file'=> $data ); // Request stat info eio_fstat($result, EIO_PRI_DEFAULT, "my_res_cb", $d); // Process request(s) eio_event_loop(); } // Open temporary file eio_open($tmp_filename, EIO_O_RDONLY, NULL, EIO_PRI_DEFAULT, "my_open_cb", $tmp_filename); eio_event_loop(); with a GDB script : set env MALLOC_CHECK_=3 run backtrace full and produces : romain@ubuntu:~$ cat script.gdb | sudo gdb --args /usr/local/bin/php eio- debug.php GNU gdb (GDB) 7.5-ubuntu Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /usr/local/bin/php...done. (gdb) (gdb) Starting program: /usr/local/bin/php eio-debug.php [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [New Thread 0x7ffff7e23700 (LWP 6599)] string(4) "open" array(13) { ["dev"]=> int(64512) ["ino"]=> int(42512) ["mode"]=> int(33188) ["nlink"]=> int(1) ["uid"]=> int(0) ["size"]=> int(0) ["gid"]=> int(0) ["rdev"]=> int(0) ["blksize"]=> int(4096) ["blocks"]=> int(0) ["atime"]=> int(1365961389) ["mtime"]=> int(1365961389) ["ctime"]=> int(1365961389) } Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7ffff7e23700 (LWP 6599)] 0x00007ffff66e98b6 in ?? () (gdb) #0 0x00007ffff66e98b6 in ?? () No symbol table info available. #1 0x00007ffff7e23700 in ?? () No symbol table info available. #2 0x0000000001130870 in ?? () No symbol table info available. #3 0x0000000001130870 in ?? () No symbol table info available. #4 0x0000000001131320 in ?? () No symbol table info available. #5 0x0000000000000000 in ?? () No symbol table info available. (gdb) quit A debugging session is active. Inferior 1 [process 6596] will be killed. Quit anyway? (y or n) [answered Y; input not from terminal]