Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9197#discussion_r42699651
  
    --- 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()
    --- End diff --
    
    I assume `stop` is idempotent (haven't gotten there yet).


---
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

Reply via email to