[
https://issues.jboss.org/browse/AS7-5329?page=com.atlassian.jira.plugin.s...
]
Brian Stansberry commented on AS7-5329:
---------------------------------------
https://github.com/bstansberry/jboss-as/tree/AS7-5329_7.1 is an attempt at a fix for this,
based on the following analysis:
I think the solution to this is likely in TransactionRollbackSetupAction. It looks like
the web container (in ApplicationDispatcher) is calling ThreadBindingListener.bind() on
each entry to an application and calls unbind() on each exit. That's correct behavior
given the class javadoc for ThreadBindingListener. Those bind()/unbind() calls result in
TransactionRollbackSetupAction.setup() and teardown() calls.
The problem is TransactionRollbackSetupAction is doing the tx check in each teardown(). A
possible solution is to increment a counter in each setup() and decrement in teardown(),
only doing the tx check when the counter is zero. This would require some sort of
ThreadLocal though, because the TransactionRollbackSetupAction is scoped to the
deployment, not to a particular invocation.
Transaction leak protection for web requests is too restrictive
(possibly violating the spec)
---------------------------------------------------------------------------------------------
Key: AS7-5329
URL:
https://issues.jboss.org/browse/AS7-5329
Project: Application Server 7
Issue Type: Bug
Components: Transactions, Web
Affects Versions: 7.1.2.Final (EAP)
Reporter: Marko Strukelj
Assignee: Jean-Frederic Clere
In order to prevent leaking active transactions from processing of web requests a
TransactionRollbackSetupAction is installed by transactions subsystem for web subsystem to
use. This causes usecases where we want JTA TX to span different web apps over
cross-context includes to fail, as the setup action is applied around each cross-context
include, and forcefully rolls back any TX still active at the end of dispatching.
A concrete use case are portals that rely on cross-context includes.
Java EE Platform 6 Spec says the following in section EE.4.2.2:
"Returning from the service method to the network client with an active transaction
context is an error. The web container is required to detect this error and abort the
transaction.
As specified above in Section EE.4.2.1.2, “Transaction Non-Requirements,” requests made
within a web container using the RequestDispatcher must propagate any transaction context
to the called class. Unless the called class commits or aborts the transaction, the
transaction must remain active when the called class returns."
There is no talk here about cross-context includes or application boundaries. Therefore
it seems the current implementation is not spec-compliant.
TransactionRollbackSetupAction should only be applied on an original incoming web
request, not on each cross-context include.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira