[jira] [Commented] (KAFKA-4039) Exit Strategy: using exceptions instead of inline invocation of exit/halt
[ https://issues.apache.org/jira/browse/KAFKA-4039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15850618#comment-15850618 ] ASF GitHub Bot commented on KAFKA-4039: --- Github user asfgit closed the pull request at: https://github.com/apache/kafka/pull/2474 > Exit Strategy: using exceptions instead of inline invocation of exit/halt > - > > Key: KAFKA-4039 > URL: https://issues.apache.org/jira/browse/KAFKA-4039 > Project: Kafka > Issue Type: Bug > Components: core >Affects Versions: 0.10.0.0 >Reporter: Maysam Yabandeh >Priority: Critical > Labels: reliability > Fix For: 0.10.3.0 > > Attachments: deadlock-stack2 > > > The current practice is to directly invoke halt/exit right after the line > that intends to terminate the execution. In the case of System.exit this > could cause deadlocks if the thread invoking System.exit is holding a lock > that will be requested by the shutdown hook threads that will be started by > System.exit. An example is reported by [~aozeritsky] in KAFKA-3924. This > would also makes testing more difficult as it would require mocking static > methods of System and Runtime classes, which is not natively supported in > Java. > One alternative suggested > [here|https://issues.apache.org/jira/browse/KAFKA-3924?focusedCommentId=15420269=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15420269] > would be to throw some dedicated exceptions that will eventually invoke > exit/halt: > {quote} it would be great to move away from executing `System.exit` inline in > favour of throwing an exception (two examples, but maybe we can find better > names: FatalExitException and FatalHaltException) that is caught by some > central code that then does the `System.exit` or `Runtime.getRuntime.halt`. > This helps in a couple of ways: > (1) Avoids issues with locks being held as in this issue > (2) It makes it possible to abstract the action, which is very useful in > tests. At the moment, we can't easily test for these conditions as they cause > the whole test harness to exit. Worse, these conditions are sometimes > triggered in the tests and it's unclear why. > (3) We can have more consistent logging around these actions and possibly > extended logging for tests > {quote} -- This message was sent by Atlassian JIRA (v6.3.15#6346)
[jira] [Commented] (KAFKA-4039) Exit Strategy: using exceptions instead of inline invocation of exit/halt
[ https://issues.apache.org/jira/browse/KAFKA-4039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15721224#comment-15721224 ] Maysam Yabandeh commented on KAFKA-4039: I am afraid I do not have much free cycles left to work on this jira. The task is up for grab. > Exit Strategy: using exceptions instead of inline invocation of exit/halt > - > > Key: KAFKA-4039 > URL: https://issues.apache.org/jira/browse/KAFKA-4039 > Project: Kafka > Issue Type: Bug > Components: core >Affects Versions: 0.10.0.0 >Reporter: Maysam Yabandeh >Priority: Critical > Labels: reliability > Fix For: 0.10.2.0 > > Attachments: deadlock-stack2 > > > The current practice is to directly invoke halt/exit right after the line > that intends to terminate the execution. In the case of System.exit this > could cause deadlocks if the thread invoking System.exit is holding a lock > that will be requested by the shutdown hook threads that will be started by > System.exit. An example is reported by [~aozeritsky] in KAFKA-3924. This > would also makes testing more difficult as it would require mocking static > methods of System and Runtime classes, which is not natively supported in > Java. > One alternative suggested > [here|https://issues.apache.org/jira/browse/KAFKA-3924?focusedCommentId=15420269=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15420269] > would be to throw some dedicated exceptions that will eventually invoke > exit/halt: > {quote} it would be great to move away from executing `System.exit` inline in > favour of throwing an exception (two examples, but maybe we can find better > names: FatalExitException and FatalHaltException) that is caught by some > central code that then does the `System.exit` or `Runtime.getRuntime.halt`. > This helps in a couple of ways: > (1) Avoids issues with locks being held as in this issue > (2) It makes it possible to abstract the action, which is very useful in > tests. At the moment, we can't easily test for these conditions as they cause > the whole test harness to exit. Worse, these conditions are sometimes > triggered in the tests and it's unclear why. > (3) We can have more consistent logging around these actions and possibly > extended logging for tests > {quote} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (KAFKA-4039) Exit Strategy: using exceptions instead of inline invocation of exit/halt
[ https://issues.apache.org/jira/browse/KAFKA-4039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15706109#comment-15706109 ] Guozhang Wang commented on KAFKA-4039: -- Discussed offline, we will move this out of 0.10.1.1 as there was no consensus on the solution yet. > Exit Strategy: using exceptions instead of inline invocation of exit/halt > - > > Key: KAFKA-4039 > URL: https://issues.apache.org/jira/browse/KAFKA-4039 > Project: Kafka > Issue Type: Bug > Components: core >Affects Versions: 0.10.0.0 >Reporter: Maysam Yabandeh >Priority: Critical > Fix For: 0.10.2.0 > > Attachments: deadlock-stack2 > > > The current practice is to directly invoke halt/exit right after the line > that intends to terminate the execution. In the case of System.exit this > could cause deadlocks if the thread invoking System.exit is holding a lock > that will be requested by the shutdown hook threads that will be started by > System.exit. An example is reported by [~aozeritsky] in KAFKA-3924. This > would also makes testing more difficult as it would require mocking static > methods of System and Runtime classes, which is not natively supported in > Java. > One alternative suggested > [here|https://issues.apache.org/jira/browse/KAFKA-3924?focusedCommentId=15420269=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15420269] > would be to throw some dedicated exceptions that will eventually invoke > exit/halt: > {quote} it would be great to move away from executing `System.exit` inline in > favour of throwing an exception (two examples, but maybe we can find better > names: FatalExitException and FatalHaltException) that is caught by some > central code that then does the `System.exit` or `Runtime.getRuntime.halt`. > This helps in a couple of ways: > (1) Avoids issues with locks being held as in this issue > (2) It makes it possible to abstract the action, which is very useful in > tests. At the moment, we can't easily test for these conditions as they cause > the whole test harness to exit. Worse, these conditions are sometimes > triggered in the tests and it's unclear why. > (3) We can have more consistent logging around these actions and possibly > extended logging for tests > {quote} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (KAFKA-4039) Exit Strategy: using exceptions instead of inline invocation of exit/halt
[ https://issues.apache.org/jira/browse/KAFKA-4039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15703697#comment-15703697 ] Guozhang Wang commented on KAFKA-4039: -- Ping [~hachikuji] [~ijuma] again. > Exit Strategy: using exceptions instead of inline invocation of exit/halt > - > > Key: KAFKA-4039 > URL: https://issues.apache.org/jira/browse/KAFKA-4039 > Project: Kafka > Issue Type: Bug > Components: core >Affects Versions: 0.10.0.0 >Reporter: Maysam Yabandeh >Priority: Critical > Fix For: 0.10.1.1 > > Attachments: deadlock-stack2 > > > The current practice is to directly invoke halt/exit right after the line > that intends to terminate the execution. In the case of System.exit this > could cause deadlocks if the thread invoking System.exit is holding a lock > that will be requested by the shutdown hook threads that will be started by > System.exit. An example is reported by [~aozeritsky] in KAFKA-3924. This > would also makes testing more difficult as it would require mocking static > methods of System and Runtime classes, which is not natively supported in > Java. > One alternative suggested > [here|https://issues.apache.org/jira/browse/KAFKA-3924?focusedCommentId=15420269=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15420269] > would be to throw some dedicated exceptions that will eventually invoke > exit/halt: > {quote} it would be great to move away from executing `System.exit` inline in > favour of throwing an exception (two examples, but maybe we can find better > names: FatalExitException and FatalHaltException) that is caught by some > central code that then does the `System.exit` or `Runtime.getRuntime.halt`. > This helps in a couple of ways: > (1) Avoids issues with locks being held as in this issue > (2) It makes it possible to abstract the action, which is very useful in > tests. At the moment, we can't easily test for these conditions as they cause > the whole test harness to exit. Worse, these conditions are sometimes > triggered in the tests and it's unclear why. > (3) We can have more consistent logging around these actions and possibly > extended logging for tests > {quote} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (KAFKA-4039) Exit Strategy: using exceptions instead of inline invocation of exit/halt
[ https://issues.apache.org/jira/browse/KAFKA-4039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15703696#comment-15703696 ] Guozhang Wang commented on KAFKA-4039: -- Ping [~hachikuji] [~ijuma] again. > Exit Strategy: using exceptions instead of inline invocation of exit/halt > - > > Key: KAFKA-4039 > URL: https://issues.apache.org/jira/browse/KAFKA-4039 > Project: Kafka > Issue Type: Bug > Components: core >Affects Versions: 0.10.0.0 >Reporter: Maysam Yabandeh >Priority: Critical > Fix For: 0.10.1.1 > > Attachments: deadlock-stack2 > > > The current practice is to directly invoke halt/exit right after the line > that intends to terminate the execution. In the case of System.exit this > could cause deadlocks if the thread invoking System.exit is holding a lock > that will be requested by the shutdown hook threads that will be started by > System.exit. An example is reported by [~aozeritsky] in KAFKA-3924. This > would also makes testing more difficult as it would require mocking static > methods of System and Runtime classes, which is not natively supported in > Java. > One alternative suggested > [here|https://issues.apache.org/jira/browse/KAFKA-3924?focusedCommentId=15420269=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15420269] > would be to throw some dedicated exceptions that will eventually invoke > exit/halt: > {quote} it would be great to move away from executing `System.exit` inline in > favour of throwing an exception (two examples, but maybe we can find better > names: FatalExitException and FatalHaltException) that is caught by some > central code that then does the `System.exit` or `Runtime.getRuntime.halt`. > This helps in a couple of ways: > (1) Avoids issues with locks being held as in this issue > (2) It makes it possible to abstract the action, which is very useful in > tests. At the moment, we can't easily test for these conditions as they cause > the whole test harness to exit. Worse, these conditions are sometimes > triggered in the tests and it's unclear why. > (3) We can have more consistent logging around these actions and possibly > extended logging for tests > {quote} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (KAFKA-4039) Exit Strategy: using exceptions instead of inline invocation of exit/halt
[ https://issues.apache.org/jira/browse/KAFKA-4039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15691142#comment-15691142 ] Guozhang Wang commented on KAFKA-4039: -- [~hachikuji] [~ijuma] If you guys feel it is an important fix to be in 0.10.1.1, maybe you can review and merge it? > Exit Strategy: using exceptions instead of inline invocation of exit/halt > - > > Key: KAFKA-4039 > URL: https://issues.apache.org/jira/browse/KAFKA-4039 > Project: Kafka > Issue Type: Bug > Components: core >Affects Versions: 0.10.0.0 >Reporter: Maysam Yabandeh >Priority: Critical > Fix For: 0.10.1.1 > > Attachments: deadlock-stack2 > > > The current practice is to directly invoke halt/exit right after the line > that intends to terminate the execution. In the case of System.exit this > could cause deadlocks if the thread invoking System.exit is holding a lock > that will be requested by the shutdown hook threads that will be started by > System.exit. An example is reported by [~aozeritsky] in KAFKA-3924. This > would also makes testing more difficult as it would require mocking static > methods of System and Runtime classes, which is not natively supported in > Java. > One alternative suggested > [here|https://issues.apache.org/jira/browse/KAFKA-3924?focusedCommentId=15420269=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15420269] > would be to throw some dedicated exceptions that will eventually invoke > exit/halt: > {quote} it would be great to move away from executing `System.exit` inline in > favour of throwing an exception (two examples, but maybe we can find better > names: FatalExitException and FatalHaltException) that is caught by some > central code that then does the `System.exit` or `Runtime.getRuntime.halt`. > This helps in a couple of ways: > (1) Avoids issues with locks being held as in this issue > (2) It makes it possible to abstract the action, which is very useful in > tests. At the moment, we can't easily test for these conditions as they cause > the whole test harness to exit. Worse, these conditions are sometimes > triggered in the tests and it's unclear why. > (3) We can have more consistent logging around these actions and possibly > extended logging for tests > {quote} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (KAFKA-4039) Exit Strategy: using exceptions instead of inline invocation of exit/halt
[ https://issues.apache.org/jira/browse/KAFKA-4039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15498509#comment-15498509 ] Ismael Juma commented on KAFKA-4039: Seems important to fix the deadlock for 0.10.1.0. > Exit Strategy: using exceptions instead of inline invocation of exit/halt > - > > Key: KAFKA-4039 > URL: https://issues.apache.org/jira/browse/KAFKA-4039 > Project: Kafka > Issue Type: Bug > Components: core >Affects Versions: 0.10.0.0 >Reporter: Maysam Yabandeh >Priority: Critical > Fix For: 0.10.1.0 > > Attachments: deadlock-stack2 > > > The current practice is to directly invoke halt/exit right after the line > that intends to terminate the execution. In the case of System.exit this > could cause deadlocks if the thread invoking System.exit is holding a lock > that will be requested by the shutdown hook threads that will be started by > System.exit. An example is reported by [~aozeritsky] in KAFKA-3924. This > would also makes testing more difficult as it would require mocking static > methods of System and Runtime classes, which is not natively supported in > Java. > One alternative suggested > [here|https://issues.apache.org/jira/browse/KAFKA-3924?focusedCommentId=15420269=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15420269] > would be to throw some dedicated exceptions that will eventually invoke > exit/halt: > {quote} it would be great to move away from executing `System.exit` inline in > favour of throwing an exception (two examples, but maybe we can find better > names: FatalExitException and FatalHaltException) that is caught by some > central code that then does the `System.exit` or `Runtime.getRuntime.halt`. > This helps in a couple of ways: > (1) Avoids issues with locks being held as in this issue > (2) It makes it possible to abstract the action, which is very useful in > tests. At the moment, we can't easily test for these conditions as they cause > the whole test harness to exit. Worse, these conditions are sometimes > triggered in the tests and it's unclear why. > (3) We can have more consistent logging around these actions and possibly > extended logging for tests > {quote} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (KAFKA-4039) Exit Strategy: using exceptions instead of inline invocation of exit/halt
[ https://issues.apache.org/jira/browse/KAFKA-4039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15425123#comment-15425123 ] ASF GitHub Bot commented on KAFKA-4039: --- GitHub user maysamyabandeh opened a pull request: https://github.com/apache/kafka/pull/1755 KAFKA-4039: delay invocation of System.exit via FatalExitException @resetius would be great if you can confirm that the deadlock no longer manifests with the path. Thanks You can merge this pull request into a Git repository by running: $ git pull https://github.com/maysamyabandeh/kafka KAFKA-4039 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/kafka/pull/1755.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1755 commit d902c2bc81c4799ad1eb7bc7ec50e67d04d1c9c2 Author: Maysam YabandehDate: 2016-08-17T18:21:07Z KAFKA-4039: delay invocation of System.exit via FatalExitException > Exit Strategy: using exceptions instead of inline invocation of exit/halt > - > > Key: KAFKA-4039 > URL: https://issues.apache.org/jira/browse/KAFKA-4039 > Project: Kafka > Issue Type: Bug > Components: core >Affects Versions: 0.10.0.0 >Reporter: Maysam Yabandeh > > The current practice is to directly invoke halt/exit right after the line > that intends to terminate the execution. In the case of System.exit this > could cause deadlocks if the thread invoking System.exit is holding a lock > that will be requested by the shutdown hook threads that will be started by > System.exit. An example is reported by [~aozeritsky] in KAFKA-3924. This > would also makes testing more difficult as it would require mocking static > methods of System and Runtime classes, which is not natively supported in > Java. > One alternative suggested > [here|https://issues.apache.org/jira/browse/KAFKA-3924?focusedCommentId=15420269=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15420269] > would be to throw some dedicated exceptions that will eventually invoke > exit/halt: > {quote} it would be great to move away from executing `System.exit` inline in > favour of throwing an exception (two examples, but maybe we can find better > names: FatalExitException and FatalHaltException) that is caught by some > central code that then does the `System.exit` or `Runtime.getRuntime.halt`. > This helps in a couple of ways: > (1) Avoids issues with locks being held as in this issue > (2) It makes it possible to abstract the action, which is very useful in > tests. At the moment, we can't easily test for these conditions as they cause > the whole test harness to exit. Worse, these conditions are sometimes > triggered in the tests and it's unclear why. > (3) We can have more consistent logging around these actions and possibly > extended logging for tests > {quote} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (KAFKA-4039) Exit Strategy: using exceptions instead of inline invocation of exit/halt
[ https://issues.apache.org/jira/browse/KAFKA-4039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15424201#comment-15424201 ] Alexey Ozeritskiy commented on KAFKA-4039: -- Thanks [~maysamyabandeh] I'll be happy to test your patch. > Exit Strategy: using exceptions instead of inline invocation of exit/halt > - > > Key: KAFKA-4039 > URL: https://issues.apache.org/jira/browse/KAFKA-4039 > Project: Kafka > Issue Type: Bug > Components: core >Affects Versions: 0.10.0.0 >Reporter: Maysam Yabandeh > > The current practice is to directly invoke halt/exit right after the line > that intends to terminate the execution. In the case of System.exit this > could cause deadlocks if the thread invoking System.exit is holding a lock > that will be requested by the shutdown hook threads that will be started by > System.exit. An example is reported by [~aozeritsky] in KAFKA-3924. This > would also makes testing more difficult as it would require mocking static > methods of System and Runtime classes, which is not natively supported in > Java. > One alternative suggested > [here|https://issues.apache.org/jira/browse/KAFKA-3924?focusedCommentId=15420269=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15420269] > would be to throw some dedicated exceptions that will eventually invoke > exit/halt: > {quote} it would be great to move away from executing `System.exit` inline in > favour of throwing an exception (two examples, but maybe we can find better > names: FatalExitException and FatalHaltException) that is caught by some > central code that then does the `System.exit` or `Runtime.getRuntime.halt`. > This helps in a couple of ways: > (1) Avoids issues with locks being held as in this issue > (2) It makes it possible to abstract the action, which is very useful in > tests. At the moment, we can't easily test for these conditions as they cause > the whole test harness to exit. Worse, these conditions are sometimes > triggered in the tests and it's unclear why. > (3) We can have more consistent logging around these actions and possibly > extended logging for tests > {quote} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (KAFKA-4039) Exit Strategy: using exceptions instead of inline invocation of exit/halt
[ https://issues.apache.org/jira/browse/KAFKA-4039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15423346#comment-15423346 ] Maysam Yabandeh commented on KAFKA-4039: Certainly. I will submit a patch soon. > Exit Strategy: using exceptions instead of inline invocation of exit/halt > - > > Key: KAFKA-4039 > URL: https://issues.apache.org/jira/browse/KAFKA-4039 > Project: Kafka > Issue Type: Bug > Components: core >Affects Versions: 0.10.0.0 >Reporter: Maysam Yabandeh > > The current practice is to directly invoke halt/exit right after the line > that intends to terminate the execution. In the case of System.exit this > could cause deadlocks if the thread invoking System.exit is holding a lock > that will be requested by the shutdown hook threads that will be started by > System.exit. An example is reported by [~aozeritsky] in KAFKA-3924. This > would also makes testing more difficult as it would require mocking static > methods of System and Runtime classes, which is not natively supported in > Java. > One alternative suggested > [here|https://issues.apache.org/jira/browse/KAFKA-3924?focusedCommentId=15420269=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15420269] > would be to throw some dedicated exceptions that will eventually invoke > exit/halt: > {quote} it would be great to move away from executing `System.exit` inline in > favour of throwing an exception (two examples, but maybe we can find better > names: FatalExitException and FatalHaltException) that is caught by some > central code that then does the `System.exit` or `Runtime.getRuntime.halt`. > This helps in a couple of ways: > (1) Avoids issues with locks being held as in this issue > (2) It makes it possible to abstract the action, which is very useful in > tests. At the moment, we can't easily test for these conditions as they cause > the whole test harness to exit. Worse, these conditions are sometimes > triggered in the tests and it's unclear why. > (3) We can have more consistent logging around these actions and possibly > extended logging for tests > {quote} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (KAFKA-4039) Exit Strategy: using exceptions instead of inline invocation of exit/halt
[ https://issues.apache.org/jira/browse/KAFKA-4039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15423311#comment-15423311 ] Maysam Yabandeh commented on KAFKA-4039: Revert is certainly an option but I am not sure if the deadlock is more serious than data loss: with the current status it shuts down cleanly but does not exit waiting for one last thread that is processing an outstanding request. For me this is a bit of operational burden but it is at least safe. Also the suggested solution of throwing an exception seems pretty straightforward and would address the other perhaps-yet-unreported issues with inline invocation of system.exit. If there is no other volunteer I would be happy to take up this jira and prepare the patch. > Exit Strategy: using exceptions instead of inline invocation of exit/halt > - > > Key: KAFKA-4039 > URL: https://issues.apache.org/jira/browse/KAFKA-4039 > Project: Kafka > Issue Type: Bug > Components: core >Affects Versions: 0.10.0.0 >Reporter: Maysam Yabandeh > > The current practice is to directly invoke halt/exit right after the line > that intends to terminate the execution. In the case of System.exit this > could cause deadlocks if the thread invoking System.exit is holding a lock > that will be requested by the shutdown hook threads that will be started by > System.exit. An example is reported by [~aozeritsky] in KAFKA-3924. This > would also makes testing more difficult as it would require mocking static > methods of System and Runtime classes, which is not natively supported in > Java. > One alternative suggested > [here|https://issues.apache.org/jira/browse/KAFKA-3924?focusedCommentId=15420269=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15420269] > would be to throw some dedicated exceptions that will eventually invoke > exit/halt: > {quote} it would be great to move away from executing `System.exit` inline in > favour of throwing an exception (two examples, but maybe we can find better > names: FatalExitException and FatalHaltException) that is caught by some > central code that then does the `System.exit` or `Runtime.getRuntime.halt`. > This helps in a couple of ways: > (1) Avoids issues with locks being held as in this issue > (2) It makes it possible to abstract the action, which is very useful in > tests. At the moment, we can't easily test for these conditions as they cause > the whole test harness to exit. Worse, these conditions are sometimes > triggered in the tests and it's unclear why. > (3) We can have more consistent logging around these actions and possibly > extended logging for tests > {quote} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (KAFKA-4039) Exit Strategy: using exceptions instead of inline invocation of exit/halt
[ https://issues.apache.org/jira/browse/KAFKA-4039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15423298#comment-15423298 ] Alexey Ozeritskiy commented on KAFKA-4039: -- Thanks [~maysamyabandeh]. I think we have to decide how to solve the problem or revert commit d1757c70a198014e85026c01a1a4ccab6a12da7d because it brings more serious problem. In fact, my "solution" from KAFKA-3924 does not solve the problem because shutdown hook waits for sheduler and vice versa. > Exit Strategy: using exceptions instead of inline invocation of exit/halt > - > > Key: KAFKA-4039 > URL: https://issues.apache.org/jira/browse/KAFKA-4039 > Project: Kafka > Issue Type: Bug > Components: core >Affects Versions: 0.10.0.0 >Reporter: Maysam Yabandeh > > The current practice is to directly invoke halt/exit right after the line > that intends to terminate the execution. In the case of System.exit this > could cause deadlocks if the thread invoking System.exit is holding a lock > that will be requested by the shutdown hook threads that will be started by > System.exit. An example is reported by [~aozeritsky] in KAFKA-3924. This > would also makes testing more difficult as it would require mocking static > methods of System and Runtime classes, which is not natively supported in > Java. > One alternative suggested > [here|https://issues.apache.org/jira/browse/KAFKA-3924?focusedCommentId=15420269=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15420269] > would be to throw some dedicated exceptions that will eventually invoke > exit/halt: > {quote} it would be great to move away from executing `System.exit` inline in > favour of throwing an exception (two examples, but maybe we can find better > names: FatalExitException and FatalHaltException) that is caught by some > central code that then does the `System.exit` or `Runtime.getRuntime.halt`. > This helps in a couple of ways: > (1) Avoids issues with locks being held as in this issue > (2) It makes it possible to abstract the action, which is very useful in > tests. At the moment, we can't easily test for these conditions as they cause > the whole test harness to exit. Worse, these conditions are sometimes > triggered in the tests and it's unclear why. > (3) We can have more consistent logging around these actions and possibly > extended logging for tests > {quote} -- This message was sent by Atlassian JIRA (v6.3.4#6332)