-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HADOOP-18024. SocketChannel is not closed when IOException happens in Server$Listener.doAccept #3719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
This is a follow-up for #2727. |
|
💔 -1 overall
This message was automatically generated. |
| try { | ||
| channel.socket().close(); | ||
| channel.close(); | ||
| } catch (IOException ignored) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to log Exception here as Channel could not be closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added the log in a new commit. Thanks
|
💔 -1 overall
This message was automatically generated. |
virajjasani
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good, any chance we could add unit test?
|
@virajjasani I've pushed a commit for the unit test hadoop/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestIPC.java Lines 487 to 532 in c0f405a
hadoop/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestIPC.java Lines 420 to 425 in c0f405a
Then I just override some methods of TestServer and Server$Listener to inject the IOException.In testIOEOnListenerAccept, the first client call encounters the injection in server and thus gets its socket closed. Hence we expect EOFException. The second client call should work normally.Any comment or suggestion? Thank you! |
|
🎊 +1 overall
This message was automatically generated. |
virajjasani
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left few comments. Thanks for including the test @functioner. Could you please also take care of checkstyle warnings?
|
|
||
| /** Listens on the socket. Creates jobs for the handler threads*/ | ||
| private class Listener extends Thread { | ||
| protected class Listener extends Thread { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would have been better if we could keep this private, but it seems we have no better way if we want to test this change (Thanks for the test btw). If we are going to go forward with this, we should annotate this as @VisibleForTesting and @InterfaceAudience.Private.
Let's also get some expert advice on this. cc @aajisaka @ayushtkn @jojochuang
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Server.java
Outdated
Show resolved
Hide resolved
|
@virajjasani Thank you for pointing out the checkstyle issue. I've pushed a new commit to resolve it. |
|
💔 -1 overall
This message was automatically generated. |
|
This time, |
|
🎊 +1 overall
This message was automatically generated. |
|
Seems better. Thanks @functioner. Once more checkstyle warning is pending related to Javadoc. |
|
@virajjasani Sorry that I overlooked this. I've just pushed a new commit. |
|
🎊 +1 overall
This message was automatically generated. |
|
Are there any other issues or concern with the current patch and test? If any, I will resolve ASAP. Will this PR be merged soon by any chance? |
|
+1 (non-binding), Thanks @functioner |
iwasakims
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. mvn test -Dtest=TestIPC#testIOEOnListenerAccept timed out as expected if I commented out the part closing channel in Server.java.
|
I merged this. Thanks, @functioner and @virajjasani. |
… Server$Listener.doAccept (apache#3719)
…ppens in Server$Listener.doAccept (apache#3719)" This reverts commit 6ed0158. Breaks TestIPC#testIOEOnListenerAccept
Description of PR
HADOOP-18024
How was this patch tested?
For code changes:
LICENSE,LICENSE-binary,NOTICE-binaryfiles?