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

thread leak in cucumber.runtime.Timeout class #639

Closed
volna80 opened this issue Dec 2, 2013 · 7 comments
Closed

thread leak in cucumber.runtime.Timeout class #639

volna80 opened this issue Dec 2, 2013 · 7 comments

Comments

@volna80
Copy link
Contributor

volna80 commented Dec 2, 2013

Hi,

If you set timeout for all your steps, and have a lot of scenarios. Cucucmber-jvm falls that it reaches the limit of running threads (the number is depend on OS).

The bug is in cucumber.runtime.Timeout class.

ScheduledFuture<?> timer = Executors.newSingleThreadScheduledExecutor().schedule(new Runnable() {

It creates every time new executor service, but never stop it.

As the result, the number of running threads is growing.

@aslakhellesoy
Copy link
Contributor

Ouch! Interested in sending a PR with a fix?

@volna80
Copy link
Contributor Author

volna80 commented Dec 2, 2013

Yep, will send it today

@ffbit
Copy link
Contributor

ffbit commented Dec 2, 2013

Great thread!
Could you please send us an instruction on how to reproduce the described case?
Thanks in advance.

@volna80
Copy link
Contributor Author

volna80 commented Dec 2, 2013

  1. define a step

@when(value = "do nothing", timeout = 60000)
public void doNothing(){
//do nothing
}

  1. write a lot of scenarios which use this step

When do nothing
When do nothing
.....
When do nothing

  1. run it using
    @RunWith(Cucumber.class)
    public class RunCukesTest {
    }

Result: Use any java profing and see that the number of live threads are growing

@aslakhellesoy
Copy link
Contributor

It's possible to count the number of threads with Thread.getAllStackTraces(). This could be leveraged in a test that counts the number of threads before and after and verifies that the number is the same.

@ffbit
Copy link
Contributor

ffbit commented Dec 2, 2013

Thanks for the clarification.

@lock
Copy link

lock bot commented Oct 25, 2018

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.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants