-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-9844][CORE] File appender race condition during shutdown #10714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-9844][CORE] File appender race condition during shutdown #10714
Conversation
… if marked as stopped and changed file operation block to use tryWithSafeFinally
…heck for getThrowableInformation null
|
Test build #49198 has finished for PR 10714 at commit
|
|
Test build #49219 has finished for PR 10714 at commit
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's worth changing as this is fine, but I think you could just write
case _: IOException if markedForStop => // do nothing because ...
... but maybe I'm missing something about how that works.
…if positive bytes are read
|
Thanks @srowen , I think your suggestion makes it easier to follow what is going on, so I made that change. I also changed the check for appending for only if positive bytes are read, which will just save a call to |
|
Test build #49256 has finished for PR 10714 at commit
|
|
jenkins retest this please |
|
Test build #49263 has finished for PR 10714 at commit
|
|
LGTM |
When an Executor process is destroyed, the FileAppender that is asynchronously reading the stderr stream of the process can throw an IOException during read because the stream is closed. Before the ExecutorRunner destroys the process, the FileAppender thread is flagged to stop. This PR wraps the inputStream.read call of the FileAppender in a try/catch block so that if an IOException is thrown and the thread has been flagged to stop, it will safely ignore the exception. Additionally, the FileAppender thread was changed to use Utils.tryWithSafeFinally to better log any exception that do occur. Added unit tests to verify a IOException is thrown and logged if FileAppender is not flagged to stop, and that no IOException when the flag is set. Author: Bryan Cutler <[email protected]> Closes #10714 from BryanCutler/file-appender-read-ioexception-SPARK-9844. (cherry picked from commit 56cdbd6) Signed-off-by: Sean Owen <[email protected]>
|
Merged to master, 1.6 |
|
Thanks! |
|
yea no problem. Will keep an eye on the test. |
|
Ah, I know what's going on @yhuai and @srowen . The cherry pick is fine, but I had SPARK-12701 merged earlier because of this reason, and it just went into master. Since the thread isn't properly joined, the test can exit before the log is written, and that is what the test is checking. Can we get SPARK-12701 also on 1.6? |
|
@srowen @zsxwing Is it safe to merge https://issues.apache.org/jira/browse/SPARK-12701 to branch 1.6? Or, we should revert it from branch 1.6? |
|
I think it is safe to back-port. I'll do that now. |
|
Yeah, it should be safe to backport, only the tests actually call |
When an Executor process is destroyed, the FileAppender that is asynchronously reading the stderr stream of the process can throw an IOException during read because the stream is closed. Before the ExecutorRunner destroys the process, the FileAppender thread is flagged to stop. This PR wraps the inputStream.read call of the FileAppender in a try/catch block so that if an IOException is thrown and the thread has been flagged to stop, it will safely ignore the exception. Additionally, the FileAppender thread was changed to use Utils.tryWithSafeFinally to better log any exception that do occur. Added unit tests to verify a IOException is thrown and logged if FileAppender is not flagged to stop, and that no IOException when the flag is set.