Fix #79497: issue with php_openssl_subtract_timeval() causing ssl connection errors#5422
Closed
joec4i wants to merge 1 commit intophp:masterfrom
Closed
Fix #79497: issue with php_openssl_subtract_timeval() causing ssl connection errors#5422joec4i wants to merge 1 commit intophp:masterfrom
joec4i wants to merge 1 commit intophp:masterfrom
Conversation
nikic
approved these changes
Apr 20, 2020
Member
|
Merged as 94e09bf into 7.3+. Thanks! |
Member
|
@nikic please can we not merge fixes without the test when there is a script to reproduce. |
Member
|
I know that the tests might be more pain but it would be really good to have all changes tested. |
Member
|
I mean writing the tests is often much harder than the actual fix but we should really at least try to request them and merge it without the test only if it's really really hard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I stumbled upon this while debugging a strange issue with
stream_socket_client()where it randomly throws out errors when the connection timeout is set to below 1s. The logic to calculate time difference inphp_openssl_subtract_timeval()is wrong whena.tv_usec < b.tv_usec, causing connection errors before the timeout is reached.I have created a script to reproduce the issue - https://gist.github.com/joec4i/ef1b1156ed79e23487400c68a5f693cb
Before the patch
The number of errors may vary but as you can see, connection failures happened way before the 0.9s timeout.
After the patch
Please review. Thanks!