Skip to content

Commit

Permalink
UNDERTOW-1773 to avoid leak, make sure the iteration continue in case…
Browse files Browse the repository at this point in the history
… of exception.
  • Loading branch information
soul2zimate committed Sep 7, 2020
1 parent 818bfe3 commit 512c200
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions core/src/main/java/io/undertow/UndertowLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -423,4 +423,8 @@ void nodeConfigCreated(URI connectionURI, String balancer, String domain, String
@LogMessage(level = DEBUG)
@Message(id = 5092, value = "Failed to free direct buffer")
void directBufferDeallocationFailed(@Cause Throwable t);

@LogMessage(level = ERROR)
@Message(id = 5093, value = "Failed to destroy session.")
void failedToDestroySession(@Cause Exception e);
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package io.undertow.servlet.core;

import io.undertow.UndertowLogger;
import io.undertow.servlet.UndertowServletLogger;

import javax.servlet.ServletContext;
Expand Down Expand Up @@ -325,7 +326,12 @@ public void sessionDestroyed(final HttpSession session) {
final HttpSessionEvent sre = new HttpSessionEvent(session);
for (int i = httpSessionListeners.length - 1; i >= 0; --i) {
ManagedListener listener = httpSessionListeners[i];
this.<HttpSessionListener>get(listener).sessionDestroyed(sre);
try {
this.<HttpSessionListener> get(listener).sessionDestroyed(sre);
} catch (Exception e) {
// UNDERTOW-1773 to avoid leak, make sure the iteration continue in case of exception.
UndertowLogger.ROOT_LOGGER.failedToDestroySession(e);
}
}
}

Expand Down

0 comments on commit 512c200

Please sign in to comment.