tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: PID file locked on Windows 2008 system
Date Tue, 04 Nov 2014 22:38:29 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Anil,

On 11/4/14 5:25 PM, Christopher Schultz wrote:
> Anil,
> 
> On 11/4/14 2:58 PM, Anil Ambati wrote:
>> We have a requirement to read the PID file created by the Tomcat 
>> server process on Windows, but we are not able to using 
>> RandomAccessFile or FileInputStream because the file seems to be 
>> locked by the Tomcat process.
> 
> 
>> Why does the Tomcat server keep the PID file locked, preventing 
>> other processes to even read the file? Is there a work around or 
>> solution for this problem?
> 
> You must be using commons-daemon's procrun, otherwise known as the 
> Windows service wrapper. That process creates (and possibly locks)
> the PID file for Tomcat.
> 
> You may find users here who know the answer to your question, but
> you might have better luck posting to the commons mailing list to
> ask there.
> 
> I suspect it's something silly like holding-open the PID file
> instead of writing to it and then closing it.

I took a quick look, and it looks like the PID file is being created
with a file option FILE_FLAG_DELETE_ON_CLOSE which causes the OS to
delete the file off the disk when all file handles are closed. So,
closing the file handle will result in the PID file being deleted.

This option was added because the PID file wasn't being removed if the
service crashed, which kept the service from restarting (oops).

https://issues.apache.org/jira/browse/DAEMON-183

It seems like an option to control what happens on startup when the
PID file already exists would be a good idea. You'll have to ask the
procrun folks about what the options are. It seems reasonable to be
able to read the PID file, since not being able to read it makes it
kind of useless other than as a lock-file (i.e. its contents are
irrelevant).

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJUWVVlAAoJEBzwKT+lPKRYrQsP+wVCM1ASSBh+LuNIPjRUkUxi
3uBfjLArQIplC0l98dIQZZlBJQAsh0Lc61Tvo2Q+Ka5zPtq+WA9GlDVTH3MZo82E
kcleNxwFcmx0fGWizStEhMsxGqtGAKWct68FwVTFKDb8Bl68ud20fqJ5bEyyL6lP
2kV8QTjRcqJs42NvpjmW14NBGzXWiGF5BKOh3dGTdp1h6kIZrcOY/oOfX8noaO/K
evMDRrCas/MARzUQ/gBGMoZN5KmqPFcAvotlJlhECg1bpMTX38etIAwnMsnFRuZ9
Y0Ci5ffQ5I3MDvyWUf5Sv8UBJHLGUjwXzKbWCagDfBtgOZxp389t8Ro1TWDtMF7l
KWO9wvjX0Y1oS13xrl4VNNr/6oQuvybSwKYtMrFycRB8/K573QHrgSixI+7lNWNk
jyNus6cpOINxhMxsuyyu5oF+1O7EV0yWhXT+EIWt7mpzXLsyjQc/XbpFwQ3anNUv
YrD+CB+I/FLA/O1RSEEd9+NzpO45laSyoz3KfIqVFMkqCLKyjdA652jR+ik978kX
fc5gsQVtoeGAuTbNTm9eSS9hv2wjJoMSl0A6gT9Y8q83448IlhaSYE1mXSYG6XIp
DxNe0Dci0M5biNju+OIWrtW23zG4Q1eW8MIvs5wltVl8873zLdPpc49+dg3H+xIs
Mj55IlSYkg4GMHtdohle
=fhDz
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message