Skip to content

Prevent deadlocks resulting from errors thrown before releasing mutex - #195

Merged
Gudahtt merged 1 commit into
developfrom
prevent-deadlocks
Jan 24, 2020
Merged

Gudahtt merged 1 commit into
developfrom
prevent-deadlocks

Conversation

@Gudahtt

@Gudahtt Gudahtt commented Jan 24, 2020

Copy link
Copy Markdown
Member

A try ... finally block has been added to most places where a mutex is used, to ensure that any error thrown before the lock has been released will not result in a deadlock.

The finally block will execute after the try block, but it will not interfere with any returned values or thrown errors (so long as nothing is thrown or returned within the finally block).

@rekmarks rekmarks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

This is a really important change.

A `try ... finally` block has been added to most places where a mutex
is used, to ensure that any error thrown before the lock has been
released will not result in a deadlock.

The `finally` block will execute after the `try` block, but it will
not interfere with any returned values or thrown errors (so long as
nothing is thrown or returned within the `finally` block).

@estebanmino estebanmino left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

@whymarrh whymarrh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Split diff with no whitespace changes is the real MVP here:

Diff settings on GitHub, show split diff selected with whitespace changes hidden

@rekmarks

Copy link
Copy Markdown
Contributor

Split diff with no whitespace changes is the real MVP here:

/giphy gandalf crying

@Gudahtt
Gudahtt merged commit 984ab10 into develop Jan 24, 2020
@Gudahtt
Gudahtt deleted the prevent-deadlocks branch January 24, 2020 20:48
whymarrh pushed a commit to whymarrh/gaba that referenced this pull request Jan 24, 2020
…MetaMask#195)

A `try ... finally` block has been added to most places where a mutex
is used, to ensure that any error thrown before the lock has been
released will not result in a deadlock.

The `finally` block will execute after the `try` block, but it will
not interfere with any returned values or thrown errors (so long as
nothing is thrown or returned within the `finally` block).
@whymarrh whymarrh mentioned this pull request Jan 24, 2020
Mrtenz pushed a commit that referenced this pull request Oct 16, 2025
Bumps [@metamask/utils](https://github.com/MetaMask/utils) from 3.4.1 to 3.5.0.
- [Release notes](https://github.com/MetaMask/utils/releases)
- [Changelog](https://github.com/MetaMask/utils/blob/main/CHANGELOG.md)
- [Commits](MetaMask/utils@v3.4.1...v3.5.0)

---
updated-dependencies:
- dependency-name: "@metamask/utils"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Mrtenz pushed a commit to Mrtenz/core that referenced this pull request Jun 17, 2026
Naz-Ovh pushed a commit to 0x-fork/metamask-core that referenced this pull request Nov 7, 2026
The `ethereumjs-util` library has been updated. Some methods which were
just re-exported from `ethjs-util` are now used directly because v6 of
`ethereumjs-util` omits those functions from its type definitions.

The v6 version of `toBuffer` no longer accepts non-hex-prefixed
strings, so a private `legacyToBuffer` function has been created to
convert values in the same manner as v5 used to. Non-hex-prefixed
strings are converted using `Buffer.from`.
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.

4 participants