Skip to content
  • Josh Rosen's avatar
    947b9020
    [SPARK-14676] Wrap and re-throw Await.result exceptions in order to capture full stacktrace · 947b9020
    Josh Rosen authored
    When `Await.result` throws an exception which originated from a different thread, the resulting stacktrace doesn't include the path leading to the `Await.result` call itself, making it difficult to identify the impact of these exceptions. For example, I've seen cases where broadcast cleaning errors propagate to the main thread and crash it but the resulting stacktrace doesn't include any of the main thread's code, making it difficult to pinpoint which exception crashed that thread.
    
    This patch addresses this issue by explicitly catching, wrapping, and re-throwing exceptions that are thrown by `Await.result`.
    
    I tested this manually using https://github.com/JoshRosen/spark/commit/16b31c825197ee31a50214c6ba3c1df08148f403, a patch which reproduces an issue where an RPC exception which occurs while unpersisting RDDs manages to crash the main thread without any useful stacktrace, and verified that informative, full stacktraces were generated after applying the fix in this PR.
    
    /cc rxin nongli yhuai anabranch
    
    Author: Josh Rosen <joshrosen@databricks.com>
    
    Closes #12433 from JoshRosen/wrap-and-rethrow-await-exceptions.
    947b9020
    [SPARK-14676] Wrap and re-throw Await.result exceptions in order to capture full stacktrace
    Josh Rosen authored
    When `Await.result` throws an exception which originated from a different thread, the resulting stacktrace doesn't include the path leading to the `Await.result` call itself, making it difficult to identify the impact of these exceptions. For example, I've seen cases where broadcast cleaning errors propagate to the main thread and crash it but the resulting stacktrace doesn't include any of the main thread's code, making it difficult to pinpoint which exception crashed that thread.
    
    This patch addresses this issue by explicitly catching, wrapping, and re-throwing exceptions that are thrown by `Await.result`.
    
    I tested this manually using https://github.com/JoshRosen/spark/commit/16b31c825197ee31a50214c6ba3c1df08148f403, a patch which reproduces an issue where an RPC exception which occurs while unpersisting RDDs manages to crash the main thread without any useful stacktrace, and verified that informative, full stacktraces were generated after applying the fix in this PR.
    
    /cc rxin nongli yhuai anabranch
    
    Author: Josh Rosen <joshrosen@databricks.com>
    
    Closes #12433 from JoshRosen/wrap-and-rethrow-await-exceptions.
Loading