Commit af339206 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files

Fixed a deadlock when gdal.Warp was called by a multiprocessing child process...


Fixed a deadlock when gdal.Warp was called by a  multiprocessing child process and GDAL_NUM_THREADS was set (only GDAL 3.2.1 and above).
Signed-off-by: Daniel Scheffler's avatarDaniel Scheffler <danschef@gfz-potsdam.de>
parent 558e6198
Pipeline #24792 passed with stages
in 2 minutes and 30 seconds
......@@ -2,6 +2,13 @@
History
=======
0.17.2 (2021-06-22)
-------------------
* Fixed a deadlock when gdal.Warp was called by a multiprocessing child process and GDAL_NUM_THREADS was set
(only GDAL 3.2.1 and above).
0.17.1 (2021-05-07)
-------------------
......
......@@ -429,7 +429,9 @@ def warp_ndarray(ndarray, in_gt, in_prj=None, out_prj=None, out_dtype=None,
# in_ds.SetMetadata(rpc, "RPC")
# transformerOptions = ['RPC_DEM=data/warp_52_dem.tif']
if CPUs is None or CPUs > 1:
# use GDALs multiprocessing as long as the current process is not a child process of a multiprocess main thread
# - otherwise, gdal.Warp() hangs with GDAL versions from 3.2.1 and above (does not allow sub-multiprocessing)
if (CPUs is None or CPUs > 1) and multiprocessing.parent_process() is None:
gdal.SetConfigOption('GDAL_NUM_THREADS', str(CPUs if CPUs else multiprocessing.cpu_count()))
# gdal.SetConfigOption('GDAL_CACHEMAX', str(800))
......
......@@ -19,5 +19,5 @@
# You should have received a copy of the GNU Lesser General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
__version__ = '0.17.1'
__versionalias__ = '20210508_01'
__version__ = '0.17.2'
__versionalias__ = '20210622_01'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment