RdmaServerEndpoint accept may return null, if listening endpoint closes.#54
Open
BernardMetzler wants to merge 1 commit into
Open
RdmaServerEndpoint accept may return null, if listening endpoint closes.#54BernardMetzler wants to merge 1 commit into
BernardMetzler wants to merge 1 commit into
Conversation
PepperJo
suggested changes
Oct 5, 2020
| logger.info("connect request received"); | ||
| endpoint.accept(); | ||
| } | ||
| return endpoint; |
Contributor
There was a problem hiding this comment.
Are we sure applications are handling the case correctly if null is returned here? Might as well throw an exception (Much like before)?
Author
|
-----"Jonas Pfefferle" <notifications@github.com> wrote: -----
To: "zrlio/disni" ***@***.***>
From: "Jonas Pfefferle" ***@***.***>
Date: 10/05/2020 08:29AM
Cc: "Bernard Metzler" ***@***.***>, "Author"
***@***.***>
Subject: [EXTERNAL] Re: [zrlio/disni] RdmaServerEndpoint accept may
return null, if listening endpoint closes. (#54)
@PepperJo requested changes on this pull request.
In src/main/java/com/ibm/disni/RdmaServerEndpoint.java:
> @@ -130,8 +130,12 @@ public C accept() throws IOException {
}
}
C endpoint = requested.poll();
- logger.info("connect request received");
- endpoint.accept();
+
+ // a null endpoint gets returned if listening endpoint closes
+ if (endpoint != null) {
+ logger.info("connect request received");
+ endpoint.accept();
+ }
return endpoint;
Are we sure applications are handling the case correctly if null is
returned here? Might as well throw an exception (Much like before)?
No we are not sure. The patch would change the semantics of a server
endpoint, and applications would have to be aware of it. We run into
it, if we are terminating a server endpoint, which is still in its
accept call. Do we want to crash here, or give the application a chance
to handle that gracefully...
… —
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Contributor
|
But we don't really crash, we just throw an exception which can be
gracefully handled.
If we want the application to be able to distinguish we should make sure to
throw a different exception type.
On Mon, 05 Oct 2020 07:39:19 -0700
Bernard Metzler <notifications@github.com> wrote:
… -----"Jonas Pfefferle" ***@***.***> wrote: -----
>To: "zrlio/disni" ***@***.***>
>From: "Jonas Pfefferle" ***@***.***>
>Date: 10/05/2020 08:29AM
>Cc: "Bernard Metzler" ***@***.***>, "Author"
***@***.***>
>Subject: [EXTERNAL] Re: [zrlio/disni] RdmaServerEndpoint accept may
>return null, if listening endpoint closes. (#54)
>
>
> @PepperJo requested changes on this pull request.
> In src/main/java/com/ibm/disni/RdmaServerEndpoint.java:
> > @@ -130,8 +130,12 @@ public C accept() throws IOException {
> }
> }
> C endpoint = requested.poll();
>- logger.info("connect request received");
>- endpoint.accept();
>+
>+ // a null endpoint gets returned if listening endpoint closes
>+ if (endpoint != null) {
>+ logger.info("connect request received");
>+ endpoint.accept();
>+ }
> return endpoint;
> Are we sure applications are handling the case correctly if null is
>returned here? Might as well throw an exception (Much like before)?
No we are not sure. The patch would change the semantics of a server
endpoint, and applications would have to be aware of it. We run into
it, if we are terminating a server endpoint, which is still in its
accept call. Do we want to crash here, or give the application a
chance
to handle that gracefully...
> —
>You are receiving this because you authored the thread.
>Reply to this email directly, view it on GitHub, or unsubscribe.
>
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#54 (comment)
|
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.
Closing the RdmaServerEndpoint in a current accept() lets a poll of the private accepting endpoint queue return null. This patch just avoids dereferencing that null endpoint during accept(). The caller of RdmaServerEndpoint.accept() must handle that case appropriately.