Hi,

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:

ntoskrnl.exe!KeWaitForMultipleObjects+0xc0a
ntoskrnl.exe!KeAcquireSpinLockAtDpcLevel+0x732
ntoskrnl.exe!KeDelayExecutionThread+0x186
ntoskrnl.exe!NtWaitForSingleObject+0x16e
ntoskrnl.exe!KeSynchronizeExecution+0x3a23
ntdll.dll!NtDelayExecution+0xa
KERNELBASE.dll!SleepEx+0xb3
simpledaemon.exe+0x584b
simpledaemon.exe+0xec1c
simpledaemon.exe+0xf2d9
kernel32.dll!BaseThreadInitThunk+0xd
ntdll.dll!RtlUserThreadStart+0x21

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: https://issues.apache.org/jira/browse/DAEMON-276 . 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 effects:

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: https://github.com/etdube/simpledaemon . 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 simpledaemon.exe/simpledaemonw.exe.

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?

Thanks!
Etienne


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to