Skip to content

ConfigurationLoader isn't thread safe due to its use of ConfigSlurper #423

@schillingr

Description

@schillingr

Running Specifications using 1 thread per spec results in seemingly random failures when loading GebConfig.groovy. With 5 threads I rarely saw the issue, but over 5 I was able to reproduce roughly 50% of the time.

In debugging the issue it seems that ConfigSlurper itself is not thread-safe when used on a Class. I made a quick project that demonstrates the problem. You may need to run the test multiple times to have it fail, but eventually it will.

https://github.com/schillingr/groovy-configslurper-not-thread-safe

I solved this locally by placing a synchronized block around the ConfigurationLoader call in GebSpec which I'm running tests on now.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions