Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sysutils/check_reload_status: Handle socket closure correctly. Fixes …
…#14386 In adverse conditions it is possible that php-fpm can actually close a connection from an instance of fcgi-cli and not send a respone at all. This was not handled correctly by the recv loops, which did not recognize the return value 0 on the blocking socket as a closed socket condition. If php-fpm closes the socket prematurely because it is out of resources or hits some other error condition while fcgicli is trying to read a response, this can make it loop indefinitely. Additionally, if read_packet returns a buffer but the header type is not identifiable, the program goes back into another iteration of the reading loop where again the socket may be closed and read_packet loops trying to read the eight byte header. To remedy the problem, the header and body loops are changed to recognize a recv result of 0 as an error condition and drop out returning an NULL buffer pointer. Additionally, the main program loop is changed to bail out if it receives a packet with a header type that is not recognized.
- Loading branch information