commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Etienne Dube <>
Subject [daemon] Trouble with procrun commons-daemon log file
Date Sat, 09 Mar 2013 05:58:35 GMT

I am struggling to get procrun to work reliably with a simple dummy java 
daemon. This daemon starts a thread that is writing a string to a file 
(in the system temp directory) every second.

Starting the service works fine initially, and I can see the daemon 
class doing its work. However, about one time out of three when stopping 
the service, the commons-daemon.YYYY-MM-DD.log file somehow stays 
"locked" -- trying to copy it in Windows fails with a dialog that says 
"Error 0x80070021: The process cannot access the file because another 
process has locked a portion of the file" and viewing it in the 
Notepad++ text editor just gives a blank page (like the file was empty) 
-- however Windows' notepad opens it just fine. Also note that the 
prunsrv process did exit at this point, but there still seems to be 
something locking the logfile; I'm not sure what is causing it, because 
trying to find the file handle using Sysinternals' Process Explorer 
"Find handle or DLL" feature gives no result.

When the logfile is "locked" in this state, trying to re-start the 
service fails with error 1053 ("The service did not respond to the start 
or control request in a timely fashion."). I am seeing the prunsvr.exe 
process appearing in Process Explorer, however control never reaches the 
startup method in the Java class. There is a single thread in the 
process, and it seems stuck at the following call:


After about 2 minutes the process dies and I get error 1053.

Deleting the commons-daemon logfile allows me to restart the service 
without errors. Then if I repeat the same stop and start action a few 
times (2 or 3 times usually), the same condition occurs again.

I have seen the following ticket: . Some of the symptoms 
are similar, but I'm not having the issue where the log file grows to 
several Gb of null characters.

I am running the service in Windows 7 SP1 x64. I have tried the 
following combinations of procrun binaries and JREs, all with the same 

1.0.13 with amd64 procrun (1.7.0u17 and 1.6.0u33 64-bit JREs), and with 
x86 procrun (1.6.0u30 32-bit JRE)
1.0.11 with amd64 procrun (1.7.0u17 64-bit JRE)
1.0.10 with amd64 procrun (1.7.0u17 64-bit JRE), and with x64 procrun 
(1.6.0u30 32-bit JRE)

The code of my dummy daemon is available in github: . Build with "mvn package", the 
result will be in target/appassembler. procrun 1.0.13 binaries are 
included, I've renamed prunsrv.exe/prunsrvw.exe to 

I have used Tomcat installed as a Windows service many times before, and 
never had this kind of problem.
Am I doing something wrong with in the Java daemon class? Or could it be 
a bug with procrun?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message