Skip to content
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

Unix Domain Socket - ensure that interest in READ is removed upon EOF #1056

Merged
merged 2 commits into from
Jul 3, 2018

Conversation

longshorej
Copy link
Contributor

@longshorej longshorej commented Jun 29, 2018

Fixes an issue observed with unix domain socket connector where when the read side was closed, the NIO event loop would go into an infinite loop with channel.read returning -1.

We should have be deregistering interest in READ when completing the queue.

Related PR: #878

/cc @huntc

@@ -312,7 +312,7 @@ object Dependencies {

val UnixDomainSocket = Seq(
libraryDependencies ++= Seq(
"com.github.jnr" % "jnr-unixsocket" % "0.18" // BSD/ApacheV2/CPL/MIT as per https://github.com/akka/alpakka/issues/620#issuecomment-348727265
"com.github.jnr" % "jnr-unixsocket" % "0.19" // BSD/ApacheV2/CPL/MIT as per https://github.com/akka/alpakka/issues/620#issuecomment-348727265
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What’s the fix they made? I’m wondering if they fixed a native buffer issue, in which case perhaps an alternate PR for this with consideration of using native buffers. There’s a FixMe somewhere in this code with a ref to the bug...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Socket options weren't set correctly -- i.e. big endian was always used. This would cause buffer sizes to be quite wrong on intel arch: jnr/jnr-unixsocket@aa2c1e4

jnr/jnr-unixsocket#48 is still open though.

@@ -170,6 +170,7 @@ object UnixDomainSocket extends ExtensionId[UnixDomainSocket] with ExtensionIdPr
sendReceiveContext.receive = PendingReceiveAck(queue, buffer, pendingResult)
key.interestOps(key.interestOps() & ~SelectionKey.OP_READ)
} else {
key.interestOps(key.interestOps() & ~SelectionKey.OP_READ)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can now move outside the conditional block given that both conditions remove the subscription.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, moving it outside the conditional would be good.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved!

@huntc
Copy link
Contributor

huntc commented Jun 29, 2018 via email

Copy link
Member

@2m 2m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with one nitpick.

@longshorej longshorej force-pushed the uds-deregister-read branch from 235f238 to 5932b0c Compare July 2, 2018 15:44
@longshorej longshorej force-pushed the uds-deregister-read branch from 5932b0c to 6977572 Compare July 2, 2018 15:45
@ennru ennru merged commit feedf58 into akka:master Jul 3, 2018
@ennru
Copy link
Member

ennru commented Jul 3, 2018

Thank you, good to see the nifty details fixed.

@longshorej longshorej deleted the uds-deregister-read branch July 3, 2018 15:07
@ennru ennru added this to the 0.20 milestone Jul 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants