guava icon indicating copy to clipboard operation
guava copied to clipboard

Lingering threads in multiple tests

Open aoli-al opened this issue 1 year ago • 2 comments

Guava Version

514f212777da34df57fb9ce875ce77948bf95473

Description

While running Guava tests, I noticed multiple threads created by different tests that were left open.

Here is the incomplete list:

The thread pool was opened here, but the shutdown was not called.

https://github.com/google/guava/blob/514f212777da34df57fb9ce875ce77948bf95473/guava-tests/test/com/google/common/cache/CacheBuilderTest.java#L496

In FuturesTest.java, multiple tests call newSingleThreadExecutor() without shutdown.

https://github.com/google/guava/blob/514f212777da34df57fb9ce875ce77948bf95473/guava-tests/test/com/google/common/util/concurrent/FuturesTest.java#L444

In TestThread.java, calling stop() may throw UnsupportedOperationException for the new version of Java. Thus, the join method will not be called. (maybe call interrupt when stop is not available?)

https://github.com/google/guava/blob/514f212777da34df57fb9ce875ce77948bf95473/guava-tests/test/com/google/common/util/concurrent/TestThread.java#L76

Example

Any test mentioned above.

Expected Behavior

The test should clean up threads.

Actual Behavior

Threads left open.

Packages

No response

Platforms

No response

Checklist

  • [X] I agree to follow the code of conduct.

  • [X] I can reproduce the bug with the latest version of Guava available.

aoli-al avatar Jul 19 '24 21:07 aoli-al