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

Backport 1.7.x: Add ability to customize some timeouts in MongoDB database plugin #11637

Merged
merged 1 commit into from
May 17, 2021

Conversation

pcman312
Copy link
Contributor

Backport to 1.7.x: #11600

This PR adds the ability to customize SocketTimeout, ConnectTimeout, and ServerSelectionTimeout within MongoDB connections. Vault passes these values to the MongoDB library when it makes a client connection.

This also makes some improvements around throughput. Previously, when an operation came to the plugin (creating/destroying a user, etc.), it would lock a mutex for the entirety of the operation. This resulted in the plugin forcing all requests to be single-threaded. This moves the mutex lock a bit lower in the plugin to try to limit its scope and allow multiple threads to be manipulating users at the same time. I did run a bunch of tests to try to produce races and didn't find any within the plugin code. However, I did find a race within the DB engine which I think is fixed in builtin/logical/database/path_rotate_credentials.go. The lock was being unlocked before the connection was being being closed & removed from the DBI map (b.connections). This probably wasn't a serious issue in practice as the map isn't changed in this manner very frequently.

@pcman312 pcman312 added this to the 1.7.2 milestone May 17, 2021
@pcman312 pcman312 merged commit fbff9bb into release/1.7.x May 17, 2021
@pcman312 pcman312 deleted the backport-11600-mongodb-timeouts-1.7.x branch May 17, 2021 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants