Opened 4 years ago

Closed 4 years ago

#5196 closed defect (fixed)

swq_op_registrar class is not thread-safe

Reported by: Even Rouault Owned by: warmerdam
Priority: normal Milestone: 1.10.1
Component: OGR_SF Version: unspecified
Severity: normal Keywords: thread-safety
Cc:

Description

The following sequence in swq_op_registrar::GetOperator?() that is not protected by a mutex cause thread-safety issue.

    if( !papoOperations )
        Initialize();

The issue is that Initialize() can set a non-NULL papoOperations pointer while it is partially initialized.

Issue discovered with the enhancement of test_ogrsf to test thread-safety of OGR drivers that can be frequently reproduced

Two possible ways of fixing this :

  • removing the test in the above snippet.
  • or making Initialize() smarter to only set papoOperations when it is fully initialized. The difficulty here is to have the guarantee of a full memory barrier to avoid early assignement visibility.

Going for the easy and safe way...

Change History (1)

comment:1 Changed 4 years ago by Even Rouault

Resolution: fixed
Status: newclosed

Fixed in trunk (r26312) and branches/1.10 (r26313)

Note: See TracTickets for help on using tickets.