Reputation: 816
I've run into some oddities with classloaders and specs2 3.8.7+. Because the classloader is seemingly managed by sbt, I'm asking about sbt's behavior specifically here.
I've put up a sample project demonstrating the issue at hand on Github at
Shadowfiend/specs2-concurrent-boom-boom . As observed, the problem is that
if I run all project1/test project2/test
, project2 can end up using a thread context classloader
that is a ClasspathFilter
referencing project1 instead of project2, or vice versa.
In some cases, project 1's worker will reference project 2's ClasspathFilter
and
project 2's worker will reference project 1's ClasspathFilter
, all at the same time.
I inserted some breakpoints in a few places and saw that only one ForkJoinPool
is actually generated for specs2, even when running all project1/test project2/test
,
even with fork := true. Not 100% sure if all threads in that pool will in turn end
up with the same classloader parent or what, but it seems like it could be the
source of the issue?
I'm a bit out of my depth here, but would appreciate any insight as to the expected interactions between classloaders in sbt and test frameworks spawned by sbt.
Upvotes: 3
Views: 127