Skip to content
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

Full thread stack dump on timeout with custom handler #770

Conversation

reinholdfuereder
Copy link
Contributor

This is an attempt to start addressing: #463 Add ability for timeout to print full thread stack dump

  • Another attempt that allows to "install" an additional custom timeout handler that can optionally also add a further exception to the test timeout exception

=> Extending the initial rudimentary attempt of #768 to allow "installing" an additional custom timeout handler (that can optionally also add a further exception to the test timeout exception) by a globally set custom timeout handler based on a system property, that is instantiated via reflection.

This custom timeout handler is also desirable to overcome the Java 1.5 compatibility requirement of JUnit, so any default timeout handler bundled with JUnit needs to adhere to this compatibility too: but quite some interesting thread dump information (locks, monitors, synchronizers) can only be retrieved from ThreadMXBean from Java >= 1.6, I think.

(Note one self test still fails in Ant context, but not in Eclipse though -- why is that the case? can it be the parallel usage of a test case timeout via annotation attribute and the global test class timeout via rule kind of interfere? but why is it then working in Eclipse?)

Deadlocked threads of self tests are not surviving anymore (fixed in a subsequent commit; in contrast to some infinite loop running threads from other self tests...
=> In order to fix that and allow full thread stack dump in custom handler, the interrupting of the test thread was moved slightly down.

What do you think of that approach?

junit-team#463 Add ability for timeout to print full thread stack dump
- Another attempt that allows to "install" an additional custom timeout handler that can optionally also add a further exception to the test timeout exception
junit-team#463 Add ability for timeout to print full thread stack dump
- Another attempt that allows to "install" an additional custom timeout handler that can optionally also add a further exception to the test timeout exception
- Fix: remove outdated TODO comment
junit-team#463 Add ability for timeout to print full thread stack dump
- Extend the attempt that allows to "install" an additional custom timeout handler (that can optionally also add a further exception to the test timeout exception) by a globally set custom timeout handler based on a system property: note this fails in Ant context; and deadlocked threads of self tests are surviving; so this is by no means finished
junit-team#463 Add ability for timeout to print full thread stack dump
- Ref tests and where the test thread is interrupted to prevent surviving threads (as it is the case for other older tests!), reduce duplication in test code
@kcooney
Copy link
Member

kcooney commented Sep 18, 2016

(doing a pass at closing old pull requests)

I'm closing this and the related thread. I think we generally agree that we need to take a step back before making changes to see what the goals are, and if there is a simpler way to accomplish them

@kcooney kcooney closed this Sep 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants