Skip Menu |

This queue is for tickets about the CGI-Session CPAN distribution.

Report information
The Basics
Id: 78139
Status: open
Priority: 0/
Queue: CGI-Session

People
Owner: Nobody in particular
Requestors: sjn+perlbug [...] pvv.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 4.48
Fixed in: (no value)



Subject: Successful test run doesn't clean the tmp dir
When running "make test" successfully, the operation leaves a bunch of files in /tmp (or whatever other directory specified by File::Spec->tmpdir): /tmp/cgisess_2001 /tmp/cgisess_21112ed3a306cf9074a9666a6da3dfaa /tmp/cgisess_e2323d81ec9ba10e3025a82e2d7da27f /tmp/cgisess_ea5baa3df715cb85b070bcb98bab0c7d /tmp/cgisess_testname This is usually no problem, but becomes one when several users are running tests on CGI::Session on the same system. There are at least three potential solutions to this problem: 1) Clean all test-related session files when the testing is done (i.e. keep it tidy around yourself) or 2) Don't use hard-coded filenames like "cgisess_testname" or "cgisess_2001", but add a random element (e.g. process id?) or 3) Don't use a shared temporary folder, but instead store testing-related session files somewhere inside the distribution directory itself. (e.g. t/tmp/cgisess_testname) On a side note, when new() fails to create a session because of existing files not being overwriteable, i doesn't throw an exception or warn about something going horribly wrong. Maybe that's worth fixing too? :)
Subject: Re: [rt.cpan.org #78139] Successful test run doesn't clean the tmp dir
Date: Mon, 02 Jul 2012 09:28:07 -0400
To: bug-CGI-Session [...] rt.cpan.org
From: Mark Stosberg <mark [...] summersault.com>
Show quoted text
> 1) Clean all test-related session files when the testing is done (i.e. > keep it tidy around yourself)
This is good to do, and can be combined with other approaches. However, it doesn't address the race-condition case of two people running tests at the same time, so it is not a complete solution. I think we should do this. Show quoted text
> 2) Don't use hard-coded filenames like "cgisess_testname" or > "cgisess_2001", but add a random element (e.g. process id?)
Using the process ID sounds find. We could also create our own directory below the main tmpdir to put everything in, making clean-up easier, as well as making it clearer that there were multiple test runs. Show quoted text
> 3) Don't use a shared temporary folder, but instead store > testing-related session files somewhere inside the distribution > directory itself. (e.g. t/tmp/cgisess_testname)
I think we have a better chance of being able to write an OS-provided tmpdir. Would you be willing to take on these updates? I support them, but am unlikely to get to them soon. Show quoted text
> On a side note, when new() fails to create a session because of existing > files not being overwriteable, i doesn't throw an exception or warn > about something going horribly wrong. Maybe that's worth fixing too? :)
Absolutely, Sounds like an exception with a clear diagnostic would be appropriate. Could you open a separate ticket for that as well? A patch for it would be welcome as well. Mark