sadikovi opened a new pull request, #60149: URL: https://github.com/apache/spark/pull/60149
### What changes were proposed in this pull request? `MapOutputTrackerMasterEndpoint` does not answer `GetMapOutputStatuses`, `GetMapAndMergeResultStatuses` or `GetShufflePushMergerLocations` itself. It posts each request, together with its `RpcCallContext`, to a queue that `MapOutputTrackerMaster.MessageLoop` threads serve. If handling a message throws a non-fatal exception, `MessageLoop` logs it and never replies. This PR makes `MessageLoop` reply with that exception instead: - Adds `def context: RpcCallContext` to the sealed, `private[spark]` `MapOutputTrackerMasterMessage` trait. All three case classes already have this field, so this only declares it on the trait. - Takes the message from the queue, and checks for `PoisonPill`, before the inner `try`, so the message is in scope in the `catch`. An `InterruptedException` from `take()` still reaches the outer `catch` and stops the loop, as before. - In the `catch`, calls `context.sendFailure(e)` after logging, through a new `replyFailure` helper. If `sendFailure` itself throws (for example, the exception cannot be serialized), the helper logs a warning and returns. Without that, the exception would escape to the outer `catch`, which only handles `InterruptedException`, and kill the dispatcher thread. ### Why are the changes needed? Once a request is queued, the RPC `Inbox` considers it handled, so only `MessageLoop` can answer it. When the handler throws, nobody answers: the caller (normally `MapOutputTrackerWorker` on an executor) blocks in `askSync` until `spark.rpc.askTimeout` expires (120s by default), then fails with an `RpcTimeoutException` that hides the real error. If a retried task hits the same exception, every attempt waits out the full timeout. One easy trigger is a request for a shuffle that is unregistered after the request is posted but before `MessageLoop` handles it. `handleStatusMessage` calls `shuffleStatuses.get(shuffleId).head`, which throws `NoSuchElementException`, and that request never gets a reply. Failures while serializing or sending the reply take the same path. ### Does this PR introduce _any_ user-facing change? No API change: the modified trait is `private[spark]` and sealed. If the driver fails to handle a map output status request, the task now fails immediately with the actual error, instead of after `spark.rpc.askTimeout` with an RPC timeout error. Successful requests behave as before. ### How was this patch tested? Added three tests to `MapOutputTrackerSuite`. They post messages directly to the master's message loop, bypassing the endpoint, so the exception is thrown on the dispatcher thread rather than in the RPC `Inbox`: All three fail on current master (`WantedButNotInvoked` after the 30s verification timeout) and pass with this change. The whole suite passes: ```shell build/sbt "core/testOnly org.apache.spark.MapOutputTrackerSuite" ``` ### Was this patch authored or co-authored using generative AI tooling? Yes -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
