8000 potential race condition between creating and dropping collections · Issue #194 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

potential race condition between creating and dropping collections #194

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

Closed
jsteemann opened this issue Sep 11, 2012 · 2 comments
Closed
Assignees
Labels

Comments

@jsteemann
Copy link
Contributor

When a collection is created, the collection is entered with its name in the hash table vocbase->_collectionsByName.
When a collection is dropped, the collection is first removed from the hash table, and then its parameter file (parameter.json) is updated with the new collection status (i.e. "deleted"). This happens in vocbase.c:TRI_DropCollectionVocBase.

The problem is that the collection is removed from the hash and the parameter file is changed at some point after that. Before the parameter file can be changed, a write-lock on the collection must be acquired. If the server must wait for the write-lock because of concurrent read operations, a concurrent thread can create a collection with the same name.
Deletion from the hash and changing the parameter file are not atomic and be interrupted by other actions.

If a concurrent thread manages to create a collection with the same name in between, this will lead to ambiguities, and if the server is stopped before the parameter file is written to disk (e.g. because it's still waiting for the write lock), the database directory will contain two collections with identical values in the "name" attributes in the parameter files, and both with the "deleted" attribute being false. The server will then fail on startup with error message "duplicate entry for name..." in vocbase.c:AddCollection.

@jsteemann
Copy link
Contributor Author

fixed in 1.0 and devel. awaiting pull to master

@ghost ghost assigned fceller Sep 12, 2012
@fceller
Copy link
Contributor
fceller commented Sep 19, 2012

Merge to master

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

2 participants
0