Skip to content

TraceableExecutorService does not terminate tests when wrapping the ForkJoinPool.commonPool() #2291

@TheBestPessimist

Description

@TheBestPessimist

Describe the bug
When wrapping ForkJoinPool.commonPool() and running tests, the tests do not finish because the pool does not shut down.

sample code:

@Configuration
class CaffeineExecutorFactory {
	@Bean("caffeineExecutor")
	fun caffeineExecutor(beanFactory: BeanFactory): ExecutorService {
		println("created")
        return TraceableExecutorService.wrap(beanFactory, ForkJoinPool.commonPool()) // ❌ when running the tests, the tests do not finish because the pull does not shut down
	}
}

It seems we're stuck inside TraceableExecutorService.close, because ForkJoinPool.awaitTermination always returns false.
image

Sample
demo.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions