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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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.

)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,12 @@ object UnixDomainSocket extends ExtensionId[UnixDomainSocket] with ExtensionIdPr
val pendingResult = queue.offer(ByteString(buffer))
pendingResult.onComplete(_ => sel.wakeup())
sendReceiveContext.receive = PendingReceiveAck(queue, buffer, pendingResult)
key.interestOps(key.interestOps() & ~SelectionKey.OP_READ)
} else {
queue.complete()
}

key.interestOps(key.interestOps() & ~SelectionKey.OP_READ)

case PendingReceiveAck(receiveQueue, receiveBuffer, pendingResult) if pendingResult.isCompleted =>
pendingResult.value.get match {
case Success(QueueOfferResult.Enqueued) =>
Expand Down