Github user vanzin commented on a diff in the pull request: https://github.com/apache/spark/pull/9197#discussion_r42699677 --- Diff: core/src/main/scala/org/apache/spark/rpc/netty/NettyRpcEnv.scala --- @@ -116,6 +135,30 @@ private[netty] class NettyRpcEnv( dispatcher.stop(endpointRef) } + private def postToOutbox(address: RpcAddress, message: OutboxMessage): Unit = { + val targetOutbox = { + val outbox = outboxes.get(address) + if (outbox == null) { + val newOutbox = new Outbox(this, address) + val oldOutbox = outboxes.putIfAbsent(address, newOutbox) + if (oldOutbox == null) { + newOutbox + } else { + oldOutbox + } + } else { + outbox + } + } + if (stopped.get) { + // It's possible that we put `targetOutbox` after stopping. So we need to clean it. + outboxes.remove(address) + targetOutbox.stop() + } else { + targetOutbox.send(message) --- End diff -- So this is slightly racy, since `stopped` may have been flipped since you last checked it.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org