Bug #73318 [Com]: curling HTTPS URL in pcntl_fork child causes crash

From: Date: Thu, 20 Oct 2016 18:02:20 +0000
Subject: Bug #73318 [Com]: curling HTTPS URL in pcntl_fork child causes crash
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-204938@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73318&edit=1 ID: 73318 Comment by: dougnelson at silktide dot com Reported by: dougnelson at silktide dot com Summary: curling HTTPS URL in pcntl_fork child causes crash Status: Open Type: Bug Package: cURL related Operating System: MacOS + Linux (confirmed) PHP Version: 7.0.12 Block user comment: N Private report: N New Comment: I've tried to isolate it a bit further and discovered I made a faulty assumption regarding my linux versions. The Linux server I was testing on looks like it was only on 7.0.11. Upgrading it to 7.0.12 does indeed fix the issue. The problem however continues on Mac. The main difference between the two seems to be that the Linux Server uses curl 7.35.0 and the Mac uses 7.43.0. I'm currently trying to work out how to update the version of curl that php is using on Linux to see if the issue reappears on Linux if it's using the same curl version. I'll update if I have any success Previous Comments: ------------------------------------------------------------------------ [2016-10-19 04:02:00] krakjoe@php.net I was actually talking about changes to the openssl extension, sorry that wasn't clear: https://bugs.php.net/bug.php?id=71915 Although those commits were included in 7.0.12, so I'm not so sure this morning. I did try to reproduce this problem on older versions of PHP, so did a few other people and we couldn't. ------------------------------------------------------------------------ [2016-10-18 18:16:13] dougnelson at silktide dot com Hi Krakjoe, thanks for the response. I'm happy to try and confirm this, but can I verify which changes to OpenSSL you're referencing? The latest released version (OpenSSL 1.0.2j) still has this issue, or are you referring to changes that been commited but are yet to be released? ------------------------------------------------------------------------ [2016-10-18 12:46:28] krakjoe@php.net We believe this may have been fixed with the latest changes to OpenSSL. Would be nice if someone could confirm and update this bug. ------------------------------------------------------------------------ [2016-10-13 23:15:40] dougnelson at silktide dot com Description: ------------ Steps: 1. curl a HTTPS URL 2. run pcntl_fork 3. have the child process curl another HTTPS url 4. check the status of the child process, it will have crashed This has been discussed here: http://stackoverflow.com/questions/34901910/curl-and-pcntl-fork And in a different guise here: http://stackoverflow.com/questions/15466809/libcurl-ssl-error-after-fork?lq=1 The answer from the second link implies that it's a known issue when forking with libcurl, and the way to get around it is to call curl_global_cleanup pre-forking, a function that doesn't seem to have a PHP function wrapper. Is this functionality intentionally not exposed through the PHP interface, or is it something that can be added (with the only trauma being the addition of another function)? Test script: --------------- http://pastebin.com/VJNFucmH Expected result: ---------------- d41d8cd98f00b204e9800998ecf8427e 407dfffa37092ff8017e06f071bb0f93 Array ( [URL] => http://php.net [Successful Exit] => Yes [Exit Code] => 0 ) eff6abf853a3b5758b1449bca208df8b Array ( [URL] => https://stackoverflow.com/ [Successful Exit] => Yes [Exit Code] => 0 ) Actual result: -------------- d41d8cd98f00b204e9800998ecf8427e 407dfffa37092ff8017e06f071bb0f93 Array ( [URL] => http://php.net [Process Running] => No [Successful Exit] => Yes [Exit Code] => 0 ) Array ( [URL] => https://stackoverflow.com/ [Process Running] => No [Successful Exit] => No [Exit Code] => 0 ) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73318&edit=1

« previous php.bugs (#204938) next »