File Deletion Problems

J

jaws

My problems is as follows. Hope you guys can provide some insight.

1. I have a class which opens a file and simply spits out the text.
Methods in place to open, print, close, and delete the file.

2. This class is instantiated as a thread, I have several acting on
different files.

3. The application is web based. The user can kill the app. from the
browser, effectively leaving my temp files undeleted because the app can
end before it invokes the file close and file delete methods. This rarely
happens as the file is opened, read, and closed within seconds. I have a
unix cron to do tempfile cleanup once a day. I may see one or two tempfiles
hanging around during a 24 hour period before being deleted by the cron
job.

4. I moved the application to a multi processor environment. I am now
seeing a pretty big increase in the temp files hanging around in the
directory.

5. I am thinking I might be better off invoking the file close and deletion
of temp file in the destructor. Previously the destructor was empty.

6. I am running this app with Redhat Linux as the OS. Apache 2.0 is the web
server. App runs as CGI.I find it hard to believe that users are killing
the app from theb rowser often enough to leave the temp files hanging
around. I have tried to simulate the app kiling and can not reproduce the
problem.


Of course the big difference is I am now in a 2-processor environment....


Any ideas?

John
 
V

Victor Bazarov

jaws said:
My problems is as follows. Hope you guys can provide some insight.
[...]

Of course the big difference is I am now in a 2-processor environment....


Any ideas?

Convert your description to read more like a C++ language problem, then
perhaps we'll be able to help. Multiprocessor environment, CGI, Apache
2.0, Web browsers, threading, Unix cron, are all off-topic here.

V
 
L

Larry Brasfield

jaws said:
My problems is as follows. Hope you guys can provide some insight.

1. I have a class which opens a file and simply spits out the text.
Methods in place to open, print, close, and delete the file.

2. This class is instantiated as a thread, I have several acting on
different files.

3. The application is web based. The user can kill the app. from the
browser, effectively leaving my temp files undeleted because the app can
end before it invokes the file close and file delete methods. This rarely
happens as the file is opened, read, and closed within seconds. I have a
unix cron to do tempfile cleanup once a day. I may see one or two tempfiles
hanging around during a 24 hour period before being deleted by the cron
job.

4. I moved the application to a multi processor environment. I am now
seeing a pretty big increase in the temp files hanging around in the
directory.

5. I am thinking I might be better off invoking the file close and deletion
of temp file in the destructor. Previously the destructor was empty.

6. I am running this app with Redhat Linux as the OS. Apache 2.0 is the web
server. App runs as CGI.I find it hard to believe that users are killing
the app from theb rowser often enough to leave the temp files hanging
around. I have tried to simulate the app kiling and can not reproduce the
problem.

Of course the big difference is I am now in a 2-processor environment....

Any ideas?


Victor is right about this being off-topic. But
before you take it somewhere else, you may
want to clarify what is consuming the file and
whether you error-check the close attempt.
(It may well fail if there is another process
with the file open for read. If there is not,
then I would question the decision to use a
temporary file.)

A good forum for general programming problems
such as your is comp.programming .

Good luck!
 
J

jaws

jaws wrote:

thanks for the input. I will post elsewhere. Sorry for the inconvenience.
Perhaps I can find a group that can tell me what happens to an object and
its destructor in a CGI environment. BTW I move everything to the
destructor (C++ related here) works fine until the process is killed by the
web browser.

Regards,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,189
Members
46,735
Latest member
HikmatRamazanov

Latest Threads

Top