Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Race-condition on DeployDynamoDBLocal in multi-subproject builds #54

Open
rtyley opened this issue Oct 11, 2019 · 0 comments
Open

Race-condition on DeployDynamoDBLocal in multi-subproject builds #54

rtyley opened this issue Oct 11, 2019 · 0 comments

Comments

@rtyley
Copy link

rtyley commented Oct 11, 2019

We've been using the 'different port for each subproject' strategy described in #53, but have noticed that there's a race-condition on the deploy-dynamodb-local task.

  • With sbt running subproject A & B simultaneously, both threads see there is no dynamodb-local folder in the root of the project, and start downloading the tar file from S3
  • Project A completes the download first, and begins extracting all files from the archive...
  • Project B completes the download second- at this point it may briefly corrupt or delete the file that Project A has downloaded before replacing it with an identical copy.
  • Project A is now extracting files from a corrupt archive, and racing with B to extract all the correct files to the folder
  • Typically, the DynamoDBLocal_lib folder ends up containing only a subset of the required jar files, possibly with a jar corrupted as well.
  • When the DynamoDBLocal server runs, it will typically give a java.lang.ClassNotFoundException, and then never ever successfully start, resulting in behaviour like that seen in Startup process hangs infinitely #50
Port:   8043
InMemory:       true
DbPath: null
SharedDb:       false
shouldDelayTransientStatuses:odbfalse 0s
CorsParams:lab /*Test / executeTests 1s
  | => sharedLib / startDynamodbLocal 3s
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/logging/log4j/spi/ExtendedLogger
	at com.amazonaws.services.dynamodbv2.local.shared.logging.LogManager.<clinit>(LogManager.java:28)
	at com.amazonaws.services.dynamodbv2.local.server.DynamoDBProxyServer.<clinit>(DynamoDBProxyServer.java:36)
	at com.amazonaws.services.dynamodbv2.local.main.ServerRunner.createServer(ServerRunner.java:120)
	at com.amazonaws.services.dynamodbv2.local.main.ServerRunner.createServerFromCommandLineArgs(ServerRunner.java:116)
	at com.amazonaws.services.dynamodbv2.local.main.ServerRunner.main(ServerRunner.java:71)
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.spi.ExtendedLogger
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 5 more

It's a particular stumbling block for new-starters on our team as it the first thing they encounter when they're trying to run our tests!

I guess fix for this would probably involve downloading & extracting the resources to a temporary location before doing a quick move of the dynamodb-local folder into the right place.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant