-
-
Notifications
You must be signed in to change notification settings - Fork 440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trace function changed warning when using threads #164
Comments
I'm sorry, I can't reproduce this problem. Is there anything else in your environment that might be interfering with the trace function? |
Original comment by Ronald Oussoren (Bitbucket: ronaldoussoren, GitHub: ronaldoussoren) Not that I know of, sys.path and sys.modules look sane when I print them at the point that the warning is generated (no code beyond the std, coverage.py and the test script is loaded)). I'll try to reproduce the issue on another machine and with a clean install of python in a different sys.prefix. In the mean time I have another datapoint, although I don't know if it is relevant. I've patched the start and stop methods of the Tracer object to print when they are called including the thread id. The output is then:
Bother tracer objects are stopped on the main some thread, which explains the last warning (and explains why the actual data collected seems to be correct regardless of the warning). |
Original comment by Ronald Oussoren (Bitbucket: ronaldoussoren, GitHub: ronaldoussoren) The trace above contains a second warning about the trace function, which is likely caused by my tweaks. This output is with a clean install of coverage.py with only changes to the start/stop methods:
Both tracers are still stopped on the main thread, but the other warning is now gone. |
Original comment by Ronald Oussoren (Bitbucket: ronaldoussoren, GitHub: ronaldoussoren) This seems to be a real bug:
If I'm correct this is a very minor bug though, it is just a confusing message and does not affect the collection of coverage data. |
An attempt on a Mac didn't show the problem either:
|
Original comment by Ronald Oussoren (Bitbucket: ronaldoussoren, GitHub: ronaldoussoren) I don't get the error in a VM running 10.6, but do get it when running 10.7 even with a clean reinstall of python 2.7.2. Both machines run exactly the same version of python and coverage.py. The problem does not occur with /usr/bin/python, which is 2.7.1 + patches. This is likely either a platform bug or an issue in python itself, I'll look into this and will report back when I have more information. |
Original comment by Ben Sizer (Bitbucket: kylotan, GitHub: kylotan) I see this on Windows 7 (64bit OS, but 32 bit Python 2.7.2). I don't think I ever saw it on Windows XP, which I used earlier in the year, but don't hold me to that. I don't think I saw it before 3.5.1 either, but again I can't be positive about that. It doesn't seem to affect any of the output's accuracy. |
Original comment by Zan Dobersek (Bitbucket: zdobersek, GitHub: zdobersek) I can still confirm this on ToT coveragepy when using PyTracer, i.e. when running Python v2.7.3, Ubuntu Linux. Looking at the code, it seems all the tracers are being stopped on the main thread while only the first tracer was created there. Stopping of all other tracers produces the warning. |
I think in all of this I somehow missed the fact that you must run the PyTracer, not the CTracer. This is easily reproduced using the --timid flag. |
Original comment by Ronald Oussoren (Bitbucket: ronaldoussoren, GitHub: ronaldoussoren) That explains why I haven't seen the problem for some time. I can confirm that the problem only occurs when I used the --timid option or remove the C tracer extension. |
Fixed in 8649f08abc40 (bb). The check for the trace function was being invoked on a different thread, and the trace function is per-thread, so the check was often incorrect. Now we only make the check if we are stopped on the same thread that started us. |
Originally reported by Ronald Oussoren (Bitbucket: ronaldoussoren, GitHub: ronaldoussoren)
When I run coverage.py on the following script I get a message about measurements being wrong:
The script:
The script does have full coverage in the report though.
This is using python 2.7.2 on MacOSX 10.7.2 and coverage.py 3.5.1. Python was installed using the binary installer on the python.org website.
The text was updated successfully, but these errors were encountered: