JSSE: calling SSLSocket.close() should interrupt threads blocked in select()/poll() #246
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.
This PR adjusts JSSE and lower-level JNI behavior around
SSLSocket.close()
. Whenclose()
is called, it should interrupt any other threads blocked inselect()/poll()
fromread()/write()
operations.This adds a
pipe()
descriptor which is watched byselect()/poll()
. That pipe is written to by a thread callingSSLSocket.close()
to wake those blocked threads up - preventing a possible deadlock in this scenario.This
pipe()
solution is currently only implemented for non-Windows platforms in this PR.Should fix SunJSSE test:
SSLSocketImpl/BlockedAsyncClose.java
.Minor fixes also included in this PR:
CFLAGS
tojava.sh
, ie:CFLAGS="-DTEST_DEFINE" ./java.sh
-DWOLFJNI_USE_IO_SELECT
defined (usesselect()
instead ofpoll()
)WolfSSLSocketTest
TestServer/Client
withCountDownLatch
for proper Exception detectionATOMIC_USER
define gate around nativewolfSSL_GetSide()