DataGenerator icon indicating copy to clipboard operation
DataGenerator copied to clipboard

Output Thread exception handling in DefaultDistributor

Open bryantrobbins opened this issue 10 years ago • 4 comments

In our current implementation, any exceptions thrown by the outputThread in DefaultDistributor have no way of propagating to the parent thread. When the thread dies, the exception is lost.

We need some way to fail the main thread in this case, or somehow detect these errors.

bryantrobbins avatar Sep 25 '14 18:09 bryantrobbins

There is no way since the run method of the Thread class does not report to the caller. The only way is to correctly report it through the logger as an error.

Let me know if you have other ideas.

mibrahim avatar Sep 25 '14 20:09 mibrahim

Our thought was that we could add a catch to produceOutput's calls to the consumers. If an exception is caught, we could set a flag in the distributor and possibly also a message, then throw from the Distributor when the output thread is joined.

Is that missing something? I think the produceOutput function should be able to catch exceptions from its own code, right?

bryantrobbins avatar Sep 26 '14 02:09 bryantrobbins

High-level question: How do we want to communicate errors to the user in general?

bryantrobbins avatar Oct 16 '15 13:10 bryantrobbins

Let's solve this in the multithreaded distributor.

@mibrahim is taking a look.

Nil suggests a static logger in the producers might be sufficient (?)

bryantrobbins avatar Oct 30 '15 13:10 bryantrobbins