Looking here --
|
if not in_reactor_context(): |
|
# Take a copy, for thread-safety. |
|
message = message.copy() |
|
return reactor.callFromThread(self.publish_message, message, |
|
timestamp=timestamp) |
The little comment is right but the shallow .copy is not sufficient to protect that data.
The caller, often a data acquisition Process running in a thread (rather than reactor), is at risk of passing in the data structure and then modifying it, which can lead to quiet corruption (data from next frame appearing with wrong timestamps) or feed data processing errors (e.g. if data vectors with varying lengths are merged into data blocks, which will cause an exception just before publish to crossbar).
This issue led to patch of wiregrid encoder agent, here.
I think replacing copy with deepcopy is a sufficient solution here, since these structures are usually small simple dicts.
Looking here --
ocs/ocs/ocs_feed.py
Lines 204 to 208 in 4199ac1
The little comment is right but the shallow .copy is not sufficient to protect that data.
The caller, often a data acquisition Process running in a thread (rather than reactor), is at risk of passing in the data structure and then modifying it, which can lead to quiet corruption (data from next frame appearing with wrong timestamps) or feed data processing errors (e.g. if data vectors with varying lengths are merged into data blocks, which will cause an exception just before publish to crossbar).
This issue led to patch of wiregrid encoder agent, here.
I think replacing copy with deepcopy is a sufficient solution here, since these structures are usually small simple dicts.