Fix peeraddr raises Errno::EINVAL inside reactor #2014
Closed
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.
Hey @nateberkopec
I had a look into the issue #1564 and could not easily mock the object that returns the
peeraddr
as its inside the reactor class.Possible reasons why this error could occur? https://github.com/ruby/ruby/blob/ddf5020e4fcae5ed28a064af10124a032590452f/ext/socket/socket.c#L366
My idea was to create a test that has an expired SSL, that means we hit this part of the code
puma/lib/puma/reactor.rb
Line 234 in 1817773
peeraddr
throw from a mocked object, but could not seem to do that.Any idea on how I can do this, or is there another way I can go about writing a test for this?