Bug #71433 [NEW]: Basic usage of pcntl_signal causes segfault
| From: | dannykopping at gmail dot com | Date: | Fri, 22 Jan 2016 16:10:58 +0000 |
| Subject: | Bug #71433 [NEW]: Basic usage of pcntl_signal causes segfault | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-198838@lists.php.net to get a copy of this message | ||
From: dannykopping at gmail dot com
Operating system: OSX Yosemite
PHP version: 5.5.31
Package: PCNTL related
Bug Type: Bug
Bug description:Basic usage of pcntl_signal causes segfault
Description:
------------
Using the simple pcntl_signal example from the documentation, this
produces a segfault.
Installed PHP modules:
[PHP Modules]
bcmath
blackfire
bz2
calendar
Core
ctype
curl
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gd
gearman
gettext
hash
iconv
intl
json
ldap
libxml
mbstring
mcrypt
memcache
mhash
mysql
mysqli
mysqlnd
odbc
openssl
pcntl
pcre
PDO
pdo_mysql
PDO_ODBC
pdo_sqlite
phalcon
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
sphinx
SPL
sqlite3
ssh2
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xdebug
xhprof
xml
xmlreader
xmlrpc
xmlwriter
xsl
zip
zlib
[Zend Modules]
Xdebug
blackfire
Test script:
---------------
<?php
// tick use required as of PHP 4.3.0
declare(ticks = 1);
// signal handler function
function sig_handler($signo)
{
switch ($signo) {
case SIGTERM:
// handle shutdown tasks
exit;
break;
case SIGHUP:
// handle restart tasks
break;
case SIGUSR1:
echo "Caught SIGUSR1...\n";
break;
default:
// handle all other signals
}
}
echo "Installing signal handler...\n";
// setup signal handlers
pcntl_signal(SIGTERM, "sig_handler");
pcntl_signal(SIGHUP, "sig_handler");
pcntl_signal(SIGUSR1, "sig_handler");
// or use an object, available as of PHP 4.3.0
// pcntl_signal(SIGUSR1, array($obj, "do_something"));
echo"Generating signal SIGUSR1 to self...\n";
// send SIGUSR1 to current process id
// posix_* functions require the posix extension
posix_kill(posix_getpid(), SIGUSR1);
echo "Done\n";
Expected result:
----------------
I would expect the signal to be handled as it is on ubuntu
Actual result:
--------------
A segmentation fault occurs.
--
Edit bug report at https://bugs.php.net/bug.php?id=71433&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71433&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71433&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71433&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71433&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71433&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71433&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71433&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71433&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71433&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71433&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71433&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71433&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71433&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71433&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71433&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71433&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71433&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71433&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71433&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71433&r=mysqlcfg