Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent IllegalStateException in test suite by avoiding concurrent access to resolvers #36

Open
fblundun opened this issue Sep 24, 2015 · 4 comments
Assignees
Labels

Comments

@fblundun
Copy link
Contributor

In build https://travis-ci.org/snowplow/iglu-scala-client/jobs/81756147

[error] ! a Resolver should report its failed lookups when a JSON Schema can't be resolved
[error]   IllegalStateException: Entry.next=null, data[removeIndex]=iglu:com.snowplowanalytics.self-desc/instance-iglu-only/jsonschema/1-0-0=Success({"$schema":"http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#","description":"Top-level schema for the validation process (Iglu-only)","self":{"vendor":"com.snowplowanalytics.self-desc","name":"instance-iglu-only","format":"jsonschema","version":"1-0-0"},"type":"object","properties":{"schema":{"type":"string","pattern":"^iglu:[a-zA-Z0-9-_.]+/[a-zA-Z0-9-_]+/[a-zA-Z0-9-_]+/[0-9]+-[0-9]+-[0-9]+$"},"data":{}},"required":["schema","data"],"additionalProperties":false}) previous=iglu:com.snowplowanalytics.self-desc/instance-iglu-only/jsonschema/1-0-0=Success({"$schema":"http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#","description":"Top-level schema for the validation process (Iglu-only)","self":{"vendor":"com.snowplowanalytics.self-desc","name":"instance-iglu-only","format":"jsonschema","version":"1-0-0"},"type":"object","properties":{"schema":{"type":"string","pattern":"^iglu:[a-zA-Z0-9-_.]+/[a-zA-Z0-9-_]+/[a-zA-Z0-9-_]+/[0-9]+-[0-9]+-[0-9]+$"},"data":{}},"required":["schema","data"],"additionalProperties":false}) key=iglu:com.acme.icarus/wing/jsonschema/1-0-0 value=Failure(NonEmptyList(error: Could not find schema with key iglu:com.acme.icarus/wing/jsonschema/1-0-0 in any repository, tried:
[error]     level: "error"
[error]     repositories: ["Iglu Test Embedded [embedded]","Iglu Client Embedded [embedded]"]
[error] )) size=10 maxSize=10 Please check that your keys are immutable, and that you have used synchronization properly. If so, then please report this to [email protected] as a bug. (LRUMap.java:301)
[error] org.apache.commons.collections.map.LRUMap.reuseMapping(LRUMap.java:301)
[error] org.apache.commons.collections.map.LRUMap.addMapping(LRUMap.java:267)
[error] org.apache.commons.collections.map.AbstractHashedMap.put(AbstractHashedMap.java:284)
[error] com.snowplowanalytics.iglu.client.Resolver$cache$$anonfun$store$1.apply(Resolver.scala:198)
[error] com.snowplowanalytics.iglu.client.Resolver$cache$$anonfun$store$1.apply(Resolver.scala:197)
[error] com.snowplowanalytics.iglu.client.Resolver$cache$.store(Resolver.scala:197)
[error] com.snowplowanalytics.iglu.client.Resolver.recurse$1(Resolver.scala:234)
[error] com.snowplowanalytics.iglu.client.Resolver.lookupSchema(Resolver.scala:247)
[error] com.snowplowanalytics.iglu.client.ResolverSpec.e3(ResolverSpec.scala:131)
[error] com.snowplowanalytics.iglu.client.ResolverSpec$$anonfun$is$1$$anonfun$apply$1$$anonfun$apply$7.apply(ResolverSpec.scala:72)
[error] com.snowplowanalytics.iglu.client.ResolverSpec$$anonfun$is$1$$anonfun$apply$1$$anonfun$apply$7.apply(ResolverSpec.scala:72)
@fblundun fblundun added this to the Version 0.4.0 milestone Sep 24, 2015
@fblundun fblundun added the bug label Sep 24, 2015
@fblundun
Copy link
Contributor Author

sbt runs tests in parallel, so multiple threads can simultaneously access the TestResolver here and so simultaneously access its LRUCache, which is not thread-safe.

@fblundun
Copy link
Contributor Author

This would be resolved by #28 but for now we can just create a new TestResolver whenever we need it.

@fblundun fblundun changed the title Understand IllegalStateException in Travis build Prevent IllegalStateException in test suite by avoiding concurrent access to resolvers Sep 24, 2015
@fblundun fblundun modified the milestones: Version 0.3.1, Version 0.4.0 Sep 24, 2015
@fblundun fblundun self-assigned this Sep 24, 2015
@fblundun
Copy link
Contributor Author

Actually, parallel execution in tests seems to be set to false here.

    parallelExecution in Test := false, // Parallel tests cause havoc with LRU cache

I don't know what else could have gone wrong - the keys are definitely immutable.

@alexanderdean
Copy link
Member

Pushing back...

@chuwy chuwy modified the milestones: Version 0.5.0, Version 0.6.0 Jan 24, 2017
@chuwy chuwy removed this from the Version 0.6.0 milestone Aug 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants