Skip to content

Commit

Permalink
Merge pull request OSGeo#8561 from rouault/gtiff_deadlock
Browse files Browse the repository at this point in the history
GTiff multithreaded reading/writing: fix a deadlock situation
  • Loading branch information
rouault authored Oct 15, 2023
2 parents 24edf2f + d083af1 commit dfb7675
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions frmts/gtiff/gtiffdataset_read.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,8 +560,16 @@ static void CPL_STDCALL ThreadDecompressionFuncErrorHandler(
psJob->nXBlock, psJob->nYBlock);
if (apoBlocks[i] == nullptr)
{
// Temporary disabling of dirty block fushing, otherwise
// we can be in a deadlock situation, where the
// GTiffDataset::SubmitCompressionJob() method waits for jobs
// to be finished, that can't finish (actually be started)
// because this task and its siblings are taking all the
// available workers allowed by the global thread pool.
GDALRasterBlock::EnterDisableDirtyBlockFlush();
apoBlocks[i] = poDS->GetRasterBand(iBand)->GetLockedBlockRef(
psJob->nXBlock, psJob->nYBlock, TRUE);
GDALRasterBlock::LeaveDisableDirtyBlockFlush();
if (apoBlocks[i] == nullptr)
return false;
}
Expand Down

0 comments on commit dfb7675

Please sign in to comment.