{"id":18739623,"url":"https://github.com/springmeyer/gdal-atexit-crash","last_synced_at":"2025-10-07T17:55:25.465Z","repository":{"id":17660858,"uuid":"20465472","full_name":"springmeyer/gdal-atexit-crash","owner":"springmeyer","description":"Testcase for gdal crash at exit","archived":false,"fork":false,"pushed_at":"2014-06-04T18:27:54.000Z","size":1860,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-05-20T04:35:09.008Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/springmeyer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-04T01:07:02.000Z","updated_at":"2019-08-13T15:43:04.000Z","dependencies_parsed_at":"2022-08-30T09:01:45.001Z","dependency_job_id":null,"html_url":"https://github.com/springmeyer/gdal-atexit-crash","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/springmeyer/gdal-atexit-crash","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/springmeyer%2Fgdal-atexit-crash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/springmeyer%2Fgdal-atexit-crash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/springmeyer%2Fgdal-atexit-crash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/springmeyer%2Fgdal-atexit-crash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/springmeyer","download_url":"https://codeload.github.com/springmeyer/gdal-atexit-crash/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/springmeyer%2Fgdal-atexit-crash/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278820076,"owners_count":26051765,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T15:36:36.819Z","updated_at":"2025-10-07T17:55:25.434Z","avatar_url":"https://github.com/springmeyer.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"## GDAL crash atexit\n\n[![Build Status](https://secure.travis-ci.org/springmeyer/gdal-atexit-crash.png)](https://travis-ci.org/springmeyer/gdal-atexit-crash) (should be failing)\n\nReduced testcase for:\n\n - http://trac.osgeo.org/gdal/ticket/5509\n\n## Depends\n\n - GDAL: gdal-config on PATH\n - make / autotools\n - libuv: no need for external install as libuv will be built on the fly\n\n## Details\n\nVersions of GDAL this testcase does crash with:\n\n  - libgdal1h amd64 1.10.0-1~precise1\n  - `brew install gdal` on OS X 10.9 which brings in gdal-1.11.0\n  - gdal-1.11.0 built as minimal static lib by mapnik-packaging\n  - gdal trunk built as minimal static lib by mapnik-packaging\n\nVersions of GDAL this testcase does not crash with:\n\n  - gdal-1.10.1 built as minimal static lib by mapnik-packaging\n\nTODO: test gdal-1.10.1 from source on ubuntu precise\n\n## Discussion\n\nThis testcase demonstrates a segfault that happens in a thread as it exits.\n\nThe testcase includes:\n\n  - test.cpp - A command line program that runs a thread of work using libuv\n  - libtest - A shared library that loads gdal_plugin and calls a symbol from it in the thread pool\n  - gdal_plugin - A shared library that links to libgdal and reads a GeoTIFF\n\nThis design mirrors the situation of using Mapnik via Node.js (where the [original crash was encountered](https://github.com/mapnik/node-mapnik/issues/251)) because:\n\n  - node uses `dlopen` to open c++ addons\n  - in the case of node-mapnik, it links to the libmapnik shared library\n  - the libmapnik shared library uses `dlopen` to open `gdal.input`\n  - `gdal.input` links to the libgdal library\n\nI've found that if GDAL is statically or dynamically linked into the main process or libmapnik then this crash does not happen, so the testcase, in order to prompt the crash makes sure to load using dlopen.\n\n## Build\n\nTo build the testcase do:\n\n    make\n\nThen to run the crasher do:\n\n    make test\n\nThe expected output is:\n\n```sh\n./run-test\nmake: *** [test] Segmentation fault: 11\n```\n\nBacktrace on OS X (that can be found at `~/Library/Logs/DiagnosticReports/`) looks like:\n\n```\nThread 0:: Dispatch queue: com.apple.main-thread\n0   libsystem_kernel.dylib          0x00007fff8e41da1a mach_msg_trap + 10\n1   libsystem_kernel.dylib          0x00007fff8e41cd18 mach_msg + 64\n2   libsystem_kernel.dylib          0x00007fff8e41850b semaphore_destroy + 91\n3   libsystem_platform.dylib        0x00007fff84664428 _os_semaphore_dispose + 23\n4   libsystem_pthread.dylib         0x00007fff8316587a pthread_join + 568\n5   run-test                        0x00000001056db3fe uv_thread_join + 14\n6   run-test                        0x00000001056dbadb cleanup + 139\n7   dyld                            0x00007fff5fe42ef5 ImageLoaderMachO::doTermination(ImageLoader::LinkContext const\u0026) + 215\n8   dyld                            0x00007fff5fe33279 dyld::runTerminators(void*) + 69\n9   libsystem_c.dylib               0x00007fff8602d7a1 __cxa_finalize + 177\n10  libsystem_c.dylib               0x00007fff8602da4c exit + 22\n11  libdyld.dylib                   0x00007fff8fbe2604 start + 8\n\nThread 1 Crashed:\n0   ???                             0x000000010593fb90 0 + 4388551568\n1   libsystem_pthread.dylib         0x00007fff8316554f _pthread_tsd_cleanup + 86\n2   libsystem_pthread.dylib         0x00007fff83162479 _pthread_exit + 111\n3   libsystem_pthread.dylib         0x00007fff831618a4 _pthread_body + 149\n4   libsystem_pthread.dylib         0x00007fff8316172a _pthread_start + 137\n5   libsystem_pthread.dylib         0x00007fff83165fc9 thread_start + 13\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspringmeyer%2Fgdal-atexit-crash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspringmeyer%2Fgdal-atexit-crash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspringmeyer%2Fgdal-atexit-crash/lists"}