You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Gary Gregory <ga...@gmail.com> on 2021/02/04 13:52:37 UTC

Re: [commons-daemon] branch master updated: Apply --StopTimeout=nn to the command or class that does the stop. Otherwise it might wait for ever and the processes have to be kill by hands.

May you please document this change in changes.xml?

Gary

On Thu, Feb 4, 2021, 08:14 <jf...@apache.org> wrote:

> This is an automated email from the ASF dual-hosted git repository.
>
> jfclere pushed a commit to branch master
> in repository https://gitbox.apache.org/repos/asf/commons-daemon.git
>
>
> The following commit(s) were added to refs/heads/master by this push:
>      new 5bca7af  Apply --StopTimeout=nn to the command or class that does
> the stop. Otherwise it might wait for ever and the processes have to be
> kill by hands.
> 5bca7af is described below
>
> commit 5bca7af78162fbdd2d2f4b6b95470b29d15039a8
> Author: Jean-Frederic Clere <jf...@gmail.com>
> AuthorDate: Thu Feb 4 13:29:08 2021 +0100
>
>     Apply --StopTimeout=nn to the command or class that does the stop.
>     Otherwise it might wait for ever and the processes have to be kill by
>     hands.
> ---
>  src/native/windows/apps/prunsrv/prunsrv.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/src/native/windows/apps/prunsrv/prunsrv.c
> b/src/native/windows/apps/prunsrv/prunsrv.c
> index c49295f..6b283b2 100644
> --- a/src/native/windows/apps/prunsrv/prunsrv.c
> +++ b/src/native/windows/apps/prunsrv/prunsrv.c
> @@ -1135,6 +1135,8 @@ static DWORD WINAPI serviceStop(LPVOID lpParameter)
>          apxLogWrite(APXLOG_MARK_INFO "Worker is not defined.");
>          return TRUE;    /* Nothing to do */
>      }
> +    if (timeout > 0x7FFFFFFF)
> +        timeout = INFINITE;     /* If the timeout was '-1' wait forewer */
>      if (_jni_shutdown) {
>          if (!IS_VALID_STRING(SO_STARTPATH) &&
> IS_VALID_STRING(SO_STOPPATH)) {
>              /* If the Working path is specified change the current
> directory
> @@ -1178,7 +1180,10 @@ static DWORD WINAPI serviceStop(LPVOID lpParameter)
>              }
>              else {
>                  apxLogWrite(APXLOG_MARK_DEBUG "Waiting for Java JNI stop
> worker to finish for %s:%s...", _jni_sclass, _jni_smethod);
> -                apxJavaWait(hWorker, INFINITE, FALSE);
> +                if (!timeout)
> +                    apxJavaWait(hWorker, INFINITE, FALSE);
> +                else
> +                    apxJavaWait(hWorker, timeout, FALSE);
>                  apxLogWrite(APXLOG_MARK_DEBUG "Java JNI stop worker
> finished.");
>              }
>          }
> @@ -1251,7 +1256,10 @@ static DWORD WINAPI serviceStop(LPVOID lpParameter)
>              goto cleanup;
>          } else {
>              apxLogWrite(APXLOG_MARK_DEBUG "Waiting for stop worker to
> finish...");
> -            apxHandleWait(hWorker, INFINITE, FALSE);
> +            if (!timeout)
> +                apxHandleWait(hWorker, INFINITE, FALSE);
> +            else
> +                apxHandleWait(hWorker, timeout, FALSE);
>              apxLogWrite(APXLOG_MARK_DEBUG "Stop worker finished.");
>          }
>          wait_to_die = TRUE;
> @@ -1272,8 +1280,6 @@ cleanup:
>          CloseHandle(gSignalThread);
>          gSignalEvent = NULL;
>      }
> -    if (timeout > 0x7FFFFFFF)
> -        timeout = INFINITE;     /* If the timeout was '-1' wait forewer */
>      if (wait_to_die && !timeout)
>          timeout = 300 * 1000;   /* Use the 5 minute default shutdown */
>
>
>

Re: [commons-daemon] branch master updated: Apply --StopTimeout=nn to the command or class that does the stop. Otherwise it might wait for ever and the processes have to be kill by hands.

Posted by jean-frederic clere <jf...@gmail.com>.
On 04/02/2021 14:52, Gary Gregory wrote:
> May you please document this change in changes.xml?

I have another improvement to finish 
https://issues.apache.org/jira/browse/DAEMON-314, I will add the 
description in changes.xml when I get it working: Actually prunsrv.exe 
/SS service_name reports an error but waits only 1000 ms it seems, I 
need to find a clean way to make it wait for the --StopTimeout=nn value 
before reporting an error.

> 
> Gary
> 
> On Thu, Feb 4, 2021, 08:14 <jf...@apache.org> wrote:
> 
>> This is an automated email from the ASF dual-hosted git repository.
>>
>> jfclere pushed a commit to branch master
>> in repository https://gitbox.apache.org/repos/asf/commons-daemon.git
>>
>>
>> The following commit(s) were added to refs/heads/master by this push:
>>       new 5bca7af  Apply --StopTimeout=nn to the command or class that does
>> the stop. Otherwise it might wait for ever and the processes have to be
>> kill by hands.
>> 5bca7af is described below
>>
>> commit 5bca7af78162fbdd2d2f4b6b95470b29d15039a8
>> Author: Jean-Frederic Clere <jf...@gmail.com>
>> AuthorDate: Thu Feb 4 13:29:08 2021 +0100
>>
>>      Apply --StopTimeout=nn to the command or class that does the stop.
>>      Otherwise it might wait for ever and the processes have to be kill by
>>      hands.
>> ---
>>   src/native/windows/apps/prunsrv/prunsrv.c | 14 ++++++++++----
>>   1 file changed, 10 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/native/windows/apps/prunsrv/prunsrv.c
>> b/src/native/windows/apps/prunsrv/prunsrv.c
>> index c49295f..6b283b2 100644
>> --- a/src/native/windows/apps/prunsrv/prunsrv.c
>> +++ b/src/native/windows/apps/prunsrv/prunsrv.c
>> @@ -1135,6 +1135,8 @@ static DWORD WINAPI serviceStop(LPVOID lpParameter)
>>           apxLogWrite(APXLOG_MARK_INFO "Worker is not defined.");
>>           return TRUE;    /* Nothing to do */
>>       }
>> +    if (timeout > 0x7FFFFFFF)
>> +        timeout = INFINITE;     /* If the timeout was '-1' wait forewer */
>>       if (_jni_shutdown) {
>>           if (!IS_VALID_STRING(SO_STARTPATH) &&
>> IS_VALID_STRING(SO_STOPPATH)) {
>>               /* If the Working path is specified change the current
>> directory
>> @@ -1178,7 +1180,10 @@ static DWORD WINAPI serviceStop(LPVOID lpParameter)
>>               }
>>               else {
>>                   apxLogWrite(APXLOG_MARK_DEBUG "Waiting for Java JNI stop
>> worker to finish for %s:%s...", _jni_sclass, _jni_smethod);
>> -                apxJavaWait(hWorker, INFINITE, FALSE);
>> +                if (!timeout)
>> +                    apxJavaWait(hWorker, INFINITE, FALSE);
>> +                else
>> +                    apxJavaWait(hWorker, timeout, FALSE);
>>                   apxLogWrite(APXLOG_MARK_DEBUG "Java JNI stop worker
>> finished.");
>>               }
>>           }
>> @@ -1251,7 +1256,10 @@ static DWORD WINAPI serviceStop(LPVOID lpParameter)
>>               goto cleanup;
>>           } else {
>>               apxLogWrite(APXLOG_MARK_DEBUG "Waiting for stop worker to
>> finish...");
>> -            apxHandleWait(hWorker, INFINITE, FALSE);
>> +            if (!timeout)
>> +                apxHandleWait(hWorker, INFINITE, FALSE);
>> +            else
>> +                apxHandleWait(hWorker, timeout, FALSE);
>>               apxLogWrite(APXLOG_MARK_DEBUG "Stop worker finished.");
>>           }
>>           wait_to_die = TRUE;
>> @@ -1272,8 +1280,6 @@ cleanup:
>>           CloseHandle(gSignalThread);
>>           gSignalEvent = NULL;
>>       }
>> -    if (timeout > 0x7FFFFFFF)
>> -        timeout = INFINITE;     /* If the timeout was '-1' wait forewer */
>>       if (wait_to_die && !timeout)
>>           timeout = 300 * 1000;   /* Use the 5 minute default shutdown */
>>
>>
>>
> 


-- 
Cheers

Jean-Frederic

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org