[JBoss JIRA] (WFLY-12718) Clustering: replicated-cache sampling errors
by Radoslav Husar (Jira)
[ https://issues.jboss.org/browse/WFLY-12718?page=com.atlassian.jira.plugin... ]
Radoslav Husar commented on WFLY-12718:
---------------------------------------
[~tommaso-borgato] In the description you talk about scattered but summary talks about repl, but I assume this is really about repl.
> Clustering: replicated-cache sampling errors
> --------------------------------------------
>
> Key: WFLY-12718
> URL: https://issues.jboss.org/browse/WFLY-12718
> Project: WildFly
> Issue Type: Bug
> Components: Clustering
> Affects Versions: 18.0.0.Final
> Reporter: Tommasso Borgato
> Assignee: Paul Ferraro
> Priority: Blocker
>
> The issue is about replicated-cache in fail-over tests.
> WildFly is started in clustered mode using a replicated cache for replicating HTTP session data across cluster nodes; all 4 nodes in the cluster are initialized with the following cli script:
> {noformat}
> embed-server --server-config=standalone-ha.xml
> /subsystem=jgroups/channel=ee:write-attribute(name=stack,value=tcp)
> /subsystem=infinispan/cache-container=web/replicated-cache=testRepl:add()
> /subsystem=infinispan/cache-container=web/replicated-cache=testRepl/component=locking:write-attribute(name=isolation, value=REPEATABLE_READ)
> /subsystem=infinispan/cache-container=web/replicated-cache=testRepl/component=transaction:write-attribute(name=mode, value=BATCH)
> /subsystem=infinispan/cache-container=web/replicated-cache=testRepl/store=file:add()
> /subsystem=infinispan/cache-container=web:write-attribute(name=default-cache, value=testRepl)
> {noformat}
> The test is run with wildfly-18.0.0.Final.zip;
> The same tests run with version wildfly-17.0.1.Final.zip do not have any problem;
> hence this looks like a regression;
> As usual, we test that the serial value stored in the scattered cache is incremented at every call: when this is not true, we say we have a sampling error;
> Here are the runs that exhibit this issue:
> - **22.82% Fail Rate with WildFly-18 ** [eap-7.x-clustering-http-session-shutdown-repl#23|https://eap-qe-jenkins.r...]
> - **0% Fail Rate with WildFly-17 ** [eap-7.x-clustering-http-session-shutdown-repl#24|https://eap-qe-jenkins.r...]
> We also repeated the tests to make sure it can be reproduced:
> - **22.75% Fail rate with WildFly-18 ** [eap-7.x-clustering-http-session-shutdown-repl#26|https://eap-qe-jenkins.r...]
> - **0% Fail Rate with WildFly-17 ** [eap-7.x-clustering-http-session-shutdown-repl#25|https://eap-qe-jenkins.r...]
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years
[JBoss JIRA] (WFLY-12674) wildfly.jpa.skipquerydetach set to true, will now skip clearing of query results
by Scott Marlow (Jira)
[ https://issues.jboss.org/browse/WFLY-12674?page=com.atlassian.jira.plugin... ]
Scott Marlow commented on WFLY-12674:
-------------------------------------
[~kabirkhan], I created [EAP7-1365] + [https://github.com/wildfly/wildfly-proposals/pull/255] for this change :)
For testing, I added a mock persistence provider that verifies the JPA container behaviour when the *wildfly.jpa.skipquerydetach* is enabled (set to true), as well as the (default) JPA container behaviour when *wildfly.jpa.skipquerydetach* is set to false.
We will also run the Jakarta EE 8 platform TCK to ensure that this change doesn't introduce any unexpected behaviour. Are there other types of testing that you have in mind, or just more (which is fine :)?
> wildfly.jpa.skipquerydetach set to true, will now skip clearing of query results
> --------------------------------------------------------------------------------
>
> Key: WFLY-12674
> URL: https://issues.jboss.org/browse/WFLY-12674
> Project: WildFly
> Issue Type: Bug
> Components: JPA / Hibernate
> Reporter: Scott Marlow
> Assignee: Scott Marlow
> Priority: Major
> Fix For: 19.0.0.Beta1
>
>
> Introduce wildfly.jpa.skipquerydetach that defaults to false (to wrap query objects with detacher that clears query results when obtained) but could be set to true, for JBoss AS 5/6 compatibility. This could of been part of [WFLY-3674] but was overlooked.
> An example of setting wildfly.jpa.skipquerydetach to true, so that the various query detacher will not be used (e.g. underlying query is returned instead of instance of QueryNonTxInvocationDetacher/TypedQueryNonTxInvocationDetacher/StoredProcedureQueryNonTxInvocationDetacher wrapper):
> {code}
> <property name="wildfly.jpa.skipquerydetach" value="true" />
> {code}
> The below reference notes are more for background information but provide the explanation of why the AS5/6 way of detaching loaded entities changed later, to ensure the returned results from Query objects, are detached, instead of the current persistence context at the time of creating the query object, as per feedback below from JPA lead Linda DeMichiel.
> [From related JPA expert group discussion|https://download.oracle.com/javaee-archive/jpa-spec.java.net/u...]:
> {code}
> >>>>> Perhaps a clearer proposal could be:
> >>>>>
> >>>>> "
> >>>>> If the entity manager is invoked outside the scope of a transaction,
> >>>>> any entities loaded from the database will
> >>>>> immediately become detached at the end of the container level method
> >>>>> invocation call (e.g. when the session bean method
> >>>>> ends).
> >>>>> "
> >>>>
> >>>> Ah, thanks. That is not the intended semantics. Rather it is that the
> >>>> persistence context is created to service the method call that is made
> >>>> on the entity manager only. It doesn't have the duration of a business
> >>>> method invocation.
> >>>
> >>> Is it really?
> >>>
> >>
> >> Yes. See also section 3.8.7, which is quite explicit with regard to
> >> queries.
> >> BTW, these decisions date back to JPA 1.0 (aka EJB 3.0).
> >
> > My updated proposal for the 7.6.2 wording is:
> >
> > "
> > If the entity manager is invoked outside the scope of a transaction, any entities loaded from the database will
> > immediately become detached at the end of the entity manager method call.
> > "
> OK, sure + "... or query invocation"
> {code}
> Note that we (JPA expert group) missed Linda's response of "... or query invocation" in the JPA spec update, as the JPA 2.2 spec today states:
> {quote}
> 7.6.2 Container-managed Transaction-scoped Persistence Context
> The application can obtain a container-managed entity manager with transaction-scoped persistence context by injection or direct lookup in the JNDI namespace. The persistence context type for the entity manager is defaulted or defined as PersistenceContextType.TRANSACTION.
> A new persistence context begins when the container-managed entity manager is invoked [84] in the scope of an active JTA transaction, and there is no current persistence context already associated with the JTA transaction. The persistence context is created and then associated with the JTA transaction. This association of the persistence context with the JTA transaction is independent of the synchronization type of the persistence context and whether the persistence context has been joined to the transaction.
> {quote}
> [Some related AS5/6 JPA container code.|https://anonsvn.jboss.org/repos/jbossas/projects/jpa/trunk/impl/src...] which simply cleared the persistence context as we were creating a new Query, for example see:
> {code}
> public Query createQuery(String ejbqlString)
> {
> EntityManager em = getEntityManager();
> detachEntitiesIfNoTx(em);
> return em.createQuery(ejbqlString);
> }
> {code}
> Also of reference, is from issue description [WFLY-3674]:
> {quote}
> For compatibility with earlier JBoss application server versions (5.0/6.0), add an extension that allows the persistence context to last until the referencing persistence context is closed.
> For example, in a session method that has no active JTA transaction, entities returned, will not cleared from the persistence context, until the session method completes. This extension is only introduced to allow compatibility with older application server versions.
> {quote}
> [WFLY-12674] is about doing the same for Queries (if wildfly.jpa.skipquerydetach is set to true).
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years
[JBoss JIRA] (WFLY-12674) wildfly.jpa.skipquerydetach set to true, will now skip clearing of query results
by Kabir Khan (Jira)
[ https://issues.jboss.org/browse/WFLY-12674?page=com.atlassian.jira.plugin... ]
Kabir Khan commented on WFLY-12674:
-----------------------------------
Since this could do with some more testing, I think this should be cloned to EAP7 and go through the RFE process
> wildfly.jpa.skipquerydetach set to true, will now skip clearing of query results
> --------------------------------------------------------------------------------
>
> Key: WFLY-12674
> URL: https://issues.jboss.org/browse/WFLY-12674
> Project: WildFly
> Issue Type: Bug
> Components: JPA / Hibernate
> Reporter: Scott Marlow
> Assignee: Scott Marlow
> Priority: Major
> Fix For: 19.0.0.Beta1
>
>
> Introduce wildfly.jpa.skipquerydetach that defaults to false (to wrap query objects with detacher that clears query results when obtained) but could be set to true, for JBoss AS 5/6 compatibility. This could of been part of [WFLY-3674] but was overlooked.
> An example of setting wildfly.jpa.skipquerydetach to true, so that the various query detacher will not be used (e.g. underlying query is returned instead of instance of QueryNonTxInvocationDetacher/TypedQueryNonTxInvocationDetacher/StoredProcedureQueryNonTxInvocationDetacher wrapper):
> {code}
> <property name="wildfly.jpa.skipquerydetach" value="true" />
> {code}
> The below reference notes are more for background information but provide the explanation of why the AS5/6 way of detaching loaded entities changed later, to ensure the returned results from Query objects, are detached, instead of the current persistence context at the time of creating the query object, as per feedback below from JPA lead Linda DeMichiel.
> [From related JPA expert group discussion|https://download.oracle.com/javaee-archive/jpa-spec.java.net/u...]:
> {code}
> >>>>> Perhaps a clearer proposal could be:
> >>>>>
> >>>>> "
> >>>>> If the entity manager is invoked outside the scope of a transaction,
> >>>>> any entities loaded from the database will
> >>>>> immediately become detached at the end of the container level method
> >>>>> invocation call (e.g. when the session bean method
> >>>>> ends).
> >>>>> "
> >>>>
> >>>> Ah, thanks. That is not the intended semantics. Rather it is that the
> >>>> persistence context is created to service the method call that is made
> >>>> on the entity manager only. It doesn't have the duration of a business
> >>>> method invocation.
> >>>
> >>> Is it really?
> >>>
> >>
> >> Yes. See also section 3.8.7, which is quite explicit with regard to
> >> queries.
> >> BTW, these decisions date back to JPA 1.0 (aka EJB 3.0).
> >
> > My updated proposal for the 7.6.2 wording is:
> >
> > "
> > If the entity manager is invoked outside the scope of a transaction, any entities loaded from the database will
> > immediately become detached at the end of the entity manager method call.
> > "
> OK, sure + "... or query invocation"
> {code}
> Note that we (JPA expert group) missed Linda's response of "... or query invocation" in the JPA spec update, as the JPA 2.2 spec today states:
> {quote}
> 7.6.2 Container-managed Transaction-scoped Persistence Context
> The application can obtain a container-managed entity manager with transaction-scoped persistence context by injection or direct lookup in the JNDI namespace. The persistence context type for the entity manager is defaulted or defined as PersistenceContextType.TRANSACTION.
> A new persistence context begins when the container-managed entity manager is invoked [84] in the scope of an active JTA transaction, and there is no current persistence context already associated with the JTA transaction. The persistence context is created and then associated with the JTA transaction. This association of the persistence context with the JTA transaction is independent of the synchronization type of the persistence context and whether the persistence context has been joined to the transaction.
> {quote}
> [Some related AS5/6 JPA container code.|https://anonsvn.jboss.org/repos/jbossas/projects/jpa/trunk/impl/src...] which simply cleared the persistence context as we were creating a new Query, for example see:
> {code}
> public Query createQuery(String ejbqlString)
> {
> EntityManager em = getEntityManager();
> detachEntitiesIfNoTx(em);
> return em.createQuery(ejbqlString);
> }
> {code}
> Also of reference, is from issue description [WFLY-3674]:
> {quote}
> For compatibility with earlier JBoss application server versions (5.0/6.0), add an extension that allows the persistence context to last until the referencing persistence context is closed.
> For example, in a session method that has no active JTA transaction, entities returned, will not cleared from the persistence context, until the session method completes. This extension is only introduced to allow compatibility with older application server versions.
> {quote}
> [WFLY-12674] is about doing the same for Queries (if wildfly.jpa.skipquerydetach is set to true).
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
6 years