Race condition when saving data under multiple threads · Issue #581 · nedbat/coveragepy (original) (raw)
I do not have a minimum repro for this issue yet, but we're seeing errors in our CI after upgrading coverage from 4.3.4 to 4.4b1 and 4.4.
We have some tests running using rostest. Upon upgrading from coverage 4.3.4 on our CI server, we started seeing the following errors:
Traceback (most recent call last):
File "/tmp/tmpw8DgrF/src/app/test/integration/test_head_service.py", line 86, in <module>
main()
File "/tmp/tmpw8DgrF/src/app/test/integration/test_head_service.py", line 82, in main
rostest.rosrun(PKG, NAME, TestHeadService)
File "/opt/ros/indigo/lib/python2.7/dist-packages/rostest/__init__.py", line 148, in rosrun
_stop_coverage([package])
File "/opt/ros/indigo/lib/python2.7/dist-packages/rostest/__init__.py", line 227, in _stop_coverage
_cov.stop()
File "/usr/local/lib/python2.7/dist-packages/coverage/control.py", line 899, in analysis
f, s, _, m, mf = self.analysis2(morf)
File "/usr/local/lib/python2.7/dist-packages/coverage/control.py", line 920, in analysis2
analysis = self._analyze(morf)
File "/usr/local/lib/python2.7/dist-packages/coverage/control.py", line 935, in _analyze
self.get_data()
File "/usr/local/lib/python2.7/dist-packages/coverage/control.py", line 824, in get_data
if self.collector.save_data(self.data):
File "/usr/local/lib/python2.7/dist-packages/coverage/collector.py", line 382, in save_data
covdata.add_lines(abs_file_dict(self.data))
File "/usr/local/lib/python2.7/dist-packages/coverage/collector.py", line 377, in abs_file_dict
return dict((abs_file(k), v) for k, v in iitems(d))
File "/usr/local/lib/python2.7/dist-packages/coverage/collector.py", line 377, in <genexpr>
return dict((abs_file(k), v) for k, v in iitems(d))
It's possible this is a rostest issue too - I haven't dug down very deeply, but we're certain that this issue does not occur when using coverage 4.3.4 - only 4.4b1 and 4.4.
The source code for the caller is found here. It looks like stop is being called from line 227 and then blowing up internally.
Will post more info once I have it.