You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2019/09/19 18:57:02 UTC

[tomcat] branch master updated: Fix test failures caused by APR crash during shutdown

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
     new 9825246  Fix test failures caused by APR crash during shutdown
9825246 is described below

commit 9825246d0ce833552a3745ac3b02a44551789caa
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Sep 19 19:56:23 2019 +0100

    Fix test failures caused by APR crash during shutdown
    
    When a request thread was still trying to read/write from/to the socket,
    the socket wrapper was not marked as closed so the thread tried to use
    an APR socket that the POller then closed. Trying to read/write from a
    closed APR socket will nearly always trigger a crash.
---
 java/org/apache/tomcat/util/net/AprEndpoint.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java b/java/org/apache/tomcat/util/net/AprEndpoint.java
index 46c7047..6dde69c 100644
--- a/java/org/apache/tomcat/util/net/AprEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AprEndpoint.java
@@ -1126,8 +1126,11 @@ public class AprEndpoint extends AbstractEndpoint<Long,Long> implements SNICallB
             // Close all sockets in the add queue
             info = addList.get();
             while (info != null) {
-                // Make sure the  socket isn't in the poller before we close it
+                // Make sure the socket isn't in the poller before we close it
                 removeFromPoller(info.socket);
+                // Close the SocketWrapper to prevent any still running application
+                // threads from trying to use the socket
+                connections.get(Long.valueOf(info.socket)).close();
                 // Poller isn't running at this point so use destroySocket()
                 // directly
                 destroySocket(info.socket);


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


Re: [tomcat] branch master updated: Fix test failures caused by APR crash during shutdown

Posted by Mark Thomas <ma...@apache.org>.
On 19/09/2019 20:39, Mark Thomas wrote:
> On 19/09/2019 19:57, markt@apache.org wrote:
>> This is an automated email from the ASF dual-hosted git repository.
>>
>> markt pushed a commit to branch master
>> in repository https://gitbox.apache.org/repos/asf/tomcat.git
>>
>>
>> The following commit(s) were added to refs/heads/master by this push:
>>      new 9825246  Fix test failures caused by APR crash during shutdown
>> 9825246 is described below
>>
>> commit 9825246d0ce833552a3745ac3b02a44551789caa
>> Author: Mark Thomas <ma...@apache.org>
>> AuthorDate: Thu Sep 19 19:56:23 2019 +0100
>>
>>     Fix test failures caused by APR crash during shutdown
>>     
>>     When a request thread was still trying to read/write from/to the socket,
>>     the socket wrapper was not marked as closed so the thread tried to use
>>     an APR socket that the POller then closed. Trying to read/write from a
>>     closed APR socket will nearly always trigger a crash.
> 
> Hmm. Maybe not as successful as I had hoped. The chances of a crash
> appear to have reduced but crashes do still occur. It looks like one
> root cause has been fixed but that there is still at least one more root
> cause to track down. I'll take another look.

Looking at this more closely, this isn't fixing a root cause it is just
altering the timing slightly - enough to reduce the chance of the issue
occurring.

I intend to revert the above fix and work on an alternative.

Mark

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


Re: [tomcat] branch master updated: Fix test failures caused by APR crash during shutdown

Posted by Mark Thomas <ma...@apache.org>.
On 19/09/2019 19:57, markt@apache.org wrote:
> This is an automated email from the ASF dual-hosted git repository.
> 
> markt pushed a commit to branch master
> in repository https://gitbox.apache.org/repos/asf/tomcat.git
> 
> 
> The following commit(s) were added to refs/heads/master by this push:
>      new 9825246  Fix test failures caused by APR crash during shutdown
> 9825246 is described below
> 
> commit 9825246d0ce833552a3745ac3b02a44551789caa
> Author: Mark Thomas <ma...@apache.org>
> AuthorDate: Thu Sep 19 19:56:23 2019 +0100
> 
>     Fix test failures caused by APR crash during shutdown
>     
>     When a request thread was still trying to read/write from/to the socket,
>     the socket wrapper was not marked as closed so the thread tried to use
>     an APR socket that the POller then closed. Trying to read/write from a
>     closed APR socket will nearly always trigger a crash.

Hmm. Maybe not as successful as I had hoped. The chances of a crash
appear to have reduced but crashes do still occur. It looks like one
root cause has been fixed but that there is still at least one more root
cause to track down. I'll take another look.

Mark


> ---
>  java/org/apache/tomcat/util/net/AprEndpoint.java | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java b/java/org/apache/tomcat/util/net/AprEndpoint.java
> index 46c7047..6dde69c 100644
> --- a/java/org/apache/tomcat/util/net/AprEndpoint.java
> +++ b/java/org/apache/tomcat/util/net/AprEndpoint.java
> @@ -1126,8 +1126,11 @@ public class AprEndpoint extends AbstractEndpoint<Long,Long> implements SNICallB
>              // Close all sockets in the add queue
>              info = addList.get();
>              while (info != null) {
> -                // Make sure the  socket isn't in the poller before we close it
> +                // Make sure the socket isn't in the poller before we close it
>                  removeFromPoller(info.socket);
> +                // Close the SocketWrapper to prevent any still running application
> +                // threads from trying to use the socket
> +                connections.get(Long.valueOf(info.socket)).close();
>                  // Poller isn't running at this point so use destroySocket()
>                  // directly
>                  destroySocket(info.socket);
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
> 


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