LeRoy Cressy on 6 Mar 2004 17:24:02 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Apache using deleated files


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jeff Abrahamson wrote:
On Tue, Feb 24, 2004 at 08:38:05AM -0500, LeRoy Cressy wrote:

 [62 lines, 356 words, 2463 characters]  Top characters: etonasl_

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tobias DiPasquale wrote:

On Tue, 2004-02-24 at 07:08, LeRoy Cressy wrote:


does anyone know why Apache is using deleted tmp files without closing them first?


If you open a file and then delete it, but do not close it, you then
have a file that will automatically be removed when you exit the process
(intentionally or unintentionally). This is an easy way to clean up a
domain socket: after both processes have opened the file, one of them
deletes it. When its time to close the domain socket, both processes
just exit normally and don't have to worry about which one deletes the
domain socket. Since the file is already marked as deleted and only now
has a use count of 0, it will actually be removed implicity by the
filesystem.

This is an on going thing with apache and apache-ssl. Now mysql has a bug report against it for the same thing. Since these are servers, stopping the process cleans up the deleated files as you said, but when you restart apache, there are new ones created which are marked as being deleted.


What I was asking, does anyone know why apache does not close the file prior to deleting it? This has been around for a long time and I wonder what the reasoning is.


I'm not sure I follow your question, LeRoy, as I would have answered
both your first and question just as Toby did.

If it closed the files, then they would be unlinked and it would not
have access to the contents.  If it didn't delete them, then it would
need to provide an alternate mechanism to clean up its scratch files
on deletion.

Do you mean, why does apache use scratch files?


if you run lsof +L1 on a system running Apache you will see something like:

apache    24611 www-data  mem    DEL    0,4          0     0 /SYSV00000000

apache 24611 www-data 3u REG 3,6 0 0 13 /tmp/session_mm_apache0.sem (deleted)

apache 24611 www-data 4u REG 3,6 0 0 15 /tmp/session_mm_apache0.sem (deleted)

Now I first saw this when running tiger which reported that apache was using deleted files. Since tiger uses lsof I tried running lsof as root and part of the result is above.

I was wondering if either lsof is reporting deleted files that are not really deleated or why isn't apache delinking without closing them. If lsof is reporting falsely, then I will write a bug report, on the other hand, if apache is not closing files properly, then there should be a bug report for apache.

Running a server application should not delink open files since the server is not exited like a regular application.

- -- Rev. LeRoy D. Cressy mailto:leroy@lrcressy.com /\_/\
http://lrcressy.com ( o.o )
Phone: 215-535-4037 > ^ <
FAX: 215-535-4285


gpg fingerprint:  62DE 6CAB CEE1 B1B3 359A  81D8 3FEF E6DA 8501 AFEA

For info on enigmail:    http://lrcressy.com/linux/mozilla.pdf
For info on gpg:         http://www.gnupg.org/

Jesus saith unto him, I am the way, the truth, and the life:
no man cometh unto the Father, but by me. (John 14:6)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Debian - http://enigmail.mozdev.org

iD8DBQFASgi3P+/m2oUBr+oRAntuAJwLQeQSWMsKkZfVqewfttHJmWZ7QwCffz1Y
fp4NfxuyHKvDWF/0ZfHNNx8=
=sd8N
-----END PGP SIGNATURE-----

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug