Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1512587 - data race in std::promise/std::future (reported by ThreadSanitizer)
Summary: data race in std::promise/std::future (reported by ThreadSanitizer)
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Developer Toolset
Classification: Red Hat
Component: gcc
Version: DTS 6.0 RHEL 6
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: alpha
: 7.1
Assignee: Marek Polacek
QA Contact: Michael Petlan
Vladimír Slávik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-11-13 15:26 UTC by Paulo Andrade
Modified: 2018-05-03 05:14 UTC (History)
8 users (show)

Fixed In Version: devtoolset-7-gcc-7.2.1-6.el6
Doc Type: Bug Fix
Doc Text:
Previously, the code for the `std::promise` and `std::future` C++ standard library class templates contained a data race. The code has been fixed and the race condition no longer exists.
Clone Of:
Environment:
Last Closed: 2018-05-03 05:13:47 UTC


Attachments (Terms of Use)
racy2.C (deleted)
2017-11-13 15:26 UTC, Paulo Andrade
no flags Details


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:1293 None None None 2018-05-03 05:14:38 UTC

Description Paulo Andrade 2017-11-13 15:26:53 UTC
Created attachment 1351594 [details]
racy2.C

There should be no race (likely a false positive), but libtsan reports
a race.

  Example:

$ scl enable devtoolset-6 bash
$ g++ -fsanitize=thread -static-libtsan -g -o racy racy2.C -lpthread
$ ./racy

  Expected results would be empty output, but actual output
is a report about a race:

[...]
SUMMARY: ThreadSanitizer: data race /opt/rh/devtoolset-6/root/usr/include/c++/6.3.1/bits/unique_ptr.h:308 in std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>::get() const

  The issue also happens in rhel7.

Comment 2 Marek Polacek 2017-12-05 13:51:30 UTC
I could reproduce this with DTS 6, but DTS 7 looks fine:

# g++ --version
g++ (GCC) 7.2.1 20170829 (Red Hat 7.2.1-1)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# g++ -fsanitize=thread -static-libtsan -g -o racy racy.C -lpthread
# ./racy
#

So we should include this BZ in DTS 7.1.

Comment 5 Michael Petlan 2018-04-26 12:07:34 UTC
Successfully reproduced with DTS-6, verified for devtoolset-7-libtsan-devel-7.3.1-5.4.
No races are reported.
VERIFIED.

Comment 8 errata-xmlrpc 2018-05-03 05:13:47 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:1293


Note You need to log in before you can comment on or make changes to this bug.