[tomcat] branch master updated: Delete UDS file on close

2021-01-07 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm 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 0ee3382  Delete UDS file on close
0ee3382 is described below

commit 0ee33826560943b1c4852326746f79ba90b75c4e
Author: remm 
AuthorDate: Thu Jan 7 15:13:55 2021 +0100

Delete UDS file on close

Only if it was actually bound successfully. Thanks to jfclere for the
ideas.
---
 java/org/apache/tomcat/util/net/AbstractEndpoint.java | 2 +-
 java/org/apache/tomcat/util/net/NioEndpoint.java  | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java 
b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
index fe9957b..55356f9 100644
--- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
@@ -586,7 +586,7 @@ public abstract class AbstractEndpoint {
 private boolean bindOnInit = true;
 public boolean getBindOnInit() { return bindOnInit; }
 public void setBindOnInit(boolean b) { this.bindOnInit = b; }
-private volatile BindState bindState = BindState.UNBOUND;
+protected volatile BindState bindState = BindState.UNBOUND;
 
 /**
  * Keepalive timeout, if not set the soTimeout is used.
diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java 
b/java/org/apache/tomcat/util/net/NioEndpoint.java
index a1743a4..2661671 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -349,6 +349,9 @@ public class NioEndpoint extends 
AbstractJsseEndpoint
 serverSock.close();
 }
 serverSock = null;
+if (getUnixDomainSocketPath() != null && bindState != 
BindState.UNBOUND) {
+Files.delete(Paths.get(getUnixDomainSocketPath()));
+}
 }
 
 


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



[tomcat] branch 9.0.x updated: Delete UDS file on close

2021-01-07 Thread remm
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/9.0.x by this push:
 new d0e4445  Delete UDS file on close
d0e4445 is described below

commit d0e4445b0546e70f78f615d566897d74abdaf212
Author: remm 
AuthorDate: Thu Jan 7 15:13:55 2021 +0100

Delete UDS file on close

Only if it was actually bound successfully. Thanks to jfclere for the
ideas.
---
 java/org/apache/tomcat/util/net/AbstractEndpoint.java | 2 +-
 java/org/apache/tomcat/util/net/NioEndpoint.java  | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java 
b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
index 471190d..3cc0a64 100644
--- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
@@ -617,7 +617,7 @@ public abstract class AbstractEndpoint {
 private boolean bindOnInit = true;
 public boolean getBindOnInit() { return bindOnInit; }
 public void setBindOnInit(boolean b) { this.bindOnInit = b; }
-private volatile BindState bindState = BindState.UNBOUND;
+protected volatile BindState bindState = BindState.UNBOUND;
 
 /**
  * Keepalive timeout, if not set the soTimeout is used.
diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java 
b/java/org/apache/tomcat/util/net/NioEndpoint.java
index 0573938..21f5507 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -405,6 +405,9 @@ public class NioEndpoint extends 
AbstractJsseEndpoint
 serverSock.close();
 }
 serverSock = null;
+if (getUnixDomainSocketPath() != null && bindState != 
BindState.UNBOUND) {
+Files.delete(Paths.get(getUnixDomainSocketPath()));
+}
 }
 
 // -- Protected Methods


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



[Bug 65001] HTTPNIO non-blocking IO servlet 3.1 API may fail to alert webapp that a request is complete

2021-01-07 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=65001

--- Comment #1 from Mark Thomas  ---
Thanks for the really good test case. I've found a (hopefully the) bug. I'm
currently working on a fix.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch master updated: Fix bug 65001 Fix error handling for exceptions in [Read|Write]Listener

2021-01-07 Thread markt
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 829bfd7  Fix bug 65001 Fix error handling for exceptions in 
[Read|Write]Listener
829bfd7 is described below

commit 829bfd74cd9f08e38ce8671042819f289651f342
Author: Mark Thomas 
AuthorDate: Thu Jan 7 16:40:03 2021 +

Fix bug 65001 Fix error handling for exceptions in [Read|Write]Listener

https://bz.apache.org/bugzilla/show_bug.cgi?id=65001
---
 java/org/apache/catalina/connector/CoyoteAdapter.java | 14 --
 webapps/docs/changelog.xml|  4 
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/connector/CoyoteAdapter.java 
b/java/org/apache/catalina/connector/CoyoteAdapter.java
index 5f1b04f..e470ed9 100644
--- a/java/org/apache/catalina/connector/CoyoteAdapter.java
+++ b/java/org/apache/catalina/connector/CoyoteAdapter.java
@@ -181,8 +181,13 @@ public class CoyoteAdapter implements Adapter {
 }
 } catch (Throwable t) {
 ExceptionUtils.handleThrowable(t);
+// Need to trigger the call to 
AbstractProcessor.setErrorState()
+// before the listener is called so the listener can 
call complete
+// Therefore no need to set success=false as that 
would trigger a
+// second call to AbstractProcessor.setErrorState()
+// https://bz.apache.org/bugzilla/show_bug.cgi?id=65001
+res.action(ActionCode.CLOSE_NOW, t);
 writeListener.onError(t);
-success = false;
 } finally {
 request.getContext().unbind(false, oldCL);
 }
@@ -203,8 +208,13 @@ public class CoyoteAdapter implements Adapter {
 }
 } catch (Throwable t) {
 ExceptionUtils.handleThrowable(t);
+// Need to trigger the call to 
AbstractProcessor.setErrorState()
+// before the listener is called so the listener can 
call complete
+// Therefore no need to set success=false as that 
would trigger a
+// second call to AbstractProcessor.setErrorState()
+// https://bz.apache.org/bugzilla/show_bug.cgi?id=65001
+res.action(ActionCode.CLOSE_NOW, t);
 readListener.onError(t);
-success = false;
 } finally {
 request.getContext().unbind(false, oldCL);
 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 57c000b..6a08be2 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -167,6 +167,10 @@
 unixDomainSocketPathPermissions attributes.
 Based on a PR submitted by Graham Leggett. (remm)
   
+  
+65001: Fix error handling for exceptions throw from calls
+to ReadListener and WriteListener. (markt)
+  
 
   
   


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



[tomcat] branch 9.0.x updated: Fix bug 65001 Fix error handling for exceptions in [Read|Write]Listener

2021-01-07 Thread markt
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/9.0.x by this push:
 new d6d3259  Fix bug 65001 Fix error handling for exceptions in 
[Read|Write]Listener
d6d3259 is described below

commit d6d3259d74bd852d81bff6d60e72d6ca8c57923a
Author: Mark Thomas 
AuthorDate: Thu Jan 7 16:40:03 2021 +

Fix bug 65001 Fix error handling for exceptions in [Read|Write]Listener

https://bz.apache.org/bugzilla/show_bug.cgi?id=65001
---
 java/org/apache/catalina/connector/CoyoteAdapter.java | 14 --
 webapps/docs/changelog.xml|  4 
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/connector/CoyoteAdapter.java 
b/java/org/apache/catalina/connector/CoyoteAdapter.java
index 740fa94..2288451 100644
--- a/java/org/apache/catalina/connector/CoyoteAdapter.java
+++ b/java/org/apache/catalina/connector/CoyoteAdapter.java
@@ -185,8 +185,13 @@ public class CoyoteAdapter implements Adapter {
 }
 } catch (Throwable t) {
 ExceptionUtils.handleThrowable(t);
+// Need to trigger the call to 
AbstractProcessor.setErrorState()
+// before the listener is called so the listener can 
call complete
+// Therefore no need to set success=false as that 
would trigger a
+// second call to AbstractProcessor.setErrorState()
+// https://bz.apache.org/bugzilla/show_bug.cgi?id=65001
+res.action(ActionCode.CLOSE_NOW, t);
 writeListener.onError(t);
-success = false;
 } finally {
 request.getContext().unbind(false, oldCL);
 }
@@ -207,8 +212,13 @@ public class CoyoteAdapter implements Adapter {
 }
 } catch (Throwable t) {
 ExceptionUtils.handleThrowable(t);
+// Need to trigger the call to 
AbstractProcessor.setErrorState()
+// before the listener is called so the listener can 
call complete
+// Therefore no need to set success=false as that 
would trigger a
+// second call to AbstractProcessor.setErrorState()
+// https://bz.apache.org/bugzilla/show_bug.cgi?id=65001
+res.action(ActionCode.CLOSE_NOW, t);
 readListener.onError(t);
-success = false;
 } finally {
 request.getContext().unbind(false, oldCL);
 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 2db2cf8..6b0c60c 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -167,6 +167,10 @@
 unixDomainSocketPathPermissions attributes.
 Based on a PR submitted by Graham Leggett. (remm)
   
+  
+65001: Fix error handling for exceptions throw from calls
+to ReadListener and WriteListener. (markt)
+  
 
   
   


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



[tomcat] branch 8.5.x updated: Fix bug 65001 Fix error handling for exceptions in [Read|Write]Listener

2021-01-07 Thread markt
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 5961f65  Fix bug 65001 Fix error handling for exceptions in 
[Read|Write]Listener
5961f65 is described below

commit 5961f658b739e2d51fc67b5ae275341f4b91f9d0
Author: Mark Thomas 
AuthorDate: Thu Jan 7 16:40:03 2021 +

Fix bug 65001 Fix error handling for exceptions in [Read|Write]Listener

https://bz.apache.org/bugzilla/show_bug.cgi?id=65001
---
 java/org/apache/catalina/connector/CoyoteAdapter.java | 14 --
 webapps/docs/changelog.xml|  4 
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/connector/CoyoteAdapter.java 
b/java/org/apache/catalina/connector/CoyoteAdapter.java
index 46a7c9f..141fde7 100644
--- a/java/org/apache/catalina/connector/CoyoteAdapter.java
+++ b/java/org/apache/catalina/connector/CoyoteAdapter.java
@@ -192,8 +192,13 @@ public class CoyoteAdapter implements Adapter {
 }
 } catch (Throwable t) {
 ExceptionUtils.handleThrowable(t);
+// Need to trigger the call to 
AbstractProcessor.setErrorState()
+// before the listener is called so the listener can 
call complete
+// Therefore no need to set success=false as that 
would trigger a
+// second call to AbstractProcessor.setErrorState()
+// https://bz.apache.org/bugzilla/show_bug.cgi?id=65001
+res.action(ActionCode.CLOSE_NOW, t);
 writeListener.onError(t);
-success = false;
 } finally {
 request.getContext().unbind(false, oldCL);
 }
@@ -214,8 +219,13 @@ public class CoyoteAdapter implements Adapter {
 }
 } catch (Throwable t) {
 ExceptionUtils.handleThrowable(t);
+// Need to trigger the call to 
AbstractProcessor.setErrorState()
+// before the listener is called so the listener can 
call complete
+// Therefore no need to set success=false as that 
would trigger a
+// second call to AbstractProcessor.setErrorState()
+// https://bz.apache.org/bugzilla/show_bug.cgi?id=65001
+res.action(ActionCode.CLOSE_NOW, t);
 readListener.onError(t);
-success = false;
 } finally {
 request.getContext().unbind(false, oldCL);
 }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index bba0246..e9e7988 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -167,6 +167,10 @@
 combination with the Servlet non-blocking IO API. It was possible that
 some requests could get dropped. (markt)
   
+  
+65001: Fix error handling for exceptions throw from calls
+to ReadListener and WriteListener. (markt)
+  
 
   
   


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



[Bug 65001] HTTPNIO non-blocking IO servlet 3.1 API may fail to alert webapp that a request is complete

2021-01-07 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=65001

Mark Thomas  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #2 from Mark Thomas  ---
Thanks again for the test case. A good test case really does make a huge
difference to how easily we can fix a bug.

Fixed in:
- 10.0.x for 10.0.1 onwards
- 9.0.x for 9.0.42 onwards
- 8.5.x for 8.5.62 onwards

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org