Skip to content
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

Infection infects /tmp #356

Closed
Majkl578 opened this issue May 17, 2018 · 5 comments
Closed

Infection infects /tmp #356

Majkl578 opened this issue May 17, 2018 · 5 comments
Labels
Milestone

Comments

@Majkl578
Copy link

Question Answer
Infection version 0.8.2
Test Framework version PHPUnit 7
PHP version 7.2
Platform Linux

Infection pollutes /tmp with thousands of files.

$ du -hs /tmp/infection
270M	/tmp/infection
$ ll /tmp/infection | wc -l
18706

This should be cleaned up after run. Otherwise it eats space and RAM (/tmp is typically tmpfs which is RAM-based).

@maks-rafalko
Copy link
Member

Probably, it should be configurable since we reuse created mutants to avoid extra IO operations

private function createMutatedCode(MutationInterface $mutation, string $mutatedFilePath): string
{
if (file_exists($mutatedFilePath)) {
return file_get_contents($mutatedFilePath);
}
$traverser = new NodeTraverser();

On the other side, I'm not sure many people will run infection many times in a row

@theofidry
Copy link
Member

theofidry commented May 17, 2018

It should definitely be cleaned up after a run I agree.

The issue (and it's the same as in XdebugHandler, cf. composer/xdebug-handler#50) is that it's not easy to cleanup when interrupting the command.

Once thing that could be done however is create the temporary files in a infection directory of the temporary directory and clean it up at the start of the run (to be careful that it won't affect/collide with the one used for XdebugHandler)

@sidz
Copy link
Member

sidz commented May 17, 2018

Once thing that could be done however is create the temporary files in a infection directory of the temporary directory and clean it up at the start of the run (to be careful that it won't affect/collide with the one used for XdebugHandler)

We can't guarantee that user didn't change tmpDir between infection execution. IMO we need to clean tmpDir after a run.

@theofidry
Copy link
Member

I don't think the user should change it neither rely that it won't change.

That said it might be an issue with concurrent runs

@BackEndTea BackEndTea added this to the 0.9.0 milestone May 21, 2018
@maks-rafalko
Copy link
Member

fixed #357

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants