<font size=2 face="sans-serif">Hello<br>
<br>
Based on Allan Zhang's comments I have closed my pull requests and opened
this one </font><a href="https://github.com/weld/core/pull/1990"><font size=2 color=blue face="sans-serif">https://github.com/weld/core/pull/1990</font></a><font size=2 face="sans-serif">
which is a better match for the recommendations in the sessionmanagement
spec. I still have not heard back from my customer so I will compile an
updated test fix and chase them up. If they approve, or if they do not
reply soon I will create pull requests for the other branches. <br>
<br>
Regards<br>
Benjamin </font>
<br>
<br>
<br>
<br><font size=1 color=#5f5f5f face="sans-serif">From: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">Allan Zhang/Toronto/IBM</font>
<br><font size=1 color=#5f5f5f face="sans-serif">To: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">Matej Novotny &lt;manovotn@redhat.com&gt;</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Cc: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">Benjamin Confino &lt;BENJAMIC@uk.ibm.com&gt;,
Shinji Ohtsuka &lt;EB92769@jp.ibm.com&gt;, Emily Jiang &lt;EMIJIANG@uk.ibm.com&gt;,
weld-dev@lists.jboss.org</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Date: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">06/05/2020 17:42</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Subject: &nbsp; &nbsp;
&nbsp; &nbsp;</font><font size=1 face="sans-serif">Re: [EXTERNAL]
Re: [weld-dev] Propagation of org.jboss.weld.context.ConversationContext.conversations
through session failover</font>
<br>
<hr noshade>
<br>
<br>
<br><font size=2>&gt;Shouldn't Liberty consider (at least after restart)
any access to a collection-based session property as an action marking
that property &quot;dirty&quot;?</font>
<br>
<br><font size=2>Liberty already has write option of ALL_SESSION_ATTRIBUTES
to mark the property &quot;dirty&quot; but customer wont use it for performance
reasons.</font>
<br>
<br><font size=2>The PR fix is following the JEE spec where property &quot;dirty&quot;
require setAttribute() call. </font><a href="https://docs.oracle.com/cd/E13924_01/coh.340/e13819/sessionmanagement.htm"><font size=2 color=blue>https://docs.oracle.com/cd/E13924_01/coh.340/e13819/sessionmanagement.htm</font></a>
<br>
<br><font size=2><i>As a general rule, all session attributes should be
treated as immutable objects if possible. This ensures that developers
are consciously aware when they change attributes. With mutable objects,
modifying attributes often requires two steps: modifying the state of the
attribute object, and then manually updating the session with the modified
attribute object by calling javax.servlet.http.HttpSession.setAttribute().
This means that your application should always call setAttribute() if the
attribute value has been changed, otherwise, the modified attribute value
will not replicate to the backup server.</i></font>
<br>
<br><font size=2>Thanks<br>
Allan Zhang</font><font size=2 face="Default Sans
 Serif"><br>
</font>
<br>
<br>
<br>
<br><font size=1 color=#5f5f5f face="sans-serif">From: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">Matej Novotny &lt;manovotn@redhat.com&gt;</font>
<br><font size=1 color=#5f5f5f face="sans-serif">To: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">Benjamin Confino &lt;BENJAMIC@uk.ibm.com&gt;</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Cc: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">Shinji Ohtsuka &lt;EB92769@jp.ibm.com&gt;,
Emily Jiang &lt;EMIJIANG@uk.ibm.com&gt;, weld-dev@lists.jboss.org, Allan
Zhang &lt;zhang@ca.ibm.com&gt;</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Date: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">2020-05-06 07:52 AM</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Subject: &nbsp; &nbsp;
&nbsp; &nbsp;</font><font size=1 face="sans-serif">[EXTERNAL] Re:
[weld-dev] Propagation of org.jboss.weld.context.ConversationContext.conversations
through session failover</font>
<br>
<hr noshade>
<br>
<br>
<br><font size=2 face="Arial">Hi,<br>
<br>
thanks for explanation, I understand the flow now.<br>
<br>
However, your suggested PR still looks like a workaround more than a fix
to me.<br>
<br>
I doubt Weld is the only case where this will emerge. You can easily store
any collection in session and expect it to behave like we do.<br>
So in the very least, anything of type java.util.Collection that is stored
in session is susceptible to this behaviour.<br>
Shouldn't Liberty consider (at least after restart) any access to a collection-based
session property as an action marking that property &quot;dirty&quot;?<br>
<br>
Regards<br>
Matej<br>
<br>
----- Original Message -----<br>
&gt; From: &quot;Benjamin Confino&quot; &lt;BENJAMIC@uk.ibm.com&gt;<br>
&gt; To: &quot;Matej Novotny&quot; &lt;manovotn@redhat.com&gt;<br>
&gt; Cc: &quot;Shinji Ohtsuka&quot; &lt;EB92769@jp.ibm.com&gt;, &quot;Emily
Jiang&quot; &lt;EMIJIANG@uk.ibm.com&gt;, weld-dev@lists.jboss.org, &quot;Allan<br>
&gt; Zhang&quot; &lt;zhang@ca.ibm.com&gt;<br>
&gt; Sent: Tuesday, May 5, 2020 3:59:30 PM<br>
&gt; Subject: RE: [weld-dev] Propagation of org.jboss.weld.context.ConversationContext.conversations
through session<br>
&gt; failover<br>
&gt; <br>
&gt; Hello Matej<br>
&gt; <br>
&gt; No worries about the delay, my customer has not responded so you are
ahead<br>
&gt; of schedule. You are correct, the purpose of this PR is to trigger
the<br>
&gt; &quot;dirty&quot; state in liberty's session storage. Let me try and
describe the<br>
&gt; flow again and hopefully it will be clearer:<br>
&gt; <br>
&gt; <br>
&gt; A1) The application is started for the first time. A conversation
map is<br>
&gt; created and stored into the session context. This marks it as dirty.<br>
&gt; A2) The application puts stuff into the map. Lets say this leaves
the map<br>
&gt; in State A<br>
&gt; A3) The server is told to shut down.<br>
&gt; A4) Liberty sees the map is dirty and saves map State A to persistent<br>
&gt; storage.<br>
&gt; <br>
&gt; B1) The server starts again.<br>
&gt; B2) Weld retrieves the conversation map (State A) from persistent
storage.<br>
&gt; Since it already has a map it does not put anything into session storage.<br>
&gt; Thus the map is clean.<br>
&gt; B3) The application does more stuff, moving the map to (State B).<br>
&gt; B3) The server is told to shut down.<br>
&gt; B4) Liberty sees the map is clean, it doesn't transfer anything to<br>
&gt; persistent storage.<br>
&gt; <br>
&gt; C1) The server starts again.<br>
&gt; C2) Weld retrieves the conversation map (State A). This is the wrong<br>
&gt; state.<br>
&gt; <br>
&gt; <br>
&gt; My PR changes B2 so that Weld will set the same map back into session<br>
&gt; storage. Then in B4 liberty will see the map is dirty and save State
B to<br>
&gt; storage, ensuring the correct state is retrieved at C2.<br>
&gt; <br>
&gt; We do have alternative solutions, for example you can configure Liberty
to<br>
&gt; store everything regardless of whether it is dirty or not. However
this<br>
&gt; has performance implications and so my customer does not want to use
that<br>
&gt; option.<br>
&gt; <br>
&gt; Regards<br>
&gt; Benjamin<br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; From: &nbsp; Matej Novotny &lt;manovotn@redhat.com&gt;<br>
&gt; To: &nbsp; &nbsp; Benjamin Confino &lt;BENJAMIC@uk.ibm.com&gt;<br>
&gt; Cc: &nbsp; &nbsp; weld-dev@lists.jboss.org, Allan Zhang &lt;zhang@ca.ibm.com&gt;,
Shinji<br>
&gt; Ohtsuka &lt;EB92769@jp.ibm.com&gt;, Emily Jiang &lt;EMIJIANG@uk.ibm.com&gt;<br>
&gt; Date: &nbsp; 05/05/2020 12:17<br>
&gt; Subject: &nbsp; &nbsp; &nbsp; &nbsp;[EXTERNAL] Re: [weld-dev] Propagation
of<br>
&gt; org.jboss.weld.context.ConversationContext.conversations through session<br>
&gt; failover<br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; I finally found some time to look into this, it took longer than I<br>
&gt; anticipated, sorry for that.<br>
&gt; <br>
&gt; Firstly, I am not quite following the flow of the reproducer you<br>
&gt; described.<br>
&gt; Weld creates the conversation map and stores in into the session on<br>
&gt; creation. We then retrieve this map from session whenever needed and
store<br>
&gt; additional things into it.<br>
&gt; All the while we use the same map (the same reference, or object if
you<br>
&gt; will)....so Liberty should see the same state in it, right? Or am
I<br>
&gt; missing something obvious?<br>
&gt; <br>
&gt; I am not familiar with how Liberty deals with server shutdown and
how it<br>
&gt; stores session attributes, but i would expect that if you just grab
the<br>
&gt; existing map from there, it will be up to date.<br>
&gt; The PRs you sent seem superfluous to me - you are overriding the attribute<br>
&gt; with exactly the same thing. probably just to trigger &quot;dirty&quot;
state in<br>
&gt; your session storage?<br>
&gt; <br>
&gt; Regards<br>
&gt; Matej<br>
&gt; <br>
&gt; ----- Original Message -----<br>
&gt; &gt; From: &quot;Benjamin Confino&quot; &lt;BENJAMIC@uk.ibm.com&gt;<br>
&gt; &gt; To: &quot;Matej Novotny&quot; &lt;manovotn@redhat.com&gt;<br>
&gt; &gt; Cc: weld-dev@lists.jboss.org, &quot;Allan Zhang&quot; &lt;zhang@ca.ibm.com&gt;,
&quot;Shinji<br>
&gt; Ohtsuka&quot; &lt;EB92769@jp.ibm.com&gt;, &quot;Emily Jiang&quot;<br>
&gt; &gt; &lt;EMIJIANG@uk.ibm.com&gt;<br>
&gt; &gt; Sent: Wednesday, April 29, 2020 11:56:43 AM<br>
&gt; &gt; Subject: RE: [weld-dev] Propagation of<br>
&gt; org.jboss.weld.context.ConversationContext.conversations through session<br>
&gt; &gt; failover<br>
&gt; &gt; <br>
&gt; &gt; Thank you for the heads up. When it's time to think about delivery
I'll<br>
&gt; be<br>
&gt; &gt; sure to create a PR against 3.1 and I presume you'd like me to
leave<br>
&gt; &gt; master alone for now?<br>
&gt; &gt; <br>
&gt; &gt; Regards<br>
&gt; &gt; Benjamin<br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; From: &nbsp; Matej Novotny &lt;manovotn@redhat.com&gt;<br>
&gt; &gt; To: &nbsp; &nbsp; Benjamin Confino &lt;BENJAMIC@uk.ibm.com&gt;<br>
&gt; &gt; Cc: &nbsp; &nbsp; weld-dev@lists.jboss.org, Allan Zhang &lt;zhang@ca.ibm.com&gt;,
Shinji<br>
&gt; &gt; Ohtsuka &lt;EB92769@jp.ibm.com&gt;, Emily Jiang &lt;EMIJIANG@uk.ibm.com&gt;<br>
&gt; &gt; Date: &nbsp; 29/04/2020 09:51<br>
&gt; &gt; Subject: &nbsp; &nbsp; &nbsp; &nbsp;[EXTERNAL] Re: [weld-dev]
Propagation of<br>
&gt; &gt; org.jboss.weld.context.ConversationContext.conversations through
session<br>
&gt; &gt; failover<br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; Hi,<br>
&gt; &gt; <br>
&gt; &gt; I'll take a look later today.<br>
&gt; &gt; Note that master branch is no longer Weld 3.x, it is 4.x (Jakarta
EE 9)<br>
&gt; &gt; and the CI there is going bonkers yet as I am in the middle of
changing<br>
&gt; &gt; it.<br>
&gt; &gt; If you want to file a PR against Weld 3, you can use 3.1 branch
for<br>
&gt; that.<br>
&gt; &gt; <br>
&gt; &gt; Regards<br>
&gt; &gt; Matej<br>
&gt; &gt; <br>
&gt; &gt; ----- Original Message -----<br>
&gt; &gt; &gt; From: &quot;Benjamin Confino&quot; &lt;BENJAMIC@uk.ibm.com&gt;<br>
&gt; &gt; &gt; To: weld-dev@lists.jboss.org<br>
&gt; &gt; &gt; Cc: &quot;Allan Zhang&quot; &lt;zhang@ca.ibm.com&gt;, &quot;Shinji
Ohtsuka&quot;<br>
&gt; &gt; &lt;EB92769@jp.ibm.com&gt;, &quot;Emily Jiang&quot; &lt;EMIJIANG@uk.ibm.com&gt;<br>
&gt; &gt; &gt; Sent: Tuesday, April 28, 2020 2:31:44 PM<br>
&gt; &gt; &gt; Subject: [weld-dev] Propagation of<br>
&gt; &gt; org.jboss.weld.context.ConversationContext.conversations through
session<br>
&gt; &gt; failover<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; Hello weld<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; I had a customer report that they were getting conversation
not found<br>
&gt; &gt; &gt; exceptions when restarting their server and visiting a url
with a<br>
&gt; ?cid=1<br>
&gt; &gt; &gt; suffix.<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; After investigation I believe the issue is that weld was
acquiring<br>
&gt; it's<br>
&gt; &gt; &gt; ConversationContext.conversations from the session database
via<br>
&gt; &gt; &gt; com.ibm.ws.session.store.db.DatabaseSession.getMultiRowAppData().
Once<br>
&gt; &gt; weld<br>
&gt; &gt; &gt; had retrieved the conversations map it would then decide
that since<br>
&gt; the<br>
&gt; &gt; map<br>
&gt; &gt; &gt; was already in the session attributes there was no need
to put it back<br>
&gt; &gt; into<br>
&gt; &gt; &gt; the attributes.<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; This means that Liberty did not realise the conversations
map had been<br>
&gt; &gt; &gt; updated, and did not store it's updated state into the database
when<br>
&gt; the<br>
&gt; &gt; &gt; server shut down again.<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; I have submitted a pair of pull requests that asks weld
to mark the<br>
&gt; &gt; &gt; conversation map as dirty upon access - this behaviour is
gated behind<br>
&gt; &gt; &gt; ConfigurationKey.RESET_HTTP_SESSION_ATTR_ON_BEAN_ACCESS
- I have<br>
&gt; tested<br>
&gt; &gt; it<br>
&gt; &gt; &gt; locally and it works. The next step is to prepare a test
fix for the<br>
&gt; &gt; &gt; customer to verify. However I wanted to send you this quick
note to<br>
&gt; keep<br>
&gt; &gt; you<br>
&gt; &gt; &gt; in the loop.<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; Regards<br>
&gt; &gt; &gt; Benjamin<br>
&gt; &gt; &gt; Unless stated otherwise above:<br>
&gt; &gt; &gt; IBM United Kingdom Limited - Registered in England and Wales
with<br>
&gt; number<br>
&gt; &gt; &gt; 741598.<br>
&gt; &gt; &gt; Registered office: PO Box 41, North Harbour, Portsmouth,
Hampshire PO6<br>
&gt; &gt; 3AU<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; _______________________________________________<br>
&gt; &gt; &gt; weld-dev mailing list<br>
&gt; &gt; &gt; weld-dev@lists.jboss.org<br>
&gt; &gt; &gt; <br>
&gt; &gt; <br>
&gt; </font><a href="https://lists.jboss.org/mailman/listinfo/weld-dev"><font size=2 face="Arial">https://lists.jboss.org/mailman/listinfo/weld-dev</font></a><font size=2 face="Arial"><br>
&gt; <br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; Unless stated otherwise above:<br>
&gt; &gt; IBM United Kingdom Limited - Registered in England and Wales
with number<br>
&gt; &gt; 741598.<br>
&gt; &gt; Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire
PO6<br>
&gt; 3AU<br>
&gt; &gt; <br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; Unless stated otherwise above:<br>
&gt; IBM United Kingdom Limited - Registered in England and Wales with
number<br>
&gt; 741598.<br>
&gt; Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire
PO6 3AU<br>
&gt; <br>
<br>
</font>
<br>
<br>
<br><font size=2 face="sans-serif"><br>
Unless stated otherwise above:<br>
IBM United Kingdom Limited - Registered in England and Wales with number
741598. <br>
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6
3AU<br>
</font>