core.async

Exceptions cannot be captured by default uncaught exception handler

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code and Test
  • Approval:
    Ok

Description

Both core.async thread pools have a try/catch which catches and prints exceptions thrown in callbacks. This prevents application code from using the built-in mechanisms of the JVM to handle exceptions on arbitrary threads, namely Thread.setDefaultUncaughtExceptionHandler

In addition, the pool for 'thread' and 'thread-call' does not close the channel when an exception is thrown, which may lead to deadlocks.

Current Patch: 0002-ASYNC-76-propagate-exceptions-with-tests.patch

Approach: For the callback/go thread pool, do not catch exceptions at all. For the 'thread' pool, remove the 'catch' and close the channel in a 'finally'.

Background: Printing exceptions was added shortly after changing the arity to the 'put!' callback, to aid in debugging, see commit 9fcae995. Prior to this, the 'thread-call' function has always dropped exceptions silently; see commit 0b8e6171.

Duplicate of ASYNC-71 and similar to ASYNC-61, both of which request that the thread pools dispatch errors to a handler function Var which application code can alter.

An earlier issue (no JIRA ticket) occurred when tasks were submitted to the ThreadPoolExecutor with .submit, which returns a Future, instead of .execute.

Activity

Stuart Sierra made changes -
Field Original Value New Value
Description [Commit 65b2d6c8|https://github.com/clojure/core.async/blob/65b2d6c81350ba8b4bb3a8b82ad45ba984c0037c/src/main/clojure/clojure/core/async/impl/exec/threadpool.clj#L30-L33] added a try/catch which catches and prints exceptions thrown in callbacks. This is useful for development and testing but prevents application code from using the built-in mechanisms of the JVM to handle exceptions, namely [Thread.setDefaultUncaughtExceptionHandler|http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#setDefaultUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler)] [Commit 65b2d6c8|https://github.com/clojure/core.async/blob/65b2d6c81350ba8b4bb3a8b82ad45ba984c0037c/src/main/clojure/clojure/core/async/impl/exec/threadpool.clj#L30-L33] added a try/catch which catches and prints exceptions thrown in callbacks. This is useful for development and testing but prevents application code from using the built-in mechanisms of the JVM to handle exceptions, namely [Thread.setDefaultUncaughtExceptionHandler|http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#setDefaultUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler)]

Similar: ASYNC-71, ASYNC-61.

An earlier issue occurred when tasks were submitted to the ThreadPoolExecutor with {{.submit}}, which returns a Future, instead of {{.execute}}.
Stuart Sierra made changes -
Patch Code [ 10001 ]
Description [Commit 65b2d6c8|https://github.com/clojure/core.async/blob/65b2d6c81350ba8b4bb3a8b82ad45ba984c0037c/src/main/clojure/clojure/core/async/impl/exec/threadpool.clj#L30-L33] added a try/catch which catches and prints exceptions thrown in callbacks. This is useful for development and testing but prevents application code from using the built-in mechanisms of the JVM to handle exceptions, namely [Thread.setDefaultUncaughtExceptionHandler|http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#setDefaultUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler)]

Similar: ASYNC-71, ASYNC-61.

An earlier issue occurred when tasks were submitted to the ThreadPoolExecutor with {{.submit}}, which returns a Future, instead of {{.execute}}.
[Commit 65b2d6c8|https://github.com/clojure/core.async/blob/65b2d6c81350ba8b4bb3a8b82ad45ba984c0037c/src/main/clojure/clojure/core/async/impl/exec/threadpool.clj#L30-L33] added a try/catch which catches and prints exceptions thrown in callbacks. This is useful for development and testing but prevents application code from using the built-in mechanisms of the JVM to handle exceptions, namely [Thread.setDefaultUncaughtExceptionHandler|http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#setDefaultUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler)]

Patch: 0001-ASYNC-76-do-not-catch-exceptions-on-thread-pool.patch

Similar: ASYNC-71, ASYNC-61.

An earlier issue occurred when tasks were submitted to the ThreadPoolExecutor with {{.submit}}, which returns a Future, instead of {{.execute}}.
Attachment 0001-ASYNC-76-do-not-catch-exceptions-on-thread-pool.patch [ 13117 ]
Stuart Sierra made changes -
Description [Commit 65b2d6c8|https://github.com/clojure/core.async/blob/65b2d6c81350ba8b4bb3a8b82ad45ba984c0037c/src/main/clojure/clojure/core/async/impl/exec/threadpool.clj#L30-L33] added a try/catch which catches and prints exceptions thrown in callbacks. This is useful for development and testing but prevents application code from using the built-in mechanisms of the JVM to handle exceptions, namely [Thread.setDefaultUncaughtExceptionHandler|http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#setDefaultUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler)]

Patch: 0001-ASYNC-76-do-not-catch-exceptions-on-thread-pool.patch

Similar: ASYNC-71, ASYNC-61.

An earlier issue occurred when tasks were submitted to the ThreadPoolExecutor with {{.submit}}, which returns a Future, instead of {{.execute}}.
[Commit 65b2d6c8|https://github.com/clojure/core.async/blob/65b2d6c81350ba8b4bb3a8b82ad45ba984c0037c/src/main/clojure/clojure/core/async/impl/exec/threadpool.clj#L30-L33] added a try/catch which catches and prints exceptions thrown in callbacks. This is useful for development and testing but prevents application code from using the built-in mechanisms of the JVM to handle exceptions, namely [Thread.setDefaultUncaughtExceptionHandler|http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#setDefaultUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler)]

Patch: 0001-ASYNC-76-do-not-catch-exceptions-on-thread-pool.patch

Duplicate of ASYNC-71. Similar to ASYNC-61.

An earlier issue occurred when tasks were submitted to the ThreadPoolExecutor with {{.submit}}, which returns a Future, instead of {{.execute}}.
Stuart Sierra made changes -
Patch Code [ 10001 ] Code and Test [ 10002 ]
Description [Commit 65b2d6c8|https://github.com/clojure/core.async/blob/65b2d6c81350ba8b4bb3a8b82ad45ba984c0037c/src/main/clojure/clojure/core/async/impl/exec/threadpool.clj#L30-L33] added a try/catch which catches and prints exceptions thrown in callbacks. This is useful for development and testing but prevents application code from using the built-in mechanisms of the JVM to handle exceptions, namely [Thread.setDefaultUncaughtExceptionHandler|http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#setDefaultUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler)]

Patch: 0001-ASYNC-76-do-not-catch-exceptions-on-thread-pool.patch

Duplicate of ASYNC-71. Similar to ASYNC-61.

An earlier issue occurred when tasks were submitted to the ThreadPoolExecutor with {{.submit}}, which returns a Future, instead of {{.execute}}.
Both core.async thread pools have a try/catch which catches and prints exceptions thrown in callbacks. This prevents application code from using the built-in mechanisms of the JVM to handle exceptions, namely [Thread.setDefaultUncaughtExceptionHandler|http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#setDefaultUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler)]

In addition, the pool for 'thread' and 'thread-call' does not close the channel when an exception is thrown, which may lead to unexplained deadlocks.

*Current Patch:* 0002-ASYNC-76-propagate-exceptions-with-tests.patch

*Approach:* For the callback/go thread pool, do not catch exceptions at all. For the 'thread' pool, remove the 'catch' and close the channel in a 'finally'.

*Background:* The code which catches and prints exceptions was added shortly after changing the arity to the 'put!' callback, to aid in debugging.

Duplicate of ASYNC-71. Similar to ASYNC-61. An earlier issue occurred when tasks were submitted to the ThreadPoolExecutor with {{.submit}}, which returns a Future, instead of {{.execute}}.
Attachment 0002-ASYNC-76-propagate-exceptions-with-tests.patch [ 13118 ]
Stuart Sierra made changes -
Description Both core.async thread pools have a try/catch which catches and prints exceptions thrown in callbacks. This prevents application code from using the built-in mechanisms of the JVM to handle exceptions, namely [Thread.setDefaultUncaughtExceptionHandler|http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#setDefaultUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler)]

In addition, the pool for 'thread' and 'thread-call' does not close the channel when an exception is thrown, which may lead to unexplained deadlocks.

*Current Patch:* 0002-ASYNC-76-propagate-exceptions-with-tests.patch

*Approach:* For the callback/go thread pool, do not catch exceptions at all. For the 'thread' pool, remove the 'catch' and close the channel in a 'finally'.

*Background:* The code which catches and prints exceptions was added shortly after changing the arity to the 'put!' callback, to aid in debugging.

Duplicate of ASYNC-71. Similar to ASYNC-61. An earlier issue occurred when tasks were submitted to the ThreadPoolExecutor with {{.submit}}, which returns a Future, instead of {{.execute}}.
Both core.async thread pools have a try/catch which catches and prints exceptions thrown in callbacks. This prevents application code from using the built-in mechanisms of the JVM to handle exceptions on arbitrary threads, namely [Thread.setDefaultUncaughtExceptionHandler|http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#setDefaultUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler)]

In addition, the pool for 'thread' and 'thread-call' does not close the channel when an exception is thrown, which may lead to deadlocks.

*Current Patch:* 0002-ASYNC-76-propagate-exceptions-with-tests.patch

*Approach:* For the callback/go thread pool, do not catch exceptions at all. For the 'thread' pool, remove the 'catch' and close the channel in a 'finally'.

*Background:* Printing exceptions was added shortly after changing the arity to the 'put!' callback, to aid in debugging, see [commit 9fcae995|https://github.com/clojure/core.async/commit/9fcae99576c0735a804bbd4cbec81307e2d34d90]. Prior to this, the 'thread-call' function has always dropped exceptions silently; see [commit 0b8e6171|https://github.com/clojure/core.async/commit/0b8e61711939bcdd9db29adf92ded1abb6ff7aa8].

Duplicate of ASYNC-71. Similar to ASYNC-61. An earlier issue occurred when tasks were submitted to the ThreadPoolExecutor with {{.submit}}, which returns a Future, instead of {{.execute}}.
Stuart Sierra made changes -
Description Both core.async thread pools have a try/catch which catches and prints exceptions thrown in callbacks. This prevents application code from using the built-in mechanisms of the JVM to handle exceptions on arbitrary threads, namely [Thread.setDefaultUncaughtExceptionHandler|http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#setDefaultUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler)]

In addition, the pool for 'thread' and 'thread-call' does not close the channel when an exception is thrown, which may lead to deadlocks.

*Current Patch:* 0002-ASYNC-76-propagate-exceptions-with-tests.patch

*Approach:* For the callback/go thread pool, do not catch exceptions at all. For the 'thread' pool, remove the 'catch' and close the channel in a 'finally'.

*Background:* Printing exceptions was added shortly after changing the arity to the 'put!' callback, to aid in debugging, see [commit 9fcae995|https://github.com/clojure/core.async/commit/9fcae99576c0735a804bbd4cbec81307e2d34d90]. Prior to this, the 'thread-call' function has always dropped exceptions silently; see [commit 0b8e6171|https://github.com/clojure/core.async/commit/0b8e61711939bcdd9db29adf92ded1abb6ff7aa8].

Duplicate of ASYNC-71. Similar to ASYNC-61. An earlier issue occurred when tasks were submitted to the ThreadPoolExecutor with {{.submit}}, which returns a Future, instead of {{.execute}}.
Both core.async thread pools have a try/catch which catches and prints exceptions thrown in callbacks. This prevents application code from using the built-in mechanisms of the JVM to handle exceptions on arbitrary threads, namely [Thread.setDefaultUncaughtExceptionHandler|http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#setDefaultUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler)]

In addition, the pool for 'thread' and 'thread-call' does not close the channel when an exception is thrown, which may lead to deadlocks.

*Current Patch:* 0002-ASYNC-76-propagate-exceptions-with-tests.patch

*Approach:* For the callback/go thread pool, do not catch exceptions at all. For the 'thread' pool, remove the 'catch' and close the channel in a 'finally'.

*Background:* Printing exceptions was added shortly after changing the arity to the 'put!' callback, to aid in debugging, see [commit 9fcae995|https://github.com/clojure/core.async/commit/9fcae99576c0735a804bbd4cbec81307e2d34d90]. Prior to this, the 'thread-call' function has always dropped exceptions silently; see [commit 0b8e6171|https://github.com/clojure/core.async/commit/0b8e61711939bcdd9db29adf92ded1abb6ff7aa8].

Duplicate of ASYNC-71 and similar to ASYNC-61, both of which request that the thread pools dispatch errors to a handler function Var which application code can alter.

An earlier issue (no JIRA ticket) occurred when tasks were submitted to the ThreadPoolExecutor with {{.submit}}, which returns a Future, instead of {{.execute}}.
Alex Miller made changes -
Resolution Completed [ 1 ]
Approval Ok [ 10007 ]
Status Open [ 1 ] Closed [ 6 ]

People

Vote (6)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: