Opened 14 years ago

Closed 9 years ago

Last modified 9 years ago

#3226 closed defect (fixed)

Race condition in gdalrasterband.cpp causing IReadBlock() and IWriteBlock() methods of drivers to be called from different threads

Reported by: Even Rouault Owned by: warmerdam
Priority: normal Milestone: 2.0.0
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description

This is largely related to the issue exposed in #3225, but this symptom is potentially more likely to happen.

The attached program run against an unmodified GDAL shows that FlushBlock() can call IWriteBlock() while GetLockedBlockRef() calls IReadBlock(). This would require GDAL drivers to be thread-safe. All this shows that we probably need more severe locking than what we do currently.

Attachments (2)

hit_bug_3226.cpp (3.1 KB ) - added by Even Rouault 14 years ago.
hit_bug_3226_2.cpp (3.5 KB ) - added by Even Rouault 14 years ago.
Variation of the first program that doesn't require explicit call to GDALFlushCacheBlock()

Download all attachments as: .zip

Change History (6)

by Even Rouault, 14 years ago

Attachment: hit_bug_3226.cpp added

comment:1 by Even Rouault, 14 years ago

The output of a run is :

$ ./hit_bug_3226
create a dirty block 0
end of dirty block 0 creation
begin thread -> flush the dirty block
begin of IWriteBlock(x=0, y=0) (thread=5108)
read block 1 from main thread
begin of IReadBlock(x=0, y=1) (thread=2616)
ERROR 7: Assertion `!bLock' failed
in file `hit_bug_3226.cpp', line 49

comment:2 by Even Rouault, 14 years ago

hit_bug_3226_2.cpp is a variation of hit_bug_3226.cpp that doesn't require explicit call to GDALFlushBlock().

by Even Rouault, 14 years ago

Attachment: hit_bug_3226_2.cpp added

Variation of the first program that doesn't require explicit call to GDALFlushCacheBlock()

comment:3 by Even Rouault, 9 years ago

Milestone: 2.0
Resolution: fixed
Status: newclosed

Actually this is a duplicate of #5983

comment:4 by Even Rouault, 9 years ago

Milestone: 2.02.0.0

Milestone renamed

Note: See TracTickets for help on using tickets.