id summary reporter owner description type status priority milestone component version severity resolution keywords cc 5101 GDALDataset::GetProjectionRef() blocking Kosta warmerdam "It seems that the call to GDALDataset::GetProjectionRef() can sometimes block when used in a multi-threaded environment and used on a dataset opened twice and accessed from two different threads for certain datasets. Sample program to reproduce the behavior (sorry for the usage of boost threads): {{{ const char RASTER_FILE[] = ""D:/test.tif""; GDALDataset* const ds1 = static_cast(GDALOpen(RASTER_FILE, GA_ReadOnly)); GDALDataset* const ds2 = static_cast(GDALOpen(RASTER_FILE, GA_ReadOnly)); boost::thread thread1([&]() { std::cout << ""#1: start calling GetProjectionRef() on thread #"" << boost::this_thread::get_id() << std::endl; ds1->GetProjectionRef(); std::cout << ""#1: GetProjectionRef(): done"" << std::endl; boost::this_thread::sleep_for(boost::chrono::seconds(30)); std::cout << ""#1: deleting DS"" << std::endl; delete ds1; std::cout << ""#1: DS deleted"" << std::endl; }); boost::thread thread2([&]() { boost::this_thread::sleep_for(boost::chrono::seconds(10)); std::cout << ""#2: start calling GetProjectionRef() on thread #"" << boost::this_thread::get_id() << std::endl; ds2->GetProjectionRef(); std::cout << ""#2: GetProjectionRef(): done"" << std::endl; std::cout << ""#2: deleting DS"" << std::endl; delete ds2; std::cout << ""#2: DS deleted"" << std::endl; }); thread1.join(); thread2.join(); }}} The call to GetProjectionRef() on the 2nd threads blocks until the 1st datasource object gets deleted by the 1st thread. You can observe the same behavior if you use a copy of the attached GeoTiff and open both datasets from the 2 different files. Maybe that is related to the not-found EPSG code used by the GeoTiff, which then holds on to an internal lock/mutex? This has been observed on Windows and I haven't checked this with GDAL 1.10 yet..." defect closed normal GDAL_Raster 1.9.2 normal worksforme