Hi Devs, It looks to me like the method getMyManagedPartitions is not thread-safe and is called from both KafkaSpout::nextTuple() and the anonymous internal class method IMetric::getValueAndReset(). As far as I can tell these are called from separate threads.
One outcome is that the method ZkCoordinator::refresh() can get called twice when the 60 second refreshFreqSecs interval is reached, because the attribute ZkCoordinator::_lastRefreshTime is not locked and is accessed in multiple places. The internals of refresh() are not at all thread safe either and manipulate the partition manager map _managers without locking. I'm pretty new to the code base; I wasn't able to determine if there was locking at a higher level, but I doubt it, because the timer-based metrics thread has access only to the internal object implementing the IMetric interface, not the KafkaSpout itself. Does this seem like a problem? -- *Pete Prokopowicz*Sr. Engineer - Automated Merchandising 600 W. Chicago Ave, Chicago, IL 60654 Mobile: 708-654-8137 Groupon <http://www.google.com/url?q=http%3A%2F%2Fwww.groupon.com%2F&sa=D&sntz=1&usg=AFrqEzcC80FkwsjyolWTKAH1sZ9yU2t0xg> II Grouponworks <http://www.google.com/url?q=http%3A%2F%2Fwww.grouponworks.com%2F&sa=D&sntz=1&usg=AFrqEzdLBm3Dql75wz1BTY0mA30ov3RnWg>
