JetBrains / lincheck

Framework for testing concurrent data structures
Mozilla Public License 2.0
576 stars 33 forks source link

Threads are not killed after completing tests with deadlocks found with locks #199

Closed avpotapov00 closed 8 months ago

avpotapov00 commented 1 year ago

When running all tests suite, after test DeadlockOnSynchronizedTest passed, we observe increased number of threads in the system. (see picture and dump from TeamCity)

image

dump.txt

avpotapov00 commented 1 year ago

It seems that problem in synchronized block contract: it won't be interrupted by calling .interrupt(). Furthermore, if we invoked.stop(), ThreadDeath error won't interrupt synchronized block too.

avpotapov00 commented 1 year ago

As a result, after test with deadlocks on synchronized we have many threads in BLOCKING state, holding resources and slowing down further execution.

ndkoval commented 1 year ago

@avpotapov00, would ThreadDeath interrupt the thread if it were parked via LockSupport.part()?

ndkoval commented 8 months ago

We can't do much about that. As #214 mentions, a possible solution for us would be to run such "bad" tests (that produce hanging threads) in separate VMs.