vcpkg/ports/gdal/upstream-b5858ed.diff
2023-10-19 11:00:06 -07:00

22 lines
1.1 KiB
Diff

diff --git a/frmts/gtiff/geotiff.cpp b/frmts/gtiff/geotiff.cpp
index ed79c0972e0..33846d66513 100644
--- a/frmts/gtiff/geotiff.cpp
+++ b/frmts/gtiff/geotiff.cpp
@@ -2886,8 +2886,16 @@ static void ThreadDecompressionFunc(void *pData)
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;
}