Skip to content

Backport 1.6: fix deadlock on core state lock#10523

Merged
ncabatoff merged 2 commits into
release/1.6.xfrom
backport-pr-10456-1.6
Dec 10, 2020
Merged

Backport 1.6: fix deadlock on core state lock#10523
ncabatoff merged 2 commits into
release/1.6.xfrom
backport-pr-10456-1.6

Conversation

@ncabatoff
Copy link
Copy Markdown
Collaborator

No description provided.

Seth Bunce and others added 2 commits December 10, 2020 06:57
* fix race that can cause deadlock on core state lock

The bug is in the grabLockOrStop function. For specific concurrent
executions the grabLockOrStop function can return stopped=true when
the lock is still held. A comment in grabLockOrStop indicates that the
function is only used when the stateLock is held, but grabLockOrStop is
being used to acquire the stateLock. If there are concurrent goroutines
using grabLockOrStop then some concurrent executions result in
stopped=true being returned when the lock is acquired.

The fix is to add a lock and some state around which the parent and
child goroutine in the grabLockOrStop function can coordinate so that
the different concurrent executions can be handled.

This change includes a non-deterministic unit test which reliably
reproduces the problem before the fix.

* use rand instead of time for random test stopCh close

Using time.Now().UnixNano()%2 ends up being system dependent because
different operating systems and hardware have different clock
resolution. A lower resolution will return the same unix time for a
longer period of time.

It is better to avoid this issue by using a random number generator.
This change uses the rand package default random number generator. It's
generally good to avoid using the default random number generator,
because it creates extra lock contention. For a test it should be fine.
@ncabatoff ncabatoff added this to the 1.6.1 milestone Dec 10, 2020
@ncabatoff ncabatoff merged commit 1c1bd18 into release/1.6.x Dec 10, 2020
@ncabatoff ncabatoff deleted the backport-pr-10456-1.6 branch December 10, 2020 17:56
tsaarni pushed a commit to Nordix/vault that referenced this pull request Nov 18, 2025
…icorp#10523)

* [UI] Ember Data Migration - PKI Config Setup (hashicorp#10320)

* adds api and capabilities services to pki engine

* updates eslintrc to ignore rest siblings for no-unused-vars rule

* adds ember-template-lint to pki engine

* updates check-issuers decorator to use api service

* adds constants for pki capabilities paths

* updates pki configuration route to use api service and fetch capabilities

* [UI] Ember Data Migration - PKI Config Generate Form (hashicorp#10322)

* updates form class data object to tracked

* adds isNot validator

* updates tsconfig to resolve json modules

* updates open-api form class to use the spec file rather than help response for form field/group generation

* adds pki config generate form

* [UI] Ember Data Migration - PKI Config Create (hashicorp#10331)

* updates pki configure create route and component

* updates pki generate csr component to use api service and form class

* updates pki generate root component to use api service and form class

* updates pki import bundle component to use api service

* [UI] Ember Data Migration - PKI Config Generate Sub Components (hashicorp#10332)

* updates pki generate toggle groups component to support form class

* updates pki key parameters component to support form class

* updates pki generate immediate component based on csr component changes

* updates pki generate root component based on root component changes

* more pki config sub component updates

* updates pki issuer rotate root component to use api serivce and form

* updates pki acceptance tests (hashicorp#10341)

* [UI] Ember Data Migration - PKI Configuration Edit (hashicorp#10339)

* adds forms for pki config acme, cluster, crl and urls

* updates pki config edit worflow to use api service and forms

* updates pki config details workflow to use api service (hashicorp#10340)

* updates auth configure section route to pass schema key to OpenApiForm constructor

Co-authored-by: Jordan Reimer <zofskeez@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants