AcademySoftwareFoundation / AcademySoftwareFoundation/OpenColorIO
Filerules : non-reentry issue in Config::getRuleFromFilepath public function
- Vorherrschende Sprache
- C++
- Sterne
- 2.1k
- Forks
- 503
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
https://github.com/AcademySoftwareFoundation/OpenColorIO/blob/05466120f3f9c23b23778f3ccbafc4dde93abe4b/src/OpenColorIO/FileRules.cpp#L638C25-L638C32
Hello,
I've recently migrated my code from the deprecated Config::parseColorSpaceFromString to the recommended Config::getColorSpaceFromFilepath, and encountered a thread-safety issue.
In FileRules::Impl::getRuleFromFilepath(), the method matches() is called in what appears to be a read-only context, implying it should be thread-safe.
However, when a rule is of type FILE_RULE_PARSE_FILEPATH, the matches() method may modify the internal m_colorspace member as a side effect. This introduces shared mutable state, which breaks thread safety when getColorSpaceFromFilepath() is used concurrently on a shared ConstConfigRcPtr.
This behavior leads to data races or inconsistent results in my multi-threaded application.
Beitragsleitfaden
Rechercherichtung
Beginne in src/OpenColorIO/FileRules.cpp ungefähr bei Zeile 638 und verfolge FileRules::Impl::getRuleFromFilepath(), matches() und das m_colorspace-Mitglied. Reproduziere gleichzeitige Aufrufe von Config::getColorSpaceFromFilepath() auf einem gemeinsam genutzten ConstConfigRcPtr und untersuche den FILE_RULE_PARSE_FILEPATH-Pfad. Erledigt ist dies, wenn die schreibgeschützte Suche keinen gemeinsam veränderlichen Zustand, keine Datenrennen oder inkonsistenten Ergebnisse mehr verursacht.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- cpp
- Bereich
- backend
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100