Skip to content

Commit 106838d

Browse files
authored
Merge pull request #174 from manovotn/storeSessionBeforeListenerNotification
Make sure InMemorySessionManager stores session before notifying listeners
2 parents 592f8c5 + 3745984 commit 106838d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/src/main/java/io/undertow/server/session/InMemorySessionManager.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,10 @@ public Session createSession(final HttpServerExchange serverExchange, final Sess
184184
sessions.put(sessionID, session);
185185
config.setSessionId(serverExchange, session.getId());
186186
session.bumpTimeout();
187-
sessionListeners.sessionCreated(session, serverExchange);
187+
// Store an information about new session *before* notifying listeners
188+
// Otherwise there might be a cycle with CDI observers for session context lifecycle
188189
serverExchange.putAttachment(NEW_SESSION, session);
190+
sessionListeners.sessionCreated(session, serverExchange);
189191

190192
if (statisticsEnabled) {
191193
createdSessionCount.incrementAndGet();

0 commit comments

Comments
 (0)