fix: prevent race condition in tar extraction with install marker#59
Open
abhu85 wants to merge 1 commit into
Open
fix: prevent race condition in tar extraction with install marker#59abhu85 wants to merge 1 commit into
abhu85 wants to merge 1 commit into
Conversation
The previous implementation only checked for the presence of the jar file to determine if installation was complete. This could lead to issues when: 1. A previous download/extraction was interrupted (network timeout, process exit, slow disk) 2. The jar file exists but DynamoDBLocal_lib is incomplete 3. The extraction completed for tar events but disk writes are pending This fix: - Adds a marker file (.dynamodb-local-install-complete) that is only created after successful extraction - Checks for both the jar file AND marker file before skipping install - Cleans up incomplete installations before re-downloading - Verifies the jar file exists before creating the marker Fixes rynop#50 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #50 - Adds an installation marker file to ensure tar extraction completed successfully before returning.
Problem
The previous implementation only checked for the presence of
DynamoDBLocal.jarto determine if installation was complete. This caused intermittent failures when:DynamoDBLocal_lib/directory is incompleteUsers reported errors like "Invalid or corrupt jarfile DynamoDBLocal.jar" (#30) and "Unable to initialize main class" (#38) due to incomplete installations being used.
Solution
.dynamodb-local-install-completeonly after extraction is verified successfulChanges
INSTALL_MARKERconstant for the marker filenameinstallDynamoDbLocal()to check for both jar and markerfs.rmSync()onExtractionComplete()handler that verifies and creates marker{ recursive: true }for directory creationTest plan
Notes
Existing users will re-download DynamoDB Local once after this update (since marker file won't exist), but this is a one-time cost that ensures installation integrity.