-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WFLY-6215 Don't allow afterCompletion callbacks to happen when an inv… #8745
Conversation
} else if (state == SYNC_STATE_AFTER_COMPLETE_DELAYED) { | ||
try { | ||
//we know the transaction did not commit, as we are still active in the tx, this only happens through timeout | ||
handleAfterComplection(false, instance, toDiscard); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if it is relevant but should we comment that other SessionSynchronization callbacks will have run already in the background (tm reaper) thread?
retest this please |
break; | ||
} else if (state == SYNC_STATE_AFTER_COMPLETE_DELAYED) { | ||
try { | ||
//we know the transaction did not commit, as we are still active in the tx, this only happens through timeout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another possibility is that the transaction was manually acquired through some user code or framework and committed this way. I think it's at least more consistent to track the transaction outcome and report it, even if it is very likely always to be false.
With this solution it is possible for EJB invocations to be executed on a SFSB after the Tx has rolledback and afterCompletion has already been executed. Shouldn't we throw an EJBTransactionRolledbackException to the client in this situation? |
@ryanemerson I am not really sure what you mean? Can you elaborate on the scenario you are describing? |
@stuartwdouglas Consider the following: userTransaction.setTransactionTimeout(5);
userTransaction.begin();
sfsb.method1();
sfsb.method2();
.... In your solution, if the userTransaction timesout during I don't believe this is a violation of the specification, but I am not sure it is desirable behaviour. Would it not be better for |
If CMP is in use method1() will throw an exception when the CMP interceptor attempts to commit the transaction. If BMP is in use then an exception will not be thrown until the user attempts to do something transnational, which I think is the correct behaviour, even though in some cases it may be counter intuitive. We can't throw exceptions unless the spec actually requires it. |
@stuartwdouglas did you have a response or update to Scott and David's comments? I am thinking this would be an ideal 10.1 PR to merge. |
@stuartwdouglas ^^^ |
I'm not sure if WFLY-4923 is relevant to this change but also see my comments on #8731, which has the sync.afterCompletion callback check if the application has yet seen the transaction end, which is a hint as to whether the application thread or background reaper thread, should perform the afterCompletion action. |
@stuartwdouglas ping ^ |
…ocation is in progress
1bc3e0f
to
834347c
Compare
Linux failure looks like an unrelated remoting deadlock |
Retest this please |
…ocation is in progress