We are using forkStatsd to start collecting stats, and later on stopping the stats collection by calling killThread on the statsdThreadId, as indicated in the documentation. However, the implementation of forkStatsd rethrows all exceptions coming from the forked thread to the thread that called forkStatsd in the first place, including any ThreadKilled exceptions. This was confusing to say the least!
Is this the expected behaviour, or am I missing a better way of doing this? It feels a bit clumsy to control the Statsd by throwing an exception that you then have to remember to catch, and you have no guarantee that the exception you catch is the one you threw in the first place. This also feels inconsistent with a normal forkIO which swallows ThreadKilled (and Blocked*) exceptions so you don't see them in the main thread.
We are using
forkStatsd
to start collecting stats, and later on stopping the stats collection by callingkillThread
on thestatsdThreadId
, as indicated in the documentation. However, the implementation offorkStatsd
rethrows all exceptions coming from the forked thread to the thread that calledforkStatsd
in the first place, including anyThreadKilled
exceptions. This was confusing to say the least!Is this the expected behaviour, or am I missing a better way of doing this? It feels a bit clumsy to control the
Statsd
by throwing an exception that you then have to remember to catch, and you have no guarantee that the exception you catch is the one you threw in the first place. This also feels inconsistent with a normalforkIO
which swallowsThreadKilled
(andBlocked*
) exceptions so you don't see them in the main thread.