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 2020/10/27 17:08:18 UTC

[tomcat] branch 8.5.x updated: Restore try catch around Poller.events

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

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


The following commit(s) were added to refs/heads/8.5.x by this push:
     new 1c07384  Restore try catch around Poller.events
1c07384 is described below

commit 1c0738407e4c3a73b312fae279046249c2dc025d
Author: remm <re...@apache.org>
AuthorDate: Tue Oct 27 16:52:26 2020 +0100

    Restore try catch around Poller.events
    
    This is a regression caused when the Poller.events method was
    refactored.
---
 java/org/apache/tomcat/util/net/NioEndpoint.java | 8 ++++----
 webapps/docs/changelog.xml                       | 5 +++++
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java
index 08b8a4e..fadec98 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -849,15 +849,15 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel> {
                         }
                         break;
                     }
+                    // Either we timed out or we woke up, process events first
+                    if (keyCount == 0) {
+                        hasEvents = (hasEvents | events());
+                    }
                 } catch (Throwable x) {
                     ExceptionUtils.handleThrowable(x);
                     log.error("",x);
                     continue;
                 }
-                // Either we timed out or we woke up, process events first
-                if (keyCount == 0) {
-                    hasEvents = (hasEvents | events());
-                }
 
                 Iterator<SelectionKey> iterator =
                     keyCount > 0 ? selector.selectedKeys().iterator() : null;
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 606603d..6e732eb 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -91,6 +91,11 @@
         <bug>63362</bug>: Add collection of statistics for HTTP/2, WebSocket and
         connections upgraded via the HTTP upgrade mechanism. (markt)
       </fix>
+      <fix>
+        Restore exception catch around Poller.events, as it would cause
+        the NIO poller thread to exit. This is a regression caused when
+        the Poller.events method was refactored. (remm)
+      </fix>
     </changelog>
   </subseciton>
   <subsection name="Web applications">


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


Re: [tomcat] branch 8.5.x updated: Restore try catch around Poller.events

Posted by Mark Thomas <ma...@apache.org>.
On 27/10/2020 17:34, Rémy Maucherat wrote:
> On Tue, Oct 27, 2020 at 6:08 PM <ma...@apache.org> wrote:
> 
>> This is an automated email from the ASF dual-hosted git repository.
>>
>> markt pushed a commit to branch 8.5.x
>> in repository https://gitbox.apache.org/repos/asf/tomcat.git
>>
>>
>> The following commit(s) were added to refs/heads/8.5.x by this push:
>>      new 1c07384  Restore try catch around Poller.events
>> 1c07384 is described below
>>
>> commit 1c0738407e4c3a73b312fae279046249c2dc025d
>> Author: remm <re...@apache.org>
>> AuthorDate: Tue Oct 27 16:52:26 2020 +0100
>>
>>     Restore try catch around Poller.events
>>
>>     This is a regression caused when the Poller.events method was
>>     refactored.
>>
> 
> I never refactored Poller.events in 8.5, so it still had its blanket
> try/catch, so no possible problems. This is a rather recent regression
> overall.

Ah. I see that now. I'll revert that change.

Mark

> 
> Rémy
> 
> 
>> ---
>>  java/org/apache/tomcat/util/net/NioEndpoint.java | 8 ++++----
>>  webapps/docs/changelog.xml                       | 5 +++++
>>  2 files changed, 9 insertions(+), 4 deletions(-)
>>
>> diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java
>> b/java/org/apache/tomcat/util/net/NioEndpoint.java
>> index 08b8a4e..fadec98 100644
>> --- a/java/org/apache/tomcat/util/net/NioEndpoint.java
>> +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
>> @@ -849,15 +849,15 @@ public class NioEndpoint extends
>> AbstractJsseEndpoint<NioChannel> {
>>                          }
>>                          break;
>>                      }
>> +                    // Either we timed out or we woke up, process events
>> first
>> +                    if (keyCount == 0) {
>> +                        hasEvents = (hasEvents | events());
>> +                    }
>>                  } catch (Throwable x) {
>>                      ExceptionUtils.handleThrowable(x);
>>                      log.error("",x);
>>                      continue;
>>                  }
>> -                // Either we timed out or we woke up, process events first
>> -                if (keyCount == 0) {
>> -                    hasEvents = (hasEvents | events());
>> -                }
>>
>>                  Iterator<SelectionKey> iterator =
>>                      keyCount > 0 ? selector.selectedKeys().iterator() :
>> null;
>> diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
>> index 606603d..6e732eb 100644
>> --- a/webapps/docs/changelog.xml
>> +++ b/webapps/docs/changelog.xml
>> @@ -91,6 +91,11 @@
>>          <bug>63362</bug>: Add collection of statistics for HTTP/2,
>> WebSocket and
>>          connections upgraded via the HTTP upgrade mechanism. (markt)
>>        </fix>
>> +      <fix>
>> +        Restore exception catch around Poller.events, as it would cause
>> +        the NIO poller thread to exit. This is a regression caused when
>> +        the Poller.events method was refactored. (remm)
>> +      </fix>
>>      </changelog>
>>    </subseciton>
>>    <subsection name="Web applications">
>>
>>
>> ---------------------------------------------------------------------
>> 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


Re: [tomcat] branch 8.5.x updated: Restore try catch around Poller.events

Posted by Rémy Maucherat <re...@apache.org>.
On Tue, Oct 27, 2020 at 6:08 PM <ma...@apache.org> wrote:

> This is an automated email from the ASF dual-hosted git repository.
>
> markt pushed a commit to branch 8.5.x
> in repository https://gitbox.apache.org/repos/asf/tomcat.git
>
>
> The following commit(s) were added to refs/heads/8.5.x by this push:
>      new 1c07384  Restore try catch around Poller.events
> 1c07384 is described below
>
> commit 1c0738407e4c3a73b312fae279046249c2dc025d
> Author: remm <re...@apache.org>
> AuthorDate: Tue Oct 27 16:52:26 2020 +0100
>
>     Restore try catch around Poller.events
>
>     This is a regression caused when the Poller.events method was
>     refactored.
>

I never refactored Poller.events in 8.5, so it still had its blanket
try/catch, so no possible problems. This is a rather recent regression
overall.

Rémy


> ---
>  java/org/apache/tomcat/util/net/NioEndpoint.java | 8 ++++----
>  webapps/docs/changelog.xml                       | 5 +++++
>  2 files changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java
> b/java/org/apache/tomcat/util/net/NioEndpoint.java
> index 08b8a4e..fadec98 100644
> --- a/java/org/apache/tomcat/util/net/NioEndpoint.java
> +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
> @@ -849,15 +849,15 @@ public class NioEndpoint extends
> AbstractJsseEndpoint<NioChannel> {
>                          }
>                          break;
>                      }
> +                    // Either we timed out or we woke up, process events
> first
> +                    if (keyCount == 0) {
> +                        hasEvents = (hasEvents | events());
> +                    }
>                  } catch (Throwable x) {
>                      ExceptionUtils.handleThrowable(x);
>                      log.error("",x);
>                      continue;
>                  }
> -                // Either we timed out or we woke up, process events first
> -                if (keyCount == 0) {
> -                    hasEvents = (hasEvents | events());
> -                }
>
>                  Iterator<SelectionKey> iterator =
>                      keyCount > 0 ? selector.selectedKeys().iterator() :
> null;
> diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
> index 606603d..6e732eb 100644
> --- a/webapps/docs/changelog.xml
> +++ b/webapps/docs/changelog.xml
> @@ -91,6 +91,11 @@
>          <bug>63362</bug>: Add collection of statistics for HTTP/2,
> WebSocket and
>          connections upgraded via the HTTP upgrade mechanism. (markt)
>        </fix>
> +      <fix>
> +        Restore exception catch around Poller.events, as it would cause
> +        the NIO poller thread to exit. This is a regression caused when
> +        the Poller.events method was refactored. (remm)
> +      </fix>
>      </changelog>
>    </subseciton>
>    <subsection name="Web applications">
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>