gintool / gin

GI in No Time - a Simple Microframework for Genetic Improvement
MIT License
43 stars 20 forks source link

Fix for the "hanging threads" issue #48

Closed GiovaniGuizzo closed 3 years ago

GiovaniGuizzo commented 3 years ago

This pull request fixes the "hanging threads" problem with the internal JUnitRunner. In my experiments, the threads with infinite loops would hang forever and keep executing (also consuming a single core each) even after timed out by JUnit.

With this fix, at the end of each test run, first the code checks for any existing Thread that was not there before executing the test, and then queues it up for interruption. I also added some debug logs (not outputted by default).

OBS: on my last PullRequest #47, I forgot to add another CacheClassLoader closing code in a super class. Here it is now.

justynapt commented 3 years ago

H Giovnai, thank you and yes, we are aware of this issue, hence we implemented the ExternalTestRunner. Firstly, we don't want to use thread.stop(), as it's been deprecated some time ago. Secondly, we opted for the ExternalTestRunner option as we encountered tests with concurrency issues so issuing interrupt doesn't necessarily stop the thread either. Hence we opted for the warning.

GiovaniGuizzo commented 3 years ago

Ohhh, I see. No worries, then. I guess I'll have to use the external runner then.

I'm closing this pull request.