Crash when importing Cloud-Optimised Geotiff

Hi John,

I am experiencing a crash when trying to open a cloud-optimised geotiff which I produced using GDAL 3.7 like this:

gdal_translate input.tif output_cog.tif -of COG -co COMPRESS=LZW  

Happens on MacOS 10.15.x (yes… I know) and GPlates 2.3.0, crash log attached below. The log seems to say that this is related to the JPEG compression.

Cheers,
Christian

Process: gplates [6043]
Path: /Applications/gplates.app/Contents/MacOS/gplates
Identifier: GPlates 2.3.0-Darwin-19.6.0
Version: 2.3.0 (2.3.0)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: gplates [6043]
User ID: 651

Date/Time: 2023-09-03 12:11:22.683 +0200
OS Version: Mac OS X 10.15.7 (19H2026)
Report Version: 12
Bridge OS Version: 6.6 (19P6064)

System Integrity Protection: enabled

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY

Application Specific Information:
Assertion failed: (sp->cinfo.comm.is_decompressor), function JPEGSetupDecode, file tif_jpeg.c, line 1021.

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff67c5a32a __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fff67d16e60 pthread_kill + 430
2 libsystem_c.dylib 0x00007fff67be1808 abort + 120
3 libsystem_c.dylib 0x00007fff67be0ac6 __assert_rtn + 314
4 libgdal.29.dylib 0x000000010c4cef8e JPEGSetupDecode.cold.2 + 35
5 libgdal.29.dylib 0x000000010bfbdd7d JPEGSetupDecode + 442
6 libgdal.29.dylib 0x000000010bfd51c4 TIFFStartTile + 31
7 libgdal.29.dylib 0x000000010bfd49aa TIFFReadEncodedTile + 138
8 libgdal.29.dylib 0x000000010bd6160a GTiffDataset::ReadStrile(int, void*, long long) + 256
9 libgdal.29.dylib 0x000000010bd61baa GTiffDataset::LoadBlockBuf(int, bool) + 402
10 libgdal.29.dylib 0x000000010bd618cc GTiffRasterBand::IReadBlock(int, int, void*) + 526
11 libgdal.29.dylib 0x000000010c0bb187 GDALRasterBand::GetLockedBlockRef(int, int, int) + 371
12 libgdal.29.dylib 0x000000010c0d66ed GDALRasterBand::IRasterIO(GDALRWFlag, int, int, int, int, void*, int, int, GDALDataType, long long, long long, GDALRasterIOExtraArg*) + 2401
13 libgdal.29.dylib 0x000000010bd61205 GTiffRasterBand::IRasterIO(GDALRWFlag, int, int, int, int, void*, int, int, GDALDataType, long long, long long, GDALRasterIOExtraArg*) + 1087
14 libgdal.29.dylib 0x000000010c0ba587 GDALRasterBand::RasterIO(GDALRWFlag, int, int, int, int, void*, int, int, GDALDataType, long long, long long, GDALRasterIOExtraArg*) + 735
15 GPlates 2.3.0-Darwin-19.6.0 0x0000000109068296 void GPlatesFileIO::GDALRasterReader::add_rgba_data(GPlatesGui::rgba8_t*, GPlatesFileIO::GDALRasterReader::RasterBand::GDALRgbaBands const&, bool, unsigned int, unsigned int, unsigned int, unsigned int) + 534
16 GPlates 2.3.0-Darwin-19.6.0 0x0000000109067f46 void GPlatesFileIO::GDALRasterReader::add_dataGPlatesGui::rgba8_t(GPlatesGui::rgba8_t*, GPlatesFileIO::GDALRasterReader::RasterBand const&, bool, unsigned int, unsigned int, unsigned int, unsigned int) + 86
17 GPlates 2.3.0-Darwin-19.6.0 0x000000010908f309 boost::optional<GPlatesPropertyValues::RawRasterImpl<GPlatesGui::rgba8_t, GPlatesPropertyValues::RawRasterDataPolicies::WithData, GPlatesPropertyValues::RawRasterStatisticsPolicies::WithoutStatistics, GPlatesPropertyValues::RawRasterNoDataValuePolicies::WithoutNoDataValue>::non_null_ptr_type> GPlatesFileIO::GDALRasterReader::read_data<GPlatesPropertyValues::RawRasterImpl<GPlatesGui::rgba8_t, GPlatesPropertyValues::RawRasterDataPolicies::WithData, GPlatesPropertyValues::RawRasterStatisticsPolicies::WithoutStatistics, GPlatesPropertyValues::RawRasterNoDataValuePolicies::WithoutNoDataValue> >(GPlatesFileIO::GDALRasterReader::RasterBand const&, bool, QRect const&) + 297
18 GPlates 2.3.0-Darwin-19.6.0 0x000000010908e786 void GPlatesFileIO::GDALRasterReader::hilbert_curve_traversal<GPlatesPropertyValues::RawRasterImpl<GPlatesGui::rgba8_t, GPlatesPropertyValues::RawRasterDataPolicies::WithData, GPlatesPropertyValues::RawRasterStatisticsPolicies::WithoutStatistics, GPlatesPropertyValues::RawRasterNoDataValuePolicies::WithoutNoDataValue> >(GPlatesFileIO::GDALRasterReader::RasterBand&, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, QDataStream&, GPlatesFileIO::RasterFileCacheFormat::BlockInfos&, boost::optional<GPlatesPropertyValues::RawRasterImpl<GPlatesGui::rgba8_t, GPlatesPropertyValues::RawRasterDataPolicies::WithData, GPlatesPropertyValues::RawRasterStatisticsPolicies::WithoutStatistics, GPlatesPropertyValues::RawRasterNoDataValuePolicies::WithoutNoDataValue>::non_null_ptr_type>, QRect, GPlatesFileIO::ReadErrorAccumulation*, double&, double&, double&, double&, long long&) + 230
19 GPlates 2.3.0-Darwin-19.6.0 0x000000010908e61a void GPlatesFileIO::GDALRasterReader::write_source_raster_file_cache_image_data<GPlatesPropertyValues::RawRasterImpl<GPlatesGui::rgba8_t, GPlatesPropertyValues::RawRasterDataPolicies::WithData, GPlatesPropertyValues::RawRasterStatisticsPolicies::WithoutStatistics, GPlatesPropertyValues::RawRasterNoDataValuePolicies::WithoutNoDataValue> >(GPlatesFileIO::GDALRasterReader::RasterBand&, QFile&, QDataStream&, GPlatesFileIO::RasterFileCacheFormat::BlockInfos&, GPlatesFileIO::ReadErrorAccumulation*, double&, double&, double&, double&, long long&) + 266
20 GPlates 2.3.0-Darwin-19.6.0 0x0000000109072d79 void GPlatesFileIO::GDALRasterReader::write_source_raster_file_cache<GPlatesPropertyValues::RawRasterImpl<GPlatesGui::rgba8_t, GPlatesPropertyValues::RawRasterDataPolicies::WithData, GPlatesPropertyValues::RawRasterStatisticsPolicies::WithoutStatistics, GPlatesPropertyValues::RawRasterNoDataValuePolicies::WithoutNoDataValue> >(GPlatesFileIO::GDALRasterReader::RasterBand&, QString const&, GPlatesFileIO::ReadErrorAccumulation*) + 841
21 GPlates 2.3.0-Darwin-19.6.0 0x000000010906ef0c GPlatesFileIO::GDALRasterReader::create_source_raster_file_cache(GPlatesFileIO::GDALRasterReader::RasterBand&, unsigned int, GPlatesFileIO::ReadErrorAccumulation*) + 220
22 GPlates 2.3.0-Darwin-19.6.0 0x000000010906ce83 GPlatesFileIO::GDALRasterReader::create_source_raster_file_cache_format_reader(GPlatesFileIO::GDALRasterReader::RasterBand&, unsigned int, GPlatesFileIO::ReadErrorAccumulation*) + 1443
23 GPlates 2.3.0-Darwin-19.6.0 0x000000010906b8c7 GPlatesFileIO::GDALRasterReader::GDALRasterReader(QString const&, GPlatesFileIO::RasterReader*, GPlatesFileIO::ReadErrorAccumulation*) + 359
24 GPlates 2.3.0-Darwin-19.6.0 0x00000001091a78c1 GPlatesFileIO::RasterReader::RasterReader(QString const&, GPlatesFileIO::ReadErrorAccumulation*) + 577
25 GPlates 2.3.0-Darwin-19.6.0 0x00000001091a72a3 GPlatesFileIO::RasterReader::create(QString const&, GPlatesFileIO::ReadErrorAccumulation*) + 67
26 GPlates 2.3.0-Darwin-19.6.0 0x000000010971e8b3 GPlatesQtWidgets::ImportRasterDialog::display(bool, GPlatesFileIO::ReadErrorAccumulation*) + 931
27 GPlates 2.3.0-Darwin-19.6.0 0x000000010983ae36 GPlatesQtWidgets::ViewportWindow::pop_up_import_raster_dialog(bool) + 246
28 GPlates 2.3.0-Darwin-19.6.0 0x00000001092cf431 GPlatesGui::ImportMenu::handle_action_triggered(QAction*) + 65
29 org.qt-project.QtCore 0x000000010b5e4120 0x10b48b000 + 1413408
30 org.qt-project.QtWidgets 0x000000010a7ef523 QActionGroup::triggered(QAction*) + 55
31 org.qt-project.QtCore 0x000000010b5e4120 0x10b48b000 + 1413408
32 org.qt-project.QtWidgets 0x000000010a7ee0d4 QAction::triggered(bool) + 56
33 org.qt-project.QtWidgets 0x000000010a7edfb8 QAction::activate(QAction::ActionEvent) + 224
34 org.qt-project.QtCore 0x000000010b5df43f QObject::event(QEvent*) + 693
35 org.qt-project.QtWidgets 0x000000010a7f402a QApplicationPrivate::notify_helper(QObject*, QEvent*) + 212
36 org.qt-project.QtWidgets 0x000000010a7f4e87 QApplication::notify(QObject*, QEvent*) + 481
37 GPlates 2.3.0-Darwin-19.6.0 0x00000001092c491c GPlatesGui::GPlatesQApplication::notify(QObject*, QEvent*) + 156
38 org.qt-project.QtCore 0x000000010b5c556c QCoreApplication::notifyInternal2(QObject*, QEvent*) + 138
39 org.qt-project.QtCore 0x000000010b5c60e0 QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) + 392
40 libqcocoa.dylib 0x0000000112a156c2 0x1129e6000 + 194242
41 libqcocoa.dylib 0x0000000112a15c6e 0x1129e6000 + 195694
42 com.apple.CoreFoundation 0x00007fff2ea93f92 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
43 com.apple.CoreFoundation 0x00007fff2ea93f31 __CFRunLoopDoSource0 + 103
44 com.apple.CoreFoundation 0x00007fff2ea93d4b __CFRunLoopDoSources0 + 209
45 com.apple.CoreFoundation 0x00007fff2ea92a7a __CFRunLoopRun + 927
46 com.apple.CoreFoundation 0x00007fff2ea9207e CFRunLoopRunSpecific + 462
47 com.apple.HIToolbox 0x00007fff2d710aad RunCurrentEventLoopInMode + 292
48 com.apple.HIToolbox 0x00007fff2d7107c5 ReceiveNextEventCommon + 584
49 com.apple.HIToolbox 0x00007fff2d710569 _BlockUntilNextEventMatchingListInModeWithFilter + 64
50 com.apple.AppKit 0x00007fff2bd593c9 _DPSNextEvent + 883
51 com.apple.AppKit 0x00007fff2bd57c10 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352
52 com.apple.AppKit 0x00007fff2bd4991e -[NSApplication run] + 658
53 libqcocoa.dylib 0x0000000112a14eb0 0x1129e6000 + 192176
54 org.qt-project.QtCore 0x000000010b5c31f8 QEventLoop::exec(QFlagsQEventLoop::ProcessEventsFlag) + 284
55 org.qt-project.QtCore 0x000000010b5c59db QCoreApplication::exec() + 123
56 GPlates 2.3.0-Darwin-19.6.0 0x0000000108de1356 internal_main(int, char**) + 1494
57 GPlates 2.3.0-Darwin-19.6.0 0x00000001092c599c GPlatesGui::GPlatesQApplication::call_main(int (*)(int, char**), int, char**) + 108
58 libdyld.dylib 0x00007fff67b12cc9 start + 1

Thread 1:
0 libsystem_pthread.dylib 0x00007fff67d12b68 start_wqthread + 0

Thread 2:: Qt bearer thread
0 libsystem_kernel.dylib 0x00007fff67c5a3c6 poll + 10
1 org.qt-project.QtCore 0x000000010b601d5f qt_safe_poll(pollfd*, unsigned int, timespec const*) + 187
2 org.qt-project.QtCore 0x000000010b602a66 QEventDispatcherUNIX::processEvents(QFlagsQEventLoop::ProcessEventsFlag) + 356
3 org.qt-project.QtCore 0x000000010b5c31f8 QEventLoop::exec(QFlagsQEventLoop::ProcessEventsFlag) + 284
4 org.qt-project.QtCore 0x000000010b4a7604 QThread::exec() + 86
5 org.qt-project.QtCore 0x000000010b4a8224 0x10b48b000 + 119332
6 libsystem_pthread.dylib 0x00007fff67d17109 _pthread_start + 148
7 libsystem_pthread.dylib 0x00007fff67d12b8b thread_start + 15

Thread 3:: Thread (pooled)
0 libsystem_kernel.dylib 0x00007fff67c56872 __psynch_cvwait + 10
1 libsystem_pthread.dylib 0x00007fff67d17425 _pthread_cond_wait + 698
2 org.qt-project.QtCore 0x000000010b4ad713 0x10b48b000 + 141075
3 org.qt-project.QtCore 0x000000010b4ad519 0x10b48b000 + 140569
4 org.qt-project.QtCore 0x000000010b4ad484 QWaitCondition::wait(QMutex*, QDeadlineTimer) + 108
5 org.qt-project.QtCore 0x000000010b4aa88e 0x10b48b000 + 129166
6 org.qt-project.QtCore 0x000000010b4a8224 0x10b48b000 + 119332
7 libsystem_pthread.dylib 0x00007fff67d17109 _pthread_start + 148
8 libsystem_pthread.dylib 0x00007fff67d12b8b thread_start + 15

Thread 4:
0 libsystem_pthread.dylib 0x00007fff67d12b68 start_wqthread + 0

Thread 5:: com.apple.NSEventThread
0 libsystem_kernel.dylib 0x00007fff67c53dea mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fff67c54160 mach_msg + 60
2 com.apple.CoreFoundation 0x00007fff2ea94135 __CFRunLoopServiceMachPort + 247
3 com.apple.CoreFoundation 0x00007fff2ea92c02 __CFRunLoopRun + 1319
4 com.apple.CoreFoundation 0x00007fff2ea9207e CFRunLoopRunSpecific + 462
5 com.apple.AppKit 0x00007fff2befabf4 _NSEventThread + 132
6 libsystem_pthread.dylib 0x00007fff67d17109 _pthread_start + 148
7 libsystem_pthread.dylib 0x00007fff67d12b8b thread_start + 15

Thread 6:: com.apple.CFSocket.private
0 libsystem_kernel.dylib 0x00007fff67c5c0ee __select + 10
1 com.apple.CoreFoundation 0x00007fff2eabce93 __CFSocketManager + 641
2 libsystem_pthread.dylib 0x00007fff67d17109 _pthread_start + 148
3 libsystem_pthread.dylib 0x00007fff67d12b8b thread_start + 15

Thread 7:: GPlatesApi::PythonExecutionThread
0 libsystem_kernel.dylib 0x00007fff67c5a3c6 poll + 10
1 org.qt-project.QtCore 0x000000010b601d5f qt_safe_poll(pollfd*, unsigned int, timespec const*) + 187
2 org.qt-project.QtCore 0x000000010b602a66 QEventDispatcherUNIX::processEvents(QFlagsQEventLoop::ProcessEventsFlag) + 356
3 org.qt-project.QtCore 0x000000010b5c31f8 QEventLoop::exec(QFlagsQEventLoop::ProcessEventsFlag) + 284
4 GPlates 2.3.0-Darwin-19.6.0 0x0000000108e5bfdf GPlatesApi::PythonExecutionThread::run() + 287
5 org.qt-project.QtCore 0x000000010b4a8224 0x10b48b000 + 119332
6 libsystem_pthread.dylib 0x00007fff67d17109 _pthread_start + 148
7 libsystem_pthread.dylib 0x00007fff67d12b8b thread_start + 15

Thread 8:
0 libsystem_pthread.dylib 0x00007fff67d12b68 start_wqthread + 0

Thread 9:
0 libsystem_pthread.dylib 0x00007fff67d12b68 start_wqthread + 0

Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000 rbx: 0x0000000116778dc0 rcx: 0x00007ffee6e22bf8 rdx: 0x0000000000000000
rdi: 0x0000000000000307 rsi: 0x0000000000000006 rbp: 0x00007ffee6e22c20 rsp: 0x00007ffee6e22bf8
r8: 0x00000000000003fd r9: 0xcccccccccccccccd r10: 0x0000000116778dc0 r11: 0x0000000000000246
r12: 0x0000000000000307 r13: 0x0000000129ff9000 r14: 0x0000000000000006 r15: 0x0000000000000016
rip: 0x00007fff67c5a32a rfl: 0x0000000000000246 cr2: 0x0000000129ff9000

Logical CPU: 0
Error Code: 0x02000148
Trap Number: 133

Hi Christian,

Interesting, sounds like it could be a GDAL issue.

Does the gplates_2.3.1-beta.8_Darwin-x86_64.dmg build in this post have the same problem? That uses GDAL 3.7 whereas GPlates 2.3 uses GDAL 2.9 (as far as I can tell).

I tried creating a cloud-optimised geotiff (the same way you did) and importing that into GPlates 2.3 (on macOS 10.15). That worked for me though. If the above GPlates build still crashes feel free to send me the TIF that causes your crash.

Hi John,

haven’t had time to try the beta version yet.

whereas GPlates 2.3 uses GDAL 2.9 (as far as I can tell).

yes, that sounds like this is the root cause. Cloud optimised geotifs were only added in GDAL 3.6 or so, I think.

If you don’t hear from me it’s worked in the beta and consider it fixed, otherwise I’ll report back.

Thanks for the pointer and the link to the beta.

Cheers,
Christian

Does the gplates_2.3.1-beta.8_Darwin-x86_64.dmg build in this post have the same problem?

No - It all works! ™

Cheers,
Christian