Skip to content

Conversation

@chikle9090
Copy link
Contributor

This PR fixes the intermittent failure in the test_fork test on macOS by preventing database re-initialization inside forked child processes. The change makes the test stable by using a safe EPSG code in child processes so no new registry is created. This resolves the occasional SQLite I/O error seen on macOS.

@rouault
Copy link
Member

rouault commented Nov 24, 2025

The change makes the test stable by using a safe EPSG code in child processes so no new registry is created. This resolves the occasional SQLite I/O error seen on macOS.

This change actually hides the purpose of his test. But this test only works if the sqlite build supports pread(), which I believe Mac doesn't. So this means using proj with fork() on Mac is not safe. Probably that this test should just be enabled on Linux.

@chikle9090
Copy link
Contributor Author

Thanks for the explanation. I understand. Would the appropriate solution in this case be to disable this test on macOS instead of modifying the EPSG codes? If yes, could you please guide me on where/how the test should be conditionally disabled for macOS?

@rouault
Copy link
Member

rouault commented Nov 24, 2025

Thanks for the explanation. I understand. Would the appropriate solution in this case be to disable this test on macOS instead of modifying the EPSG codes? If yes, could you please guide me on where/how the test should be conditionally disabled for macOS?

Likely this patch:

--- a/test/unit/CMakeLists.txt
+++ b/test/unit/CMakeLists.txt
@@ -255,7 +255,7 @@ add_test(NAME test_misc COMMAND test_misc)
 set_property(TEST test_misc
   PROPERTY ENVIRONMENT ${PROJ_TEST_ENVIRONMENT})
 
-if (Threads_FOUND AND CMAKE_USE_PTHREADS_INIT)
+if (Threads_FOUND AND CMAKE_USE_PTHREADS_INIT AND NOT APPLE)
 add_definitions(-DPROJ_HAS_PTHREADS)
 add_executable(test_fork
   test_fork.c)

@rouault
Copy link
Member

rouault commented Nov 24, 2025

Please rebase on top of latest master, and revert the EPSG code changes

@chikle9090 chikle9090 force-pushed the fix/test_fork-macos-reset branch from ac35fb3 to 1b42cd6 Compare November 25, 2025 03:34
@rouault rouault merged commit 7c49f22 into OSGeo:master Nov 27, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants