TSan: data race netwerk/system/linux/nsNotifyAddrListener_Linux.cpp:378 Shutdown (race on mChildThreadShutdown)

RESOLVED FIXED in Firefox 43

Status

()

defect
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: froydnj, Assigned: froydnj)

Tracking

(Blocks 1 bug)

unspecified
mozilla43
x86_64
Linux
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox43 fixed)

Details

(Whiteboard: [tsan])

Attachments

(2 attachments)

Assignee

Description

4 years ago
Posted file TSan stack trace
The attached logfile shows a thread/data race detected by TSan (ThreadSanitizer).

* Specific information about this bug

We have nsNotifyAddrListener::mChildThreadShutdown for notifying us when our child thread is going away.  However, this variable isn't atomic, and therefore, TSan complains that we're trying to write it on one thread and read it on another without any locking or synchronization primitives.

* General information about TSan, data races, etc.

Typically, races reported by TSan are not false positives, but it is possible that the race is benign. Even in this case though, we should try to come up with a fix unless this would cause unacceptable performance issues. Also note that seemingly benign races can possibly be harmful (also depending on the compiler and the architecture) [1][2].

If the bug cannot be fixed, then this bug should be used to either make a compile-time annotation for blacklisting or add an entry to the runtime blacklist.

[1] http://software.intel.com/en-us/blogs/2013/01/06/benign-data-races-what-could-possibly-go-wrong
[2] _How to miscompile programs with "benign" data races_: https://www.usenix.org/legacy/events/hotpar11/tech/final_files/Boehm.pdf
Assignee

Comment 1

4 years ago
Daniel, since you wrote this code, I'm handing the review to you; please feel
free to find someone else.
Attachment #8659418 - Flags: review?(daniel)
Comment on attachment 8659418 [details] [diff] [review]
mark Linux's nsNotifyAddrListener::mChildThreadShutdown member as Atomic

I'm fine with this change and the patch looks good to me. 

Although if I cannot see that this was truly not an actual cause for concern. Yes the variable can be written by another thread but there's no race as it'll just catch it the next lap if it'd miss it the first. The variable is only there to cover for an annoying problem with the b2g simulator (Bug 1112499).

Still, a fix that removes the complaint is good and it really should not hurt either.

Thumbs up!
Attachment #8659418 - Flags: review?(daniel) → review+
Assignee

Updated

4 years ago
Assignee: nobody → nfroyd
https://hg.mozilla.org/mozilla-central/rev/fd29f486b3e3
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
You need to log in before you can comment on or make changes to this bug.