-
Notifications
You must be signed in to change notification settings - Fork 57
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
Can I reduce the memory consumed by cosmic-ray? #486
Comments
this usually happens when a mutation changes parameters to workaround would be to either execute it under a user with limited access to memory or run without swap |
I execute cosmic-ray 5.6.1 with Interestingly, cosmic-ray also seems not to install the required dependencies. I tried the following
I executed:
Due to those issues, I moved to mutmut. |
Sorry I didn't get to this sooner...buried under work right now.
Right, this is a known issue (though there's no open issue on it), and I'm not sure the best way to deal with it beyond having the user skip certain mutations. We could do things like look for mutations inside range calls or list constructors, but that wouldn't address transitive mutations that make their way into those calls.
CR is certainly trying to install the dependencies you asked for. Any idea why it's seeing this:
Fair enough. Can we close this then? |
I'd say that it's still a possible issue, so having some mechanism of handling it in cosmic-ray is probably a good idea. I'm not aware of anything portable, but there are solutions for Unix systems in general (that use ulimit) and Linux specific (that use cgroups) |
It's certainly still an issue, and I'm happy to keep it open. Things like ulimit and cgroups seems like extrinsic solutions to me (though I'm no expert), and maybe something that can already be used today without any change to CR. If so, maybe what's really needed is a discussion of these things in the documentation (e.g. a section on "strategies for avoiding resource overuse"). Intrinsic solutions seem much harder. I don't have any real insight into how we'd detect mutations that might cause memory explosions except in very simple cases. Any ideas? |
I wouldn't say that mutations like that should be avoided - but interpreting results of them is much more complex. In some cases it may indicate use of a wrong algorithm (like use or range() in py2 instead of xrange(), or list generator instead of iterator), and sometimes they can be false positives (like causing python to allocate 4GiB large byte string when the value processed will never be this large). So they are more like "things you may want to take a closer look at", rather than something we can feed into a formula for mutation score. |
This points to an interesting idea. I wonder if we could create post-processors that look for common pathologies in test output, e.g. looking for massive memory uses and suggesting that the user look at it. |
I wonder if I can get a concrete example of a mutation that can cause this? Maybe I'm missing some important mutant in mutmut and that's the only reason mutmut survives! That would be bad. |
I don't have an example from "the real world", but imagine something like mutating this:
to
This would use a billion times the memory. I don't know if CR has this specific behavior; I'm pretty sure we select number mutations that are generally close to the original value. But nothing in CR would stop someone from creating an operator that does exactly that. |
Something that could happen today is that mutation somehow prevents a loop from terminating, and this then results in unbounded memory consumption (i.e. because of the specifics of what's going on in that loop). |
yeah, something that turns
into
will exhaust memory of any system |
Ouch. Yea that's a great example. I would like to say I escape this by being smart but I believe I escape this because we've removed incorrect mutations of * to ** and removed too much! |
When I run cosmic-ray, I cannot use my computer. It consumes 15 GB of memory ... when it started filling the swap, I killed it.
Can I reduce the memory consumption of it?
The text was updated successfully, but these errors were encountered: