<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:13px"><div class="" style="" id="yui_3_16_0_1_1420473003522_6441"><span lang="EN-US" class="" style="" id="yui_3_16_0_1_1420473003522_6737">Hi
developers!<o:p class="" style=""></o:p></span></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6453"><span lang="EN-US" class="" style=""> </span></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6444"><span lang="EN-US" class="" style="" id="yui_3_16_0_1_1420473003522_6443"> I recently changed to WildFly so to undertow
too. Unfortunately I got an issue </span><span style="font-size: 13px;" id="yui_3_16_0_1_1420473003522_6736">and I hope
this dev list is the right place to questions regarding undertow.</span></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6445"><span lang="EN-US" class="" style=""> </span></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6439"><span lang="EN-US" class="" style="" id="yui_3_16_0_1_1420473003522_6438"> The issue occurs when there are two sessions
and I want to invalidate from one session A </span><span style="font-size: 13px;" id="yui_3_16_0_1_1420473003522_6738">the another
one B. The session B is invalidated but unfortunately a new request from
session A will create a new session C and Session A will remain in the memory.</span></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6448"><span lang="EN-US" class="" style="" id="yui_3_16_0_1_1420473003522_6447">Digging a
little bit in the source code, I found that when the session B is invalidated, HttpSessionImpl.invalidate()
function is called, where the 'exchange' object is got and passed to the
session.invalidate:<o:p class="" style=""></o:p></span></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6448"><span lang="EN-US" class="" style=""><br></span></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6450"><span lang="EN-US" class="" style="" id="yui_3_16_0_1_1420473003522_6449">ServletRequestContext
current = SecurityActions.currentServletRequestContext();<o:p class="" style=""></o:p></span></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6451"><span style="font-size: 13px;" id="yui_3_16_0_1_1420473003522_6822"> if (current == null) {</span><br></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6452"><span lang="EN-US" class="" style="" id="yui_3_16_0_1_1420473003522_6733"> session.invalidate(null);<o:p class="" style=""></o:p></span></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6470"><span lang="EN-US" class="" style=""> } else {<o:p class="" style=""></o:p></span></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6472"><span lang="EN-US" class="" style="" id="yui_3_16_0_1_1420473003522_6471"> session.invalidate(current.getOriginalRequest().getExchange());<o:p class="" style=""></o:p></span></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6431"><span lang="EN-US" class="" style=""> }<o:p class="" style=""></o:p></span></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6430"><span lang="EN-US" class="" style=""><br></span></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6430"><span lang="EN-US" class="" style="" id="yui_3_16_0_1_1420473003522_6429">Then the session B instance InMemorySessionManager.invalidate () line 415 the following is called:<o:p class="" style=""></o:p></span></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6428"><span style="font-size: 13px;" id="yui_3_16_0_1_1420473003522_6903"> if
(exchange != null) {</span><br></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6427"><span lang="EN-US" class="" style="" id="yui_3_16_0_1_1420473003522_6426"> sessionCookieConfig.clearSession(exchange, this.getId());<o:p class="" style=""></o:p></span></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6425"><span lang="EN-US" class="" style=""> }<o:p class="" style=""></o:p></span></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6424"><span lang="EN-US" class="" style=""><br></span></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6424" dir="ltr"><span lang="EN-US" class="" style="" id="yui_3_16_0_1_1420473003522_6423">where the
old session's </span><span style="font-size: 12.7272720336914px;" class="">(Session B)</span><span style="font-size: 13px;" class="" id="yui_3_16_0_1_1420473003522_7312"> id what was removed, destroyed is placed as cookie with expired date onto the exchange
(the response)</span></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6422"><font size="2" id="yui_3_16_0_1_1420473003522_6732"><span class="" style="" id="yui_3_16_0_1_1420473003522_6503"><span style="line-height: 107%; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;" class="" id="yui_3_16_0_1_1420473003522_6502"> Cookie</span></span><span style="line-height: 107%; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;" class="" id="yui_3_16_0_1_1420473003522_6473"> cookie </span><span class="" style="" id="yui_3_16_0_1_1420473003522_6476"><span style="line-height: 107%; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;" class="" id="yui_3_16_0_1_1420473003522_6475"><span style="box-sizing: border-box;" class="" id="yui_3_16_0_1_1420473003522_6474">=</span></span></span><span style="line-height: 107%; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;" class="" id="yui_3_16_0_1_1420473003522_6477"> <span class="" style=""></span><span style="line-height: 107%; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;" class="" id="yui_3_16_0_1_1420473003522_6479"><span style="box-sizing: border-box;" class="" id="yui_3_16_0_1_1420473003522_6478">new</span></span></span><span style="line-height: 107%; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;" class="" id="yui_3_16_0_1_1420473003522_6421"> <span class="" style=""></span><span style="box-sizing: border-box;" class="" id="yui_3_16_0_1_1420473003522_6432">CookieImpl</span>(cookieName, sessionId)<o:p class="" style=""></o:p></span></font></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6422"><font size="2"><span style="line-height: 107%; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;" class=""> ...</span></font></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6420"><font size="2" id="yui_3_16_0_1_1420473003522_6731"><span style="line-height: 107%; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;" class="" id="yui_3_16_0_1_1420473003522_6501"> exchange</span><span class="" style="" id="yui_3_16_0_1_1420473003522_6500"><span style="line-height: 107%; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;" class="" id="yui_3_16_0_1_1420473003522_6499"><span style="box-sizing: border-box;" class="" id="yui_3_16_0_1_1420473003522_6498">.</span></span></span><span style="line-height: 107%; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;" class="" id="yui_3_16_0_1_1420473003522_6419">setResponseCookie(cookie);</span></font><span lang="EN-US" class="" style=""><o:p class="" style=""></o:p></span></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6418"><span lang="EN-US" class="" style=""><br></span></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6418" dir="ltr"><span lang="EN-US" class="" style="" id="yui_3_16_0_1_1420473003522_6417">So the next
request will not contain the right cookie so the session will not be found and
a new session will be created (ServletContextImpl.getSession()). That's the main cause what I see.<o:p class="" style=""></o:p></span></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6416"><span lang="EN-US" class="" style=""><br></span></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6416"><span lang="EN-US" class="" style="" id="yui_3_16_0_1_1420473003522_6415">I checked
issue UNDERTOW-261 what is sounds very similar, but this is not the case
because the session remains active in the memory but a new one still created.<o:p class="" style=""></o:p></span></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6414"><span lang="EN-US" class="" style=""><br></span></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6414"><span lang="EN-US" class="" style="" id="yui_3_16_0_1_1420473003522_6413">Used
undertow 1.1.x branch for sources, as WildFly 8.2.0 with undertow 1.1.0.Final.<o:p class="" style=""></o:p></span></div><div class="" style="" id="yui_3_16_0_1_1420473003522_6412"><span lang="EN-US" class="" style=""> </span></div><div id="yui_3_16_0_1_1420473003522_6232">
</div><div class="" style="" id="yui_3_16_0_1_1420473003522_6411"><span lang="EN-US" class="" style="" id="yui_3_16_0_1_1420473003522_6410">I’m doing
something wrong or it is a bug? Any feedback is appreciated. Thanks in advance!<o:p class="" style=""></o:p></span></div><div id="yui_3_16_0_1_1420473003522_6232" class="" style=""><br class="" style=""></div><div id="yui_3_16_0_1_1420473003522_6232" class="" style="" dir="ltr">Best Regards,</div><div id="yui_3_16_0_1_1420473003522_6232" class="" style="" dir="ltr">lalo</div></div></body></html>