Github user revans2 commented on the issue:
https://github.com/apache/storm/pull/2241
@roshannaik removing thread safety from the emits is a bug and breaks
backwards compatibility.
In the past the shuffle grouping was the only one that was not thread safe.
Because of this we documented that users should put their own synchronization
around calls to emit, but this proved to be incorrect (or more accurately
insufficient). The reason is that we can have multiple instances of a bolt or
spout sharing a single executor thread. When this happens synchronizing within
a single bolt
```
synchrronized(this) {
collector.emit(...);
}
```
is not enough to ensure safety, because `this` is different for each of the
bolts. It is non-intuitive, but the only way to really ensure it is safe would
be to synchronize on a static singleton lock. Which is also bad because it
synchronizes all of the instances of that bolt in the worker, not just the ones
that would be under contention. By the way the ShellBolt emits on a separate
thread, just one thread so it was written assuming that it would be safe
without synchronization but under this proposal it would require us to change
that.
I made the shuffle grouping thread safe to fix some of these issues, and to
make it intuitive for our users too.
---
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.
---