-
-
Notifications
You must be signed in to change notification settings - Fork 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
Timeout stops threads if they are uninterruptible. #811
Conversation
If a thread does not respond to interrupt() we'll try to stop() it after twice the specified timeout. This uses the deprecated Thread.stop() method, but for a testing tool like Cucumber that should be ok. Ref #343.
@brasmusson @os97673 let me know what you think about this approach to deal with the situation described in #343. Acceptable? |
True the junit and testng solution works, but if I have a scenario in witch I know how much time a request should work then... I don't want that increased to double the timeout |
@paul8620 please send your fix in a pull request. The code you pasted doesn't seem to solve the problem, |
So the infinite loop without any sleep or anything in there is a terrible thing, that will spin so tightly it'll use up 100% of all the CPU on any system. There's some flaws in there... |
@dkowis yes it's a terrible thing, and cucumber should be able to time out terrible things like that. junit can. Try this: @Test(timeout = 20)
public void yep() {
while(true);
} |
I can't say I'm that familiar with all the intricate details of the thread handling in Java. This post makes a strong case that It seems like not even |
I'm not a fan of using |
JUnit uses |
If we want to do things the junit way then it seems to me that the timeout is done at the wrong level. We should start a worker thread for the calls in If the Pickle refused to die the worker thread it is on can then safely be left to spin while the main thread continues with the next Pickle. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
If a thread does not respond to interrupt() we'll
try to stop() it after twice the specified timeout.
This uses the deprecated Thread.stop() method, but
for a testing tool like Cucumber that should be ok.
Ref #343.