yabola commented on PR #37779:
URL: https://github.com/apache/spark/pull/37779#issuecomment-1254883203
@mridulm
Yes, It is another situation, there are three cases to explain whether
uncaughtException can catch exceptions.
1.
As you said
```
private def receiveLoop() {
Executors.newSingleThreadExecutor(threadFactory).execute(new
MessageLoop)
}
```
uncaughtException will be invoked.
2.
If we surrounded with try catch , then uncaughtException won't be invoked.
```
private def receiveLoop() {
try {
Executors.newSingleThreadExecutor(threadFactory).execute(new
MessageLoop)
} catch {
case t: Throwable => {
println("receiveLoop catch the Exception")
}
}
}
```
3.
Even If we surrounded with try-catch , uncaughtException can be invoked if
Exception happened in `TestExceptionHandler.MessageLoop#run()`
But we need to remove the first Exception code in `MessageLoop`( otherwise
it could not be initialized ).
So it can also explain the behavior in Spark.
`org.apache.spark.rpc.netty.MessageLoop#receiveLoop` is surrounded with
try-catch, so when error happened in Executor init , uncaughtException can't
catch the fatal error.
But if Executor initialize successfully, uncaughtException can catch error
in `org.apache.spark.executor.Executor.TaskRunner#run`
--
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]