Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
pcntl_fork causing “errno=32 Broken pipe” #474
I am having issues with PHP notices after upgrading from php 5.4.26 to 5.4.28. I original thought it was a php issue but it may be related to this Redis extension.
The full details can be found here http://stackoverflow.com/questions/23713480/after-php-upgrade-pcntl-fork-causing-errno-32-broken-pipe
But basically when I am forking, whenever a child closes, except for the first child, I get an error saying:
It feels like the first child is closing the connection to Redis and then the following children try and close the same connection.
It appears that this has only just started being an issue since either PHP 5.4.27 or 5.4.28
Could this be a phpredis issue?
I have Redis Version => 2.2.5 installed
While I don't know specifically why, I have a strong suspicion that the Zend library might get a little quirky around sockets within the context of a forking. That being said, I'll see if I can replicate your issue based on the stack overflow question you mentioned.
pushed a commit
Nov 18, 2014
3 similar comments
Same here. PHP 5.5.9, phpredis 2.2.7
Simple script to replicate this bug https://gist.github.com/lexaurin/8897f1be48b9e8747b7d/e8a5fcd750623b6fc250f9c529fc2e65cc55893a
Connections before script (
Connections after first child forked:
Connections after second child forked:
Connections after third child forked:
Note: Fact that child closes "both" connections at the end is right (since it shares file descriptor with parent).
Modified my gist a bit to see which process produces notice https://gist.github.com/lexaurin/8897f1be48b9e8747b7d/d46ccd5c2ffabb1c3a09118db80654cb382c6c96
I have same problem, I use pconnect to connect redis.
After fork, I pconnect again, But nothing help.
Sometime always throw exception like this.
This code just manager jobs, and run it.
Then the unix crontab will run it. Same job will pconnect Redis, after pcntl_fork() pconnect Redis can't fix
3 similar comments
2 similar comments
Same error happens to me under CentOS 6 , Redis 3.2.1 with PHP 7.0 & Magento 2