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
Use of ractors makes coverage non-deterministic #1058
Comments
Alas, Ractors cause some problems with non-deterministic coverage results, that do not occur with Threads. It looks suspiciously like the Ractors are flushing coverage state to me. I wrote a somewhat superficial bug report at simplecov-ruby/simplecov#1058 about this. In the past, I have managed this problem with Threads, and they've been fine, even if they widen the potential for a theoretical problem of a thread not getting scheduled because of a bug in other code in releasing the GVL.
Alas, Ractors cause some problems with non-deterministic coverage results, that do not occur with Threads. It looks suspiciously like the Ractors are flushing coverage state to me. I wrote a somewhat superficial bug report at simplecov-ruby/simplecov#1058 about this. In the past, I have managed this problem with Threads, and they've been fine, even if they widen the potential for a theoretical problem of a thread not getting scheduled because of a bug in other code in releasing the GVL.
@fdr I don't think this has been brought up before, and granted that ractors aren't yet very common in use in ruby as far as I know I think it's possible it wasn't yet tried out. It would be nice to know whether this is related to simplecov or the ruby stdlib coverage module itself in the first place, because in the latter case this issue should be reported in the ruby issue tracker first. If you try to make an isolated example, could you please first try to do it with the coverage module first? |
Alas, Ractors cause some problems with non-deterministic coverage results, that do not occur with Threads. It looks suspiciously like the Ractors are flushing coverage state to me. I wrote a somewhat superficial bug report at simplecov-ruby/simplecov#1058 about this. In the past, I have managed this problem with Threads, and they've been fine, even if they widen the potential for a theoretical problem of a thread not getting scheduled because of a bug in other code in releasing the GVL.
Interesting, I didn't consider that. I'll research the matter. Maybe I'll close this until I have the time, it may still be useful to someone running a search. |
I just spent quite a bit of time finding this out, so maybe this issue should stay open :) It seems to be a problem with Ruby's own Coverage module, so I've opened an issue in the Ruby bug tracker. |
I didn't see any previous mention of ractors in the issue tracker, so I suspect I may be the first reporter to have tried to use them. In my case, I had a short-lived ractor that would exit at some indeterminate time in the course of my test suite.
What I've found is that it makes the coverage numbers fluctuate chaotically. I suspect something like an inherited
at_exit
hook may be to blame.If a mechanical theory for this does not jump out at you, I will try to write a minimizing test demonstrator. But I figured you may expect things to misbehave this way, and nobody has asked about it on the issue tracker yet.
The text was updated successfully, but these errors were encountered: