Bug 97144 - DataRaces in WeakReferenceHelper
Summary: DataRaces in WeakReferenceHelper
Status: RESOLVED INSUFFICIENTDATA
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: sdk (show other bugs)
Version:
(earliest affected)
4.1.4.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2016-01-15 08:15 UTC by straub
Modified: 2017-03-01 10:37 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Patch to fix the data races (2.00 KB, patch)
2016-01-15 08:15 UTC, straub
Details

Note You need to log in before you can comment on or make changes to this bug.
Description straub 2016-01-15 08:15:07 UTC
Created attachment 121948 [details]
Patch to fix the data races

We saw SEGVs in case a an object dies due to its refcount reaching 0, while at the same in other thread the WeakReference referencing this object also gets destructed.

We traced it down due to data races in weak.cxx
a) OWeakObject::disposeWeakConnectionPoint(): needs to take the weak mutex before really accessing m_pWeakConnectionPoint member, because m_pWeakConnectionPoint member might have been written by another thread some time before (ie. assignment of WeakReference in another thread than destruction)
b) WeakReferenceHelper::clear(): also needs to take the weak mutex before accessing m_pImpl->m_XWeakConnectionPoint for the same reasons
c) OWeakConnectionPoint::dispose(): needs to clear m_pObject member so to ensure that OWeakConnectionPoint::queryAdapted() doesn't try to increment the ref count after it has been disposed.

The attached patch resolves our SEGVs.
Comment 1 Julien Nabet 2016-01-16 09:12:14 UTC
4.X versions are EOL (see https://wiki.documentfoundation.org/ReleasePlan), could you give a try to a newer LO version (5.0.4 is last stable one)?
Comment 2 straub 2016-01-18 06:26:03 UTC
The attached patch applies to libreoffice-5.0.3.1 with some fuzz but without rejections, so I assume the data races also occur in the current release.
Comment 3 Julien Nabet 2016-01-18 08:12:27 UTC
Thank you Straub for your feedback. Since I don't have question and can't help here, I'll put this one back to UNCONFIRMED and uncc myself.
Comment 4 Buovjaga 2016-01-24 18:32:30 UTC
Please submit your patch to gerrit: https://wiki.documentfoundation.org/Development/gerrit/setup
Patches are not collected from Bugzilla.
Comment 5 QA Administrators 2017-01-31 00:29:45 UTC Comment hidden (obsolete)
Comment 6 QA Administrators 2017-03-01 10:37:05 UTC
Dear Bug Submitter,

Please read this message in its entirety before proceeding.

Your bug report is being closed as INSUFFICIENTDATA due to inactivity and
a lack of information which is needed in order to accurately
reproduce and confirm the problem. We encourage you to retest
your bug against the latest release. If the issue is still
present in the latest stable release, we need the following
information (please ignore any that you've already provided):

a) Provide details of your system including your operating
   system and the latest version of LibreOffice that you have
   confirmed the bug to be present

b) Provide easy to reproduce steps – the simpler the better

c) Provide any test case(s) which will help us confirm the problem

d) Provide screenshots of the problem if you think it might help

e) Read all comments and provide any requested information

Once all of this is done, please set the bug back to UNCONFIRMED
and we will attempt to reproduce the issue. Please do not:

a) respond via email 

b) update the version field in the bug or any of the other details
   on the top section of our bug tracker

Warm Regards,
QA Team

MassPing-NeedInfo-20170301