Skip to content

Conversation

skeees
Copy link
Contributor

@skeees skeees commented Aug 26, 2018

Resolves thread sanitizer failure @MarcoFalke found in #14058

@maflcko maflcko changed the title Use assert not BOOST_CHECK_* from multithreaded tests qa: Use assert not BOOST_CHECK_* from multithreaded tests Aug 26, 2018
@maflcko maflcko added the Tests label Aug 26, 2018
@maflcko maflcko added this to the 0.17.0 milestone Aug 26, 2018
@maflcko maflcko merged commit 737670c into bitcoin:master Aug 26, 2018
maflcko pushed a commit that referenced this pull request Aug 26, 2018
737670c Use assert when running from multithreaded code as BOOST_CHECK_* are not thread safe (Jesse Cohen)

Pull request description:

  Resolves thread sanitizer failure @MarcoFalke found in #14058

Tree-SHA512: 24d86c2cdae21fee029ee4b06f633de4b3e655d3371d97f09db6fd3f24b29388a78110996712249c49e7fefa7bbc3d3c405d8b480382174831fe2f9a042a557e
maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Aug 27, 2018
@@ -138,11 +138,11 @@ BOOST_AUTO_TEST_CASE(singlethreadedscheduler_ordered)
// the callbacks should run in exactly the order in which they were enqueued
for (int i = 0; i < 100; ++i) {
queue1.AddToProcessQueue([i, &counter1]() {
BOOST_CHECK_EQUAL(i, counter1++);
assert(i == counter1++);
Copy link
Contributor

Choose a reason for hiding this comment

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

Side effect in assertion: Fixed in #14088. Please review :-)

laanwj added a commit that referenced this pull request Aug 31, 2018
ca1a093 Add regression test: Don't assert(...) with side effects (practicalswift)
4c3c9c3 Don't assert(...) with side effects (practicalswift)

Pull request description:

  Don't `assert(...)` with side effects.

  From the developer notes:

  > **Assertions should not have side-effects**
  >
  > Rationale: Even though the source code is set to refuse to compile with assertions disabled, having side-effects in assertions is unexpected and makes the code harder to understand

  These assertions were introduced quite recently (in #14069 which was merged two days ago) and since this is a recurring thing (see #13534 – "Don't assert(foo()) where foo() has side effects" from May) I added a simple regression test for the most obvious common side effect.

Tree-SHA512: be65db9d8d5d0f5752152ba73fe3fbb0531880f156d3cd7dfdf1752709979b63214e46ae64b1adbe1e09fa121278f4087f4ae49bff16cf8f5aec16ea6bde3650
HashUnlimited pushed a commit to HashUnlimited/chaincoin that referenced this pull request Sep 14, 2018
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 27, 2021
…ded tests

737670c Use assert when running from multithreaded code as BOOST_CHECK_* are not thread safe (Jesse Cohen)

Pull request description:

  Resolves thread sanitizer failure @MarcoFalke found in bitcoin#14058

Tree-SHA512: 24d86c2cdae21fee029ee4b06f633de4b3e655d3371d97f09db6fd3f24b29388a78110996712249c49e7fefa7bbc3d3c405d8b480382174831fe2f9a042a557e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 27, 2021
ca1a093 Add regression test: Don't assert(...) with side effects (practicalswift)
4c3c9c3 Don't assert(...) with side effects (practicalswift)

Pull request description:

  Don't `assert(...)` with side effects.

  From the developer notes:

  > **Assertions should not have side-effects**
  >
  > Rationale: Even though the source code is set to refuse to compile with assertions disabled, having side-effects in assertions is unexpected and makes the code harder to understand

  These assertions were introduced quite recently (in bitcoin#14069 which was merged two days ago) and since this is a recurring thing (see bitcoin#13534 – "Don't assert(foo()) where foo() has side effects" from May) I added a simple regression test for the most obvious common side effect.

Tree-SHA512: be65db9d8d5d0f5752152ba73fe3fbb0531880f156d3cd7dfdf1752709979b63214e46ae64b1adbe1e09fa121278f4087f4ae49bff16cf8f5aec16ea6bde3650
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 28, 2021
…ded tests

737670c Use assert when running from multithreaded code as BOOST_CHECK_* are not thread safe (Jesse Cohen)

Pull request description:

  Resolves thread sanitizer failure @MarcoFalke found in bitcoin#14058

Tree-SHA512: 24d86c2cdae21fee029ee4b06f633de4b3e655d3371d97f09db6fd3f24b29388a78110996712249c49e7fefa7bbc3d3c405d8b480382174831fe2f9a042a557e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 28, 2021
ca1a093 Add regression test: Don't assert(...) with side effects (practicalswift)
4c3c9c3 Don't assert(...) with side effects (practicalswift)

Pull request description:

  Don't `assert(...)` with side effects.

  From the developer notes:

  > **Assertions should not have side-effects**
  >
  > Rationale: Even though the source code is set to refuse to compile with assertions disabled, having side-effects in assertions is unexpected and makes the code harder to understand

  These assertions were introduced quite recently (in bitcoin#14069 which was merged two days ago) and since this is a recurring thing (see bitcoin#13534 – "Don't assert(foo()) where foo() has side effects" from May) I added a simple regression test for the most obvious common side effect.

Tree-SHA512: be65db9d8d5d0f5752152ba73fe3fbb0531880f156d3cd7dfdf1752709979b63214e46ae64b1adbe1e09fa121278f4087f4ae49bff16cf8f5aec16ea6bde3650
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
…ded tests

737670c Use assert when running from multithreaded code as BOOST_CHECK_* are not thread safe (Jesse Cohen)

Pull request description:

  Resolves thread sanitizer failure @MarcoFalke found in bitcoin#14058

Tree-SHA512: 24d86c2cdae21fee029ee4b06f633de4b3e655d3371d97f09db6fd3f24b29388a78110996712249c49e7fefa7bbc3d3c405d8b480382174831fe2f9a042a557e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
ca1a093 Add regression test: Don't assert(...) with side effects (practicalswift)
4c3c9c3 Don't assert(...) with side effects (practicalswift)

Pull request description:

  Don't `assert(...)` with side effects.

  From the developer notes:

  > **Assertions should not have side-effects**
  >
  > Rationale: Even though the source code is set to refuse to compile with assertions disabled, having side-effects in assertions is unexpected and makes the code harder to understand

  These assertions were introduced quite recently (in bitcoin#14069 which was merged two days ago) and since this is a recurring thing (see bitcoin#13534 – "Don't assert(foo()) where foo() has side effects" from May) I added a simple regression test for the most obvious common side effect.

Tree-SHA512: be65db9d8d5d0f5752152ba73fe3fbb0531880f156d3cd7dfdf1752709979b63214e46ae64b1adbe1e09fa121278f4087f4ae49bff16cf8f5aec16ea6bde3650
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
…ded tests

737670c Use assert when running from multithreaded code as BOOST_CHECK_* are not thread safe (Jesse Cohen)

Pull request description:

  Resolves thread sanitizer failure @MarcoFalke found in bitcoin#14058

Tree-SHA512: 24d86c2cdae21fee029ee4b06f633de4b3e655d3371d97f09db6fd3f24b29388a78110996712249c49e7fefa7bbc3d3c405d8b480382174831fe2f9a042a557e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
ca1a093 Add regression test: Don't assert(...) with side effects (practicalswift)
4c3c9c3 Don't assert(...) with side effects (practicalswift)

Pull request description:

  Don't `assert(...)` with side effects.

  From the developer notes:

  > **Assertions should not have side-effects**
  >
  > Rationale: Even though the source code is set to refuse to compile with assertions disabled, having side-effects in assertions is unexpected and makes the code harder to understand

  These assertions were introduced quite recently (in bitcoin#14069 which was merged two days ago) and since this is a recurring thing (see bitcoin#13534 – "Don't assert(foo()) where foo() has side effects" from May) I added a simple regression test for the most obvious common side effect.

Tree-SHA512: be65db9d8d5d0f5752152ba73fe3fbb0531880f156d3cd7dfdf1752709979b63214e46ae64b1adbe1e09fa121278f4087f4ae49bff16cf8f5aec16ea6bde3650
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
…ded tests

737670c Use assert when running from multithreaded code as BOOST_CHECK_* are not thread safe (Jesse Cohen)

Pull request description:

  Resolves thread sanitizer failure @MarcoFalke found in bitcoin#14058

Tree-SHA512: 24d86c2cdae21fee029ee4b06f633de4b3e655d3371d97f09db6fd3f24b29388a78110996712249c49e7fefa7bbc3d3c405d8b480382174831fe2f9a042a557e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
ca1a093 Add regression test: Don't assert(...) with side effects (practicalswift)
4c3c9c3 Don't assert(...) with side effects (practicalswift)

Pull request description:

  Don't `assert(...)` with side effects.

  From the developer notes:

  > **Assertions should not have side-effects**
  >
  > Rationale: Even though the source code is set to refuse to compile with assertions disabled, having side-effects in assertions is unexpected and makes the code harder to understand

  These assertions were introduced quite recently (in bitcoin#14069 which was merged two days ago) and since this is a recurring thing (see bitcoin#13534 – "Don't assert(foo()) where foo() has side effects" from May) I added a simple regression test for the most obvious common side effect.

Tree-SHA512: be65db9d8d5d0f5752152ba73fe3fbb0531880f156d3cd7dfdf1752709979b63214e46ae64b1adbe1e09fa121278f4087f4ae49bff16cf8f5aec16ea6bde3650
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
…ded tests

737670c Use assert when running from multithreaded code as BOOST_CHECK_* are not thread safe (Jesse Cohen)

Pull request description:

  Resolves thread sanitizer failure @MarcoFalke found in bitcoin#14058

Tree-SHA512: 24d86c2cdae21fee029ee4b06f633de4b3e655d3371d97f09db6fd3f24b29388a78110996712249c49e7fefa7bbc3d3c405d8b480382174831fe2f9a042a557e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
ca1a093 Add regression test: Don't assert(...) with side effects (practicalswift)
4c3c9c3 Don't assert(...) with side effects (practicalswift)

Pull request description:

  Don't `assert(...)` with side effects.

  From the developer notes:

  > **Assertions should not have side-effects**
  >
  > Rationale: Even though the source code is set to refuse to compile with assertions disabled, having side-effects in assertions is unexpected and makes the code harder to understand

  These assertions were introduced quite recently (in bitcoin#14069 which was merged two days ago) and since this is a recurring thing (see bitcoin#13534 – "Don't assert(foo()) where foo() has side effects" from May) I added a simple regression test for the most obvious common side effect.

Tree-SHA512: be65db9d8d5d0f5752152ba73fe3fbb0531880f156d3cd7dfdf1752709979b63214e46ae64b1adbe1e09fa121278f4087f4ae49bff16cf8f5aec16ea6bde3650
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
…ded tests

737670c Use assert when running from multithreaded code as BOOST_CHECK_* are not thread safe (Jesse Cohen)

Pull request description:

  Resolves thread sanitizer failure @MarcoFalke found in bitcoin#14058

Tree-SHA512: 24d86c2cdae21fee029ee4b06f633de4b3e655d3371d97f09db6fd3f24b29388a78110996712249c49e7fefa7bbc3d3c405d8b480382174831fe2f9a042a557e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
ca1a093 Add regression test: Don't assert(...) with side effects (practicalswift)
4c3c9c3 Don't assert(...) with side effects (practicalswift)

Pull request description:

  Don't `assert(...)` with side effects.

  From the developer notes:

  > **Assertions should not have side-effects**
  >
  > Rationale: Even though the source code is set to refuse to compile with assertions disabled, having side-effects in assertions is unexpected and makes the code harder to understand

  These assertions were introduced quite recently (in bitcoin#14069 which was merged two days ago) and since this is a recurring thing (see bitcoin#13534 – "Don't assert(foo()) where foo() has side effects" from May) I added a simple regression test for the most obvious common side effect.

Tree-SHA512: be65db9d8d5d0f5752152ba73fe3fbb0531880f156d3cd7dfdf1752709979b63214e46ae64b1adbe1e09fa121278f4087f4ae49bff16cf8f5aec16ea6bde3650
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Jun 30, 2021
…ded tests

737670c Use assert when running from multithreaded code as BOOST_CHECK_* are not thread safe (Jesse Cohen)

Pull request description:

  Resolves thread sanitizer failure @MarcoFalke found in bitcoin#14058

Tree-SHA512: 24d86c2cdae21fee029ee4b06f633de4b3e655d3371d97f09db6fd3f24b29388a78110996712249c49e7fefa7bbc3d3c405d8b480382174831fe2f9a042a557e
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Jun 30, 2021
…ded tests

737670c Use assert when running from multithreaded code as BOOST_CHECK_* are not thread safe (Jesse Cohen)

Pull request description:

  Resolves thread sanitizer failure @MarcoFalke found in bitcoin#14058

Tree-SHA512: 24d86c2cdae21fee029ee4b06f633de4b3e655d3371d97f09db6fd3f24b29388a78110996712249c49e7fefa7bbc3d3c405d8b480382174831fe2f9a042a557e
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Jul 1, 2021
…ded tests

737670c Use assert when running from multithreaded code as BOOST_CHECK_* are not thread safe (Jesse Cohen)

Pull request description:

  Resolves thread sanitizer failure @MarcoFalke found in bitcoin#14058

Tree-SHA512: 24d86c2cdae21fee029ee4b06f633de4b3e655d3371d97f09db6fd3f24b29388a78110996712249c49e7fefa7bbc3d3c405d8b480382174831fe2f9a042a557e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 1, 2021
…ded tests

737670c Use assert when running from multithreaded code as BOOST_CHECK_* are not thread safe (Jesse Cohen)

Pull request description:

  Resolves thread sanitizer failure @MarcoFalke found in bitcoin#14058

Tree-SHA512: 24d86c2cdae21fee029ee4b06f633de4b3e655d3371d97f09db6fd3f24b29388a78110996712249c49e7fefa7bbc3d3c405d8b480382174831fe2f9a042a557e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 1, 2021
ca1a093 Add regression test: Don't assert(...) with side effects (practicalswift)
4c3c9c3 Don't assert(...) with side effects (practicalswift)

Pull request description:

  Don't `assert(...)` with side effects.

  From the developer notes:

  > **Assertions should not have side-effects**
  >
  > Rationale: Even though the source code is set to refuse to compile with assertions disabled, having side-effects in assertions is unexpected and makes the code harder to understand

  These assertions were introduced quite recently (in bitcoin#14069 which was merged two days ago) and since this is a recurring thing (see bitcoin#13534 – "Don't assert(foo()) where foo() has side effects" from May) I added a simple regression test for the most obvious common side effect.

Tree-SHA512: be65db9d8d5d0f5752152ba73fe3fbb0531880f156d3cd7dfdf1752709979b63214e46ae64b1adbe1e09fa121278f4087f4ae49bff16cf8f5aec16ea6bde3650
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants