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

network,exec: fix memory issue #3310

Merged
merged 2 commits into from Oct 29, 2019
Merged

network,exec: fix memory issue #3310

merged 2 commits into from Oct 29, 2019

Conversation

yousong
Copy link
Contributor

@yousong yousong commented Oct 15, 2019

Changelog: exec plugin: fix memory reclamation at plugin shutdown
Changelog: network plugin: fix data race accessing sending_sockets

These were spotted with the help from AddressSanitizer.

This can happen with more than 1 WriteThreads
@yousong yousong changed the title network,threshold: fix memory issue network,exec: fix memory issue Oct 15, 2019
@rubenk rubenk merged commit b1ca0c4 into collectd:master Oct 29, 2019
rpv-tomsk added a commit to rpv-tomsk/collectd that referenced this pull request Mar 21, 2020
Data race conditions explanation in collectd#3310 is a bit incorrect.

The `network_send_buffer()` where `se->lock` was added in
c44c159, is called by
chain `network_write() -> flush_buffer()`.

The `network_write()` could be called from multiply threads,
but it has `send_buffer_lock`, so all calls to `network_send_buffer()`
are serialized and there is no data race.

The issue could be caused by second possible call path,
`network_notification()->network_send_buffer()`.
There is no lock, so race can occur.

Notifications are sent rarely, so lock on each socket entry is inefficient.

Related: collectd#3310
Reworks: c44c159
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.

None yet

2 participants