-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Hook before timeout exception is started by calling interrupt() #2938
Comments
Can you please add more information how your pom file looks like, which Maven versions, JDK version etc. you are using... Also which surefire-plugin versions etc. ? |
maven 3.8.6, To make the problem perhaps even better understandable... Hence I think it would be very helpful to have a hook that runs just before the The location of the interrupt call is meanwhile here: https://github.com/junit-team/junit5/blob/main/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/SameThreadTimeoutInvocation.java#L79 |
+1 here This is not Maven-specific. Something like Here is a proposed solution: https://stackoverflow.com/a/73156213/350428 Integrating this directly into JUnit itself would make it accessible to a much wider audience. |
Team decision: Add a |
@frankbenoit Would you be interested in submitting a PR for this? |
@marcphilipp no, sorry, not at the moment |
Added PreInterruptCallback extension to allow to hook into the @timeout extension before the executing Thread is interrupted. The default implementation of PreInterruptCallback will simply print the stacks of all Thread to System.out. It is disabled by default and must be enabled with: junit.jupiter.extensions.preinterruptcallback.default.enabled = true Issue: junit-team#2938
@marcphilipp I have created the PR #3431, which would add the |
Added PreInterruptCallback extension to allow to hook into the @timeout extension before the executing Thread is interrupted. The default implementation of PreInterruptCallback will simply print the stacks of all Thread to System.out. It is disabled by default and must be enabled with: junit.jupiter.extensions.preinterruptcallback.default.enabled = true Issue: junit-team#2938
Added PreInterruptCallback extension to allow to hook into the @timeout extension before the executing Thread is interrupted. The default implementation of PreInterruptCallback will simply print the stacks of all Thread to System.out. It is disabled by default and must be enabled with: junit.jupiter.extensions.preinterruptcallback.default.enabled = true Issue: junit-team#2938
@AndreasTu Hey, are you continuing working on this? If not, would you be alright with me picking it up and finishing off that PR, as there are a few conflicts on the PR from being dormant for a while. |
@PhilipIngham I am still waiting on feedback or a review of my code by anyone :) |
I'm happy with those changes :) |
Added PreInterruptCallback extension to allow to hook into the @timeout extension before the executing Thread is interrupted. The default implementation of PreInterruptCallback will simply print the stacks of all Thread to System.err. It is disabled by default and must be enabled with: junit.jupiter.execution.timeout.threaddump.enabled = true Issue: junit-team#2938
Added PreInterruptCallback extension to allow to hook into the @timeout extension before the executing Thread is interrupted. The default implementation of PreInterruptCallback will simply print the stacks of all Thread to System.out. It is disabled by default and must be enabled with: junit.jupiter.execution.timeout.threaddump.enabled = true Issue: junit-team#2938
Added PreInterruptCallback extension to allow to hook into the @timeout extension before the executing Thread is interrupted. The default implementation of PreInterruptCallback will simply print the stacks of all Thread to System.out. It is disabled by default and must be enabled with: junit.jupiter.execution.timeout.threaddump.enabled = true Issue: junit-team#2938 Co-authored-by: Marc Philipp <[email protected]>
Added PreInterruptCallback extension to allow to hook into the @timeout extension before the executing Thread is interrupted. The default implementation of PreInterruptCallback will simply print the stacks of all Thread to System.out. It is disabled by default and must be enabled with: junit.jupiter.execution.timeout.threaddump.enabled = true Issue: junit-team#2938 Co-authored-by: Marc Philipp <[email protected]>
Added PreInterruptCallback extension to allow to hook into the @timeout extension before the executing Thread is interrupted. The default implementation of PreInterruptCallback will simply print the stacks of all Thread to System.out. It is disabled by default and must be enabled with: junit.jupiter.execution.timeout.threaddump.enabled = true Issue: junit-team#2938 Co-authored-by: Marc Philipp <[email protected]>
Added PreInterruptCallback extension to allow to hook into the @timeout extension before the executing Thread is interrupted. The default implementation of PreInterruptCallback will simply print the stacks of all Thread to System.out. It is disabled by default and must be enabled with: junit.jupiter.execution.timeout.threaddump.enabled = true Issue: junit-team#2938 Co-authored-by: Marc Philipp <[email protected]>
Added PreInterruptCallback extension to allow to hook into the @timeout extension before the executing Thread is interrupted. The default implementation of PreInterruptCallback will simply print the stacks of all Thread to System.out. It is disabled by default and must be enabled with: junit.jupiter.execution.timeout.threaddump.enabled = true Issue: junit-team#2938 Co-authored-by: Marc Philipp <[email protected]>
The problem: When having sporadic timeout exceptions, it is hard to tell from the stacktrace where the code was hanging.
A debugger might not be available (sporadic, on build system)
Also the stackdump of other threads might be very helpful, because the timeout might be caused by other threads activity or dead lock.
An own extension seems to be not reasonable, as the timeout control also from maven, is part of the infrastructure.
Deliverables
thread.interrupt()
is called in org.junit.jupiter.engine.extension.TimeoutInvocation.InterruptTask.run().The text was updated successfully, but these errors were encountered: