diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-05 10:07:25 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-05 12:15:54 +0200 |
commit | 2a5ba0a0096334b5097fd6aeec54c18c876e94d4 (patch) | |
tree | 6bb7f250c1a69006d506bc10162da6eb5acf9307 | |
parent | 377a318dcfe4021eadde0e8cd922a4e42040b355 (diff) |
tsan:data-race in ScTable::bStreamValid
which is touched from multiple threads when doing formula groups.
WARNING: ThreadSanitizer: data race (pid=837458)
Write of size 2 at 0x7b5800031aa8 by thread T17:
/media/disk2/libo-san/sc/source/core/data/table1.cxx:379:22
(libsclo.so+0x5b4f5d)
/media/disk2/libo-san/sc/source/core/data/document.cxx:927:23
(libsclo.so+0x443220)
ScFormulaCell::ScInterpretTailParameter)
/media/disk2/libo-san/sc/source/core/data/formulacell.cxx:2266:23 (l
ibsclo.so+0x550fc4)
long, unsigned long, unsigned int, unsigned int)
/media/disk2/libo-san/sc/source/core/data/colum
n2.cxx:2998:15 (libsclo.so+0x375bb3)
short, int, int, unsigned int, unsigned int)
/media/disk2/libo-san/sc/source/core/data/table1.cx
x:2555:24 (libsclo.so+0x5c095b)
ScRange const&, unsigned int, unsigned int)
/media/disk2/libo-san/sc/source/core/data/documen8.cxx:4
21:11 (libsclo.so+0x436cef)
ScFormulaCell::InterpretFormulaGroupThreading(sc::FormulaLogger::GroupScope&,
bool&, bool&, int, int)::Executor::doWork()
/media/disk2/libo-san/sc/source/core/da
ta/formulacell.cxx:4875:29 (libsclo.so+0x55e869)
/media/disk2/libo-san/comphelper/source/misc/threadpool.cxx:314:9
(libcomphelper.so+0x1480ff)
/media/disk2/libo-san/comphelper/source/misc/threadpool.cxx:83:24
(libcomphelper.so+0x1480ff)
/media/disk2/libo-san/salhelper/source/thread.cxx:40:9
(libuno_salhelpergcc3.so.3+0x5350)
/media/disk2/libo-san/salhelper/source/thread.cxx
(libuno_salhelpergcc3.so.3+0x53b9)
(libuno_salhelpergcc3.so.3+0x565e)
/media/disk2/libo-san/sal/osl/unx/thread.cxx:264:9
(libuno_sal.so.3+0x68325)
Previous read of size 2 at 0x7b5800031aa8 by thread T18:
/media/disk2/libo-san/sc/inc/table.hxx:315:71 (libsclo.so+0x443175)
/media/disk2/libo-san/sc/source/core/data/document.cxx:919:30
(libsclo.so+0x443175)
ScFormulaCell::ScInterpretTailParameter)
/media/disk2/libo-san/sc/source/core/data/formulacell.cxx:2182:48 (l
ibsclo.so+0x550c03)
long, unsigned long, unsigned int, unsigned int)
/media/disk2/libo-san/sc/source/core/data/colum
n2.cxx:2998:15 (libsclo.so+0x375bb3)
short, int, int, unsigned int, unsigned int)
/media/disk2/libo-san/sc/source/core/data/table1.cx
x:2555:24 (libsclo.so+0x5c095b)
ScRange const&, unsigned int, unsigned int)
/media/disk2/libo-san/sc/source/core/data/documen8.cxx:4
21:11 (libsclo.so+0x436cef)
ScFormulaCell::InterpretFormulaGroupThreading(sc::FormulaLogger::GroupScope&,
bool&, bool&, int, int)::Executor::doWork()
/media/disk2/libo-san/sc/source/core/da
ta/formulacell.cxx:4875:29 (libsclo.so+0x55e869)
/media/disk2/libo-san/comphelper/source/misc/threadpool.cxx:314:9
(libcomphelper.so+0x1480ff)
Change-Id: Iae65982248a468e25eab8c8ecefb551a87d202d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120060
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sc/inc/table.hxx | 10 | ||||
-rw-r--r-- | sc/source/core/data/table1.cxx | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 6ecc0746d7b5..4c1a96e7f901 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -19,8 +19,6 @@ #pragma once -#include <algorithm> -#include <vector> #include <tools/gen.hxx> #include <tools/color.hxx> #include "attarray.hxx" @@ -35,9 +33,12 @@ #include "document.hxx" #include "drwlayer.hxx" +#include <algorithm> +#include <atomic> +#include <memory> #include <optional> #include <set> -#include <memory> +#include <vector> template <typename A, typename D> class ScBitMaskCompressedArray; template <typename A, typename D> class ScCompressedArray; @@ -236,7 +237,6 @@ private: mutable bool bTableAreaValid:1; mutable bool bTableAreaVisibleValid:1; bool bVisible:1; - bool bStreamValid:1; bool bPendingRowHeights:1; bool bCalcNotification:1; bool bGlobalKeepQuery:1; @@ -244,6 +244,8 @@ private: bool bActiveScenario:1; bool mbPageBreaksValid:1; bool mbForceBreaks:1; + /** this is touched from formula group threading context */ + std::atomic<bool> bStreamValid; // Default attributes for the unallocated columns. ScAttrArray aDefaultColAttrArray; diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index b0885b08e5cb..23c2d85ca52e 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -269,7 +269,6 @@ ScTable::ScTable( ScDocument& rDoc, SCTAB nNewTab, const OUString& rNewName, bTableAreaValid(false), bTableAreaVisibleValid(false), bVisible(true), - bStreamValid(false), bPendingRowHeights(false), bCalcNotification(false), bGlobalKeepQuery(false), @@ -277,6 +276,7 @@ ScTable::ScTable( ScDocument& rDoc, SCTAB nNewTab, const OUString& rNewName, bActiveScenario(false), mbPageBreaksValid(false), mbForceBreaks(false), + bStreamValid(false), aDefaultColAttrArray(static_cast<SCCOL>(-1), nNewTab, rDoc, nullptr) { if (bColInfo) |