Wireshark-dev: Re: [Wireshark-dev] ThreadSanitizer issue in RecentFileStatus()

From: Stig Bjørlykke <stig@xxxxxxxxxxxxx>
Date: Sat, 3 Feb 2018 12:23:21 +0100
On Fri, Feb 2, 2018 at 7:33 PM, Gerald Combs <gerald@xxxxxxxxxxxxx> wrote:
> That's correct -- the main and RecentFileStatus threads could operate on the filename at the same time. I think the data race is harmless in this case, but it's easy enough to create a local copy of the filename. Fix inbound at https://code.wireshark.org/review/#/c/25572.

I'm still getting a similar race condition report from
RecentFileStatus.  Even if it's harmless it would have been good to
fix this to make it possible to run with TSAN and "Pause on issues".

==================
WARNING: ThreadSanitizer: data race (pid=4733)
  Read of size 8 at 0x7e800059edb0 by main thread:
  * #0 QString::QString(QString const&) qstring.h:906
(Wireshark:x86_64+0x100039256)
    #1 QString::QString(QString const&) qstring.h:907
(Wireshark:x86_64+0x100038498)
    #2 WiresharkApplication::qt_static_metacall(QObject*,
QMetaObject::Call, int, void**) moc_wireshark_application.cpp:239
(Wireshark:x86_64+0x1000bb990)
    #3 QObject::event(QEvent*) <null> (QtCore:x86_64+0x211b80)
    #4 QApplicationPrivate::notify_helper(QObject*, QEvent*) <null>
(QtWidgets:x86_64+0x119ac)
    #5 start <null> (libdyld.dylib:x86_64+0x1114)

  Previous write of size 8 at 0x7e800059edb0 by thread T14:
  * #0 QString::QString(QString const&) qstring.h:906
(Wireshark:x86_64+0x10003926d)
    #1 QString::QString(QString const&) qstring.h:907
(Wireshark:x86_64+0x100038498)
    #2 RecentFileStatus::run() recent_file_status.cpp:32
(Wireshark:x86_64+0x1005000cc)
    #3 non-virtual thunk to RecentFileStatus::run()
recent_file_status.cpp (Wireshark:x86_64+0x10050020c)
    #4 <null> <null> (QtCore:x86_64+0x27b6d)

  Issue is caused by frames marked with "*".

  Location is stack of thread T14.

  Thread T14 (tid=1194099, running) created by main thread at:
    #0 pthread_create <null>
(libclang_rt.tsan_osx_dynamic.dylib:x86_64h+0x2a34d)
    #1 QThread::start(QThread::Priority) <null> (QtCore:x86_64+0x2b5cb)
    #2 main wireshark-qt.cpp:667 (Wireshark:x86_64+0x1000366cd)

SUMMARY: ThreadSanitizer: data race qstring.h:906 in
QString::QString(QString const&)
==================


-- 
Stig Bjørlykke