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

Do not include thread start time in test timeout measurements. #962

Merged
merged 1 commit into from
Jul 29, 2014

Conversation

chrisvest
Copy link
Contributor

The time it takes to start a thread can be surprisingly large.
Especially in virtualized cloud environments where noisy neighbours.
This change reduces the probability of non-deterministic failures of
tests with timeouts (@Test(timeout=…)) by not beginning the timeout
clock until we have observed the starting of the task thread – the
thread that runs the actual test. This should make tests with small
timeout values more reliable in general, and especially in cloud CI
environments.

No tests added for this because of the probabilistic nature of the
problem, and the small scope of the change.

The time it takes to start a thread can be surprisingly large.
Especially in virtualized cloud environments where noisy neighbours.
This change reduces the probability of non-deterministic failures of
tests with timeouts (`@Test(timeout=…)`) by not beginning the timeout
clock until we have observed the starting of the task thread – the
thread that runs the actual test. This should make tests with small
timeout values more reliable in general, and especially in cloud CI
environments.

No tests added for this because of the probabilistic nature of the
problem, and the small scope of the change.
@marcphilipp
Copy link
Member

LGTM!

@stefanbirkner Can you please take a look?

@stefanbirkner
Copy link
Contributor

The code LGTM, but I think we should not merge this pull request.

IMHO the purpose of the timeout is to terminate tests in case of an unexpected behaviour that would otherwise lead to a long running test. If you encounter trouble because a timeout terminates your test too early, then you should increase the timeout. This is no problem, because normally the timeout does not interrupt your test.

I know that the timeout can be used for performance tests. But I think that you should use some other mechanism for such tests, because JUnit gives you no guarantee about the test execution overhead that is part of the duration which is limited by the timeout.

@kcooney
Copy link
Member

kcooney commented Jul 28, 2014

@stefanbirkner while I can see your point, I don't see any actual disadvantages to merging this pull. Are there non-philosophical concerns?

@stefanbirkner
Copy link
Contributor

IMHO it adds complexity that is not needed. But I'm not dogmatic about it.

@kcooney
Copy link
Member

kcooney commented Jul 28, 2014

I think the added complexity is quite low, and I don't see how it can cause problems. It's possible that this change might slow down some tests due to the extra time waiting for the "parent" thread to be notified about the "child" thread starting, but I don't think it's a problem.

@dsaff do you have any thoughts?

@dsaff
Copy link
Member

dsaff commented Jul 29, 2014

I like the intent here, LGTM.

kcooney added a commit that referenced this pull request Jul 29, 2014
Do not include thread start time in test timeout measurements.
@kcooney kcooney merged commit be4cdb2 into junit-team:master Jul 29, 2014
@chrisvest chrisvest deleted the thread-start-timeout branch July 29, 2014 18:54
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

5 participants