Github user roshannaik commented on the issue:
https://github.com/apache/storm/pull/2241
**Thread Safety and Bolt/Spout Emits:** @HeartSaVioR & @satishd brought up
this topic that is worth discussing in the interest of communicating clearly to
users.
The basic issue is ... there is a possibility that some bolts/spouts might
try to spin up threads internally and perform concurrent emits from those
threads. For such cases, we need to be clear if we guarantee if the emit path
thread safe or not.
**My thoughts:** We should not guarantee that OutputCollector path is
thread safe. If users chose to spin up threads in their spouts/bolts, they need
to handle synchronization as well. The advantage of doing so is that we get a
much faster path for majority of the spouts and bolts which donât do this
kind of stuff.
On the other hand, if we support unsynchronized concurrent emits, then much
of that emit path needs to be slowed down with internal synchronization locks
(ensuring thread safety all the way through executor.transferLocal,
executor.transferRemote, batching logic, all groupings etc).
As far as I can tell, neither the existing code base nor STORM-2306 code
base support such unsynchronized concurrent emits. But its good to be explicit
about that to users.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---