Den mån 29 jan. 2024 kl 13:50 skrev Jun Omae <jun6...@gmail.com>:

> On 2023/03/20 10:27, phi...@apache.org wrote:
> > Author: philip
> > Date: Mon Mar 20 01:27:41 2023
> > New Revision: 1908547
> >
> > URL: http://svn.apache.org/viewvc?rev=1908547&view=rev
> > Log:
> > Add SIGTERM/SIGINT handling to svnserve, this allows it to exit more
> > gracefully which allows tools like valgrind to monitor whether the
> > program exits cleanly and do things like leak detection.
> >
> > * subversion/svnserve/svnserve.c
> >   (sigtermint_handler): New handler.
> >   (accept_connection): Check for signal.
> >   (sub_main): Install handler, check for signal, add return.
>
> After r1908547, svnserve shows E000004 error message even if sending
> SIGTERM/SIGINT to stop normally the process.
>
> [[[
> $ ~/svn/trunk-1915316/bin/svnserve -X &
> [1] 3088030
> $ kill %1
> $ svnserve: E000004: Can't accept client connection: Interrupted system
> call
> ]]]
>
> Another example, the error messages are shown repeatedly while running
> check-swig-rb which is using svnserve.
>
> [[[
> $ make check-swig-rb
> ...
> Loaded suite .
> Started
> svnserve: E000004: Can't accept client connection: Interrupted system call
> .svnserve: E000004: Can't accept client connection: Interrupted system call
> .svnserve: E000004: Can't accept client connection: Interrupted system call
> .svnserve: E000004: Can't accept client connection: Interrupted system call
> .svnserve: E000004: Can't accept client connection: Interrupted system call
> ]]]
>
> I think we should prevent the messages even if the system call is
> interrupted
> when stop request by SIGTERM/SIGINT.
>
> --
> Jun Omae <jun6...@gmail.com> (大前 潤)
>
>
Good catch! How about:

[[[
Index: subversion/svnserve/svnserve.c
===================================================================
--- subversion/svnserve/svnserve.c      (revision 1915424)
+++ subversion/svnserve/svnserve.c      (working copy)
@@ -574,7 +574,7 @@ accept_connection(connection_t **connection,
     || APR_STATUS_IS_ECONNABORTED(status)
     || APR_STATUS_IS_ECONNRESET(status));

-  return status
+  return status && !sigtermint_seen
        ? svn_error_wrap_apr(status, _("Can't accept client connection"))
        : SVN_NO_ERROR;
 }
]]]

Reply via email to