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
[#163] shutdown thread may point to a wrong process #164
Conversation
hi @jamezp , do you think this fix could be considered for merging? |
Sorry @ochaloup. I've been meaning to look at this and haven't had a change. Have you seen this issue happen or do you have a way to reproduce it? To my knowledge these were not meant to be thread safe, but if they need to be we need to fully analyze as I can see some other issues as well. |
@jamezp I see. I focused only on this one issue as I was struggling with it. I haven't deep dived to other code parts to help with the analysis. The whole context is that I now realized that transaction related testsuites need to workaround this deficit of Arquillian for the time being. These testsuites often use Byteman to kill the container in the background. Then later we have to ask Arquillian to start the killed container again to run transaction recovery and to check if transactions are recovered. E.g. JBoss EAP transaction recovery testsuite workarouned it and the Narayana testsuite as well. There is created an extension which changes the With issue JBEAP-19408/WFLY-13516 I needed to add a new test with the similar behaviour to WildFly testsuite - app conainer is JVM crashed at particular time and then restarted and transaction recovery should fix the transaction state of the app after restart. For now this issue could be verified with the WFLY testsuite where I added one test: https://github.com/wildfly/wildfly/blob/20.0.0.Final/testsuite/integration/manualmode/src/test/java/org/jboss/as/test/manualmode/ejb/client/outbound/connection/transaction/preparehalt/TransactionPropagationPrepareHaltTestCase.java#L180 As I need to add more tests (https://issues.redhat.com/browse/WFLY-13578) to this particular class I was concerned about it. I was just thinking that such extension would not be needed if the Arquillian would be handling the container kill with the thread safely. |
@ochaloup I think I understand what you're trying to do. Your concern seems to be that during stop a start may be invoked while a stop is already executing which could be a race. I'm not sure if base Arquillian containers are meant to be thread-safe or not. If they are we need to make it thread-safe we may be able to, but I'll need to review all the code. Is this something you'd like me to look at or have you found a workaround? |
@jamezp my idea was to provide the fix which is here in the PR. The point is to just not sharing the same variable as the 'process' holder. That would work for the later use and make me a chance for not using any workaround. If the change in this PR is not a) right, b) appropriate as a single change in area of complex issue or c) may cause some backward compatibility issues, then just let's close this PR and probably the issue #163 as well. |
@ochaloup My concern is it seems like a workaround for a use case that shouldn't be used. What I mean is I guess my concern is that if stop is completed the thread should be interrupted and stopped. So start must be getting called while the stop method is still executing. |
@jamezp but the The To be honest, I can't find how attaching the |
Got it. Thanks for the detailed answer @ochaloup. I was missing the part where the thread was not interrupted :) TBH I kind of wonder if we should just remove the thread all together and just use something like:
|
@jamezp I see, that should fine (at least from the usecase perspective I have where I want to start the second container as soon as possible, as the |
@ochaloup I'm happy to throw up a PR if you'd like or feel free to update this or close it and open a new one. If you'd like me to do it I'll at all the places where this pattern may be used. |
@jamezp ok. I'm fine to close this and leave with you ;-) I would not be able to cover all the places where the fix is needed (at least for sure not for the first time). |
fixes #163