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

net: Add missing locks in net.{cpp,h} #11744

Merged
merged 2 commits into from Nov 30, 2017

Conversation

practicalswift
Copy link
Contributor

Add missing locks in net.{cpp,h}:

  • writing variable nTotalBytesRecv requires holding mutex cs_totalBytesRecv exclusively
  • writing variables nTotalBytesSent, nMaxOutboundTotalBytesSentInCycle and nMaxOutboundCycleStartTime require holding mutex cs_totalBytesSent exclusively
  • writing variables nMaxOutboundTimeframe and nMaxOutboundLimit require holding mutex cs_totalBytesSent exclusively
  • writing variable vAddedNodes requires holding mutex cs_vAddedNodes exclusively

* writing variable 'nTotalBytesRecv' requires holding mutex 'cs_totalBytesRecv' exclusively
* writing variables 'nTotalBytesSent'/'nMaxOutboundTotalBytesSentInCycle'/'nMaxOutboundCycleStartTime' require holding mutex 'cs_totalBytesSent' exclusively
* writing variable 'nMaxOutboundTimeframe'/'nMaxOutboundLimit' require holding mutex 'cs_totalBytesSent' exclusively
* writing variable 'vAddedNodes' requires holding mutex 'cs_vAddedNodes' exclusively
@sipa
Copy link
Member

sipa commented Nov 21, 2017

These look right to me, and a bit scary. Opinions, @theuni?

@TheBlueMatt
Copy link
Contributor

TheBlueMatt commented Nov 22, 2017 via email

@practicalswift
Copy link
Contributor Author

I've now added a commit which adds Clang thread safety analysis annotations.

Copy link
Member

@theuni theuni left a comment

Choose a reason for hiding this comment

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

utACK bfb0c0a

@laanwj
Copy link
Member

laanwj commented Nov 30, 2017

Nice. utACK bfb0c0a

@laanwj laanwj merged commit bfb0c0a into bitcoin:master Nov 30, 2017
laanwj added a commit that referenced this pull request Nov 30, 2017
bfb0c0a Add Clang thread safety analysis annotations (practicalswift)
63f21d2 net: Add missing locks in net.{cpp,h} (practicalswift)

Pull request description:

  Add missing locks in `net.{cpp,h}`:
  * writing variable `nTotalBytesRecv` requires holding mutex `cs_totalBytesRecv` exclusively
  * writing variables `nTotalBytesSent`, `nMaxOutboundTotalBytesSentInCycle` and `nMaxOutboundCycleStartTime` require holding mutex `cs_totalBytesSent` exclusively
  * writing variables `nMaxOutboundTimeframe` and `nMaxOutboundLimit` require holding mutex `cs_totalBytesSent` exclusively
  * writing variable `vAddedNodes` requires holding mutex `cs_vAddedNodes` exclusively

Tree-SHA512: 54a5b4bc6dc6f404dacf403af2ddd7b2214cc0a17d1d32a282def1c6b536105dada56bfabbc8606f56755f2d24874abba09913b51c8d13b0f2b000149551f0b0
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 17, 2020
bfb0c0a Add Clang thread safety analysis annotations (practicalswift)
63f21d2 net: Add missing locks in net.{cpp,h} (practicalswift)

Pull request description:

  Add missing locks in `net.{cpp,h}`:
  * writing variable `nTotalBytesRecv` requires holding mutex `cs_totalBytesRecv` exclusively
  * writing variables `nTotalBytesSent`, `nMaxOutboundTotalBytesSentInCycle` and `nMaxOutboundCycleStartTime` require holding mutex `cs_totalBytesSent` exclusively
  * writing variables `nMaxOutboundTimeframe` and `nMaxOutboundLimit` require holding mutex `cs_totalBytesSent` exclusively
  * writing variable `vAddedNodes` requires holding mutex `cs_vAddedNodes` exclusively

Tree-SHA512: 54a5b4bc6dc6f404dacf403af2ddd7b2214cc0a17d1d32a282def1c6b536105dada56bfabbc8606f56755f2d24874abba09913b51c8d13b0f2b000149551f0b0
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 22, 2020
bfb0c0a Add Clang thread safety analysis annotations (practicalswift)
63f21d2 net: Add missing locks in net.{cpp,h} (practicalswift)

Pull request description:

  Add missing locks in `net.{cpp,h}`:
  * writing variable `nTotalBytesRecv` requires holding mutex `cs_totalBytesRecv` exclusively
  * writing variables `nTotalBytesSent`, `nMaxOutboundTotalBytesSentInCycle` and `nMaxOutboundCycleStartTime` require holding mutex `cs_totalBytesSent` exclusively
  * writing variables `nMaxOutboundTimeframe` and `nMaxOutboundLimit` require holding mutex `cs_totalBytesSent` exclusively
  * writing variable `vAddedNodes` requires holding mutex `cs_vAddedNodes` exclusively

Tree-SHA512: 54a5b4bc6dc6f404dacf403af2ddd7b2214cc0a17d1d32a282def1c6b536105dada56bfabbc8606f56755f2d24874abba09913b51c8d13b0f2b000149551f0b0
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 22, 2020
bfb0c0a Add Clang thread safety analysis annotations (practicalswift)
63f21d2 net: Add missing locks in net.{cpp,h} (practicalswift)

Pull request description:

  Add missing locks in `net.{cpp,h}`:
  * writing variable `nTotalBytesRecv` requires holding mutex `cs_totalBytesRecv` exclusively
  * writing variables `nTotalBytesSent`, `nMaxOutboundTotalBytesSentInCycle` and `nMaxOutboundCycleStartTime` require holding mutex `cs_totalBytesSent` exclusively
  * writing variables `nMaxOutboundTimeframe` and `nMaxOutboundLimit` require holding mutex `cs_totalBytesSent` exclusively
  * writing variable `vAddedNodes` requires holding mutex `cs_vAddedNodes` exclusively

Tree-SHA512: 54a5b4bc6dc6f404dacf403af2ddd7b2214cc0a17d1d32a282def1c6b536105dada56bfabbc8606f56755f2d24874abba09913b51c8d13b0f2b000149551f0b0
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 26, 2020
bfb0c0a Add Clang thread safety analysis annotations (practicalswift)
63f21d2 net: Add missing locks in net.{cpp,h} (practicalswift)

Pull request description:

  Add missing locks in `net.{cpp,h}`:
  * writing variable `nTotalBytesRecv` requires holding mutex `cs_totalBytesRecv` exclusively
  * writing variables `nTotalBytesSent`, `nMaxOutboundTotalBytesSentInCycle` and `nMaxOutboundCycleStartTime` require holding mutex `cs_totalBytesSent` exclusively
  * writing variables `nMaxOutboundTimeframe` and `nMaxOutboundLimit` require holding mutex `cs_totalBytesSent` exclusively
  * writing variable `vAddedNodes` requires holding mutex `cs_vAddedNodes` exclusively

Tree-SHA512: 54a5b4bc6dc6f404dacf403af2ddd7b2214cc0a17d1d32a282def1c6b536105dada56bfabbc8606f56755f2d24874abba09913b51c8d13b0f2b000149551f0b0
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 27, 2020
bfb0c0a Add Clang thread safety analysis annotations (practicalswift)
63f21d2 net: Add missing locks in net.{cpp,h} (practicalswift)

Pull request description:

  Add missing locks in `net.{cpp,h}`:
  * writing variable `nTotalBytesRecv` requires holding mutex `cs_totalBytesRecv` exclusively
  * writing variables `nTotalBytesSent`, `nMaxOutboundTotalBytesSentInCycle` and `nMaxOutboundCycleStartTime` require holding mutex `cs_totalBytesSent` exclusively
  * writing variables `nMaxOutboundTimeframe` and `nMaxOutboundLimit` require holding mutex `cs_totalBytesSent` exclusively
  * writing variable `vAddedNodes` requires holding mutex `cs_vAddedNodes` exclusively

Tree-SHA512: 54a5b4bc6dc6f404dacf403af2ddd7b2214cc0a17d1d32a282def1c6b536105dada56bfabbc8606f56755f2d24874abba09913b51c8d13b0f2b000149551f0b0
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 29, 2020
bfb0c0a Add Clang thread safety analysis annotations (practicalswift)
63f21d2 net: Add missing locks in net.{cpp,h} (practicalswift)

Pull request description:

  Add missing locks in `net.{cpp,h}`:
  * writing variable `nTotalBytesRecv` requires holding mutex `cs_totalBytesRecv` exclusively
  * writing variables `nTotalBytesSent`, `nMaxOutboundTotalBytesSentInCycle` and `nMaxOutboundCycleStartTime` require holding mutex `cs_totalBytesSent` exclusively
  * writing variables `nMaxOutboundTimeframe` and `nMaxOutboundLimit` require holding mutex `cs_totalBytesSent` exclusively
  * writing variable `vAddedNodes` requires holding mutex `cs_vAddedNodes` exclusively

Tree-SHA512: 54a5b4bc6dc6f404dacf403af2ddd7b2214cc0a17d1d32a282def1c6b536105dada56bfabbc8606f56755f2d24874abba09913b51c8d13b0f2b000149551f0b0
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 29, 2020
bfb0c0a Add Clang thread safety analysis annotations (practicalswift)
63f21d2 net: Add missing locks in net.{cpp,h} (practicalswift)

Pull request description:

  Add missing locks in `net.{cpp,h}`:
  * writing variable `nTotalBytesRecv` requires holding mutex `cs_totalBytesRecv` exclusively
  * writing variables `nTotalBytesSent`, `nMaxOutboundTotalBytesSentInCycle` and `nMaxOutboundCycleStartTime` require holding mutex `cs_totalBytesSent` exclusively
  * writing variables `nMaxOutboundTimeframe` and `nMaxOutboundLimit` require holding mutex `cs_totalBytesSent` exclusively
  * writing variable `vAddedNodes` requires holding mutex `cs_vAddedNodes` exclusively

Tree-SHA512: 54a5b4bc6dc6f404dacf403af2ddd7b2214cc0a17d1d32a282def1c6b536105dada56bfabbc8606f56755f2d24874abba09913b51c8d13b0f2b000149551f0b0
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 29, 2020
bfb0c0a Add Clang thread safety analysis annotations (practicalswift)
63f21d2 net: Add missing locks in net.{cpp,h} (practicalswift)

Pull request description:

  Add missing locks in `net.{cpp,h}`:
  * writing variable `nTotalBytesRecv` requires holding mutex `cs_totalBytesRecv` exclusively
  * writing variables `nTotalBytesSent`, `nMaxOutboundTotalBytesSentInCycle` and `nMaxOutboundCycleStartTime` require holding mutex `cs_totalBytesSent` exclusively
  * writing variables `nMaxOutboundTimeframe` and `nMaxOutboundLimit` require holding mutex `cs_totalBytesSent` exclusively
  * writing variable `vAddedNodes` requires holding mutex `cs_vAddedNodes` exclusively

Tree-SHA512: 54a5b4bc6dc6f404dacf403af2ddd7b2214cc0a17d1d32a282def1c6b536105dada56bfabbc8606f56755f2d24874abba09913b51c8d13b0f2b000149551f0b0
@practicalswift practicalswift deleted the missing-net-locks branch April 10, 2021 19:33
furszy added a commit to PIVX-Project/PIVX that referenced this pull request Dec 7, 2021
e1d12d3 Add Clang thread safety analysis annotations (furszy)
5716940 net: Add missing locks in net.{cpp,h} (furszy)
8c02b59 net: simplify fRelayTxes flag processing (furszy)
71667df remove unused IsArgSet check (Marko Bencun)
729c63d add m_added_nodes to connman options (Marko Bencun)
8c8ad18 [net] Fix use of uninitialized value in getnetworkinfo(const JSONRPCRequest& request) (practicalswift)
a13b7c9 Add vConnect to CConnman::Options (Marko Bencun)
987342e ActiveMasternode: fix not initialized socket. (furszy)
8d788ba add SeedNodes to CConnman::Options (Marko Bencun)
d9e91ff add Binds, WhiteBinds to CConnman::Options (Marko Bencun)
41c89af add WhitelistedRange to CConnman::Options (Marko Bencun)

Pull request description:

  More groundwork for the LLMQ sessions connections work, built on top of #2586 and #2587 (starts in 10efb72).

  Focused on cleaning the connman init/start by decoupling the command line arguments.

  Backported PRs list:

  * bitcoin#10467.
  * bitcoin#10496.
  * bitcoin#10596.
  * bitcoin#10977.
  * bitcoin#11301.
  * bitcoin#11744 (partially, without the outbound members changes as we don't have them).

ACKs for top commit:
  random-zebra:
    utACK e1d12d3
  Fuzzbawls:
    ACK e1d12d3

Tree-SHA512: 81a1ab7a1e7f487330354631ee728be9ec78223fe4978c8b9c97b7fbc8d2bfe4f4ea9e88ac4a3d1f0553f7adad871c81261b1a7545bae710a4e3200b8a5031d7
gades pushed a commit to cosanta/cosanta-core that referenced this pull request Feb 10, 2022
bfb0c0a Add Clang thread safety analysis annotations (practicalswift)
63f21d2 net: Add missing locks in net.{cpp,h} (practicalswift)

Pull request description:

  Add missing locks in `net.{cpp,h}`:
  * writing variable `nTotalBytesRecv` requires holding mutex `cs_totalBytesRecv` exclusively
  * writing variables `nTotalBytesSent`, `nMaxOutboundTotalBytesSentInCycle` and `nMaxOutboundCycleStartTime` require holding mutex `cs_totalBytesSent` exclusively
  * writing variables `nMaxOutboundTimeframe` and `nMaxOutboundLimit` require holding mutex `cs_totalBytesSent` exclusively
  * writing variable `vAddedNodes` requires holding mutex `cs_vAddedNodes` exclusively

Tree-SHA512: 54a5b4bc6dc6f404dacf403af2ddd7b2214cc0a17d1d32a282def1c6b536105dada56bfabbc8606f56755f2d24874abba09913b51c8d13b0f2b000149551f0b0
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
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.

None yet

6 participants