You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sebb <se...@gmail.com> on 2010/11/29 12:12:41 UTC
Re: svn commit: r1040028 - in /commons/proper/daemon/trunk:
RELEASE-NOTES.txt src/native/windows/apps/prunsrv/prunsrv.c
On 29 November 2010 07:45, <mt...@apache.org> wrote:
> Author: mturk
> Date: Mon Nov 29 07:45:11 2010
> New Revision: 1040028
>
> URL: http://svn.apache.org/viewvc?rev=1040028&view=rev
> Log:
> Fix DAEMON-188 by making sure the pidfile is destroyed on process exit
>
> Modified:
> commons/proper/daemon/trunk/RELEASE-NOTES.txt
> commons/proper/daemon/trunk/src/native/windows/apps/prunsrv/prunsrv.c
>
> Modified: commons/proper/daemon/trunk/RELEASE-NOTES.txt
> URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/RELEASE-NOTES.txt?rev=1040028&r1=1040027&r2=1040028&view=diff
> ==============================================================================
> --- commons/proper/daemon/trunk/RELEASE-NOTES.txt (original)
> +++ commons/proper/daemon/trunk/RELEASE-NOTES.txt Mon Nov 29 07:45:11 2010
> @@ -70,7 +70,7 @@ NEW FEATURES:
>
> BUG FIXES:
>
> -1.0.5:
> +1.0.5: DAEMON-188
>
> 1.0.4: DAEMON-95, DAEMON-171, DAEMON-100, DAEMON-164, DAEMON-165, DAEMON-175,
> DAEMON-177, DAEMON-150, DAEMON-163, DAEMON-182, DAEMON-181
>
> Modified: commons/proper/daemon/trunk/src/native/windows/apps/prunsrv/prunsrv.c
> URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/windows/apps/prunsrv/prunsrv.c?rev=1040028&r1=1040027&r2=1040028&view=diff
> ==============================================================================
> --- commons/proper/daemon/trunk/src/native/windows/apps/prunsrv/prunsrv.c (original)
> +++ commons/proper/daemon/trunk/src/native/windows/apps/prunsrv/prunsrv.c Mon Nov 29 07:45:11 2010
> @@ -811,7 +811,7 @@ static int onExitHook(void)
> {
> apxLogWrite(APXLOG_MARK_DEBUG "On exit hook called ...");
> reportServiceStatus(SERVICE_STOPPED, NO_ERROR, 0);
> - return 0;
> + return 0;
> }
>
> /* Executed when the service receives stop event */
> @@ -1015,8 +1015,12 @@ static DWORD serviceStart()
> gPidfileName = apxLogFile(gPool, SO_LOGPATH, SO_PIDFILE, NULL, FALSE);
> if (GetFileAttributesW(gPidfileName) != INVALID_FILE_ATTRIBUTES) {
> /* Pid file exists */
> - apxLogWrite(APXLOG_MARK_ERROR "Pid file '%S' exists", gPidfileName);
> - return 1;
> + if (!DeleteFileW(gPidfileName)) {
> + /* Delete failed. Either no access or opened */
> + apxLogWrite(APXLOG_MARK_ERROR "Pid file '%S' exists",
> + gPidfileName);
Perhaps it would be worth calling GetLastError() and including the
value in the log message?
Just a thought.
> + return 1;
> + }
> }
> }
> GetSystemTimeAsFileTime(&fts);
> @@ -1123,7 +1127,8 @@ static DWORD serviceStart()
> FILE_SHARE_READ,
> NULL,
> CREATE_NEW,
> - FILE_ATTRIBUTE_NORMAL,
> + FILE_ATTRIBUTE_NORMAL |
> + FILE_FLAG_DELETE_ON_CLOSE,
> NULL);
>
> if (gPidfileHandle != INVALID_HANDLE_VALUE) {
> @@ -1415,8 +1420,6 @@ BOOL docmdDebugService(LPAPXCMDLINE lpCm
> serviceMain(0, NULL);
> apxLogWrite(APXLOG_MARK_INFO "Debug service finished.");
> SAFE_CLOSE_HANDLE(gPidfileHandle);
> - if (gPidfileName)
> - DeleteFileW(gPidfileName);
> return rv;
> }
>
> @@ -1432,8 +1435,6 @@ BOOL docmdRunService(LPAPXCMDLINE lpCmdl
> rv = (StartServiceCtrlDispatcherW(_service_table) != 0);
> apxLogWrite(APXLOG_MARK_INFO "Run service finished.");
> SAFE_CLOSE_HANDLE(gPidfileHandle);
> - if (gPidfileName)
> - DeleteFileW(gPidfileName);
> return rv;
> }
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: svn commit: r1040028 - in /commons/proper/daemon/trunk:
RELEASE-NOTES.txt src/native/windows/apps/prunsrv/prunsrv.c
Posted by sebb <se...@gmail.com>.
On 29 November 2010 11:44, Mladen Turk <mt...@apache.org> wrote:
> On 11/29/2010 12:12 PM, sebb wrote:
>>>
>>> + apxLogWrite(APXLOG_MARK_ERROR "Pid file '%S' exists",
>>> + gPidfileName);
>>
>> Perhaps it would be worth calling GetLastError() and including the
>> value in the log message?
>>
>
> Right. I made sure that whenever there is GetLastError and
> this is ERROR we print the OS error description on the next line.
>
Excellent - that will help a lot if an error occurs.
>
> Regards
> --
> ^TM
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: svn commit: r1040028 - in /commons/proper/daemon/trunk: RELEASE-NOTES.txt
src/native/windows/apps/prunsrv/prunsrv.c
Posted by Mladen Turk <mt...@apache.org>.
On 11/29/2010 12:12 PM, sebb wrote:
>> + apxLogWrite(APXLOG_MARK_ERROR "Pid file '%S' exists",
>> + gPidfileName);
>
> Perhaps it would be worth calling GetLastError() and including the
> value in the log message?
>
Right. I made sure that whenever there is GetLastError and
this is ERROR we print the OS error description on the next line.
Regards
--
^TM
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org