patch fork to avoid "libc++abi: terminating due to uncaught exception of type"

Description

patch fork to avoid message:

libc++abi: terminating due to uncaught exception of type std::__1::system_error: thread::join failed: No such process

 

Customer’s suggestion is to do what Shopify did - https://github.com/Shopify/grpc_fork_safety/blob/main/lib/grpc_fork_safety/patch.rb

You should consider patching _fork in Ruby as a potential solution, as it allows custom code execution before and after fork events. This seems aligned with best practices for application monitoring libraries. 

If I’m not mistaken, the fork is in couchbase c++ library, so I don’t know that it is applicable.

Maybe just check for thread.joinable() before calling thread.join() in couchbase-cxx-client ?

Environment

None

Release Notes Description

None

Activity

Show:

Sergey Auseyau February 26, 2025 at 12:40 AM

Jack Bakes February 21, 2025 at 9:36 AM

If I’m not mistaken, the fork is in couchbase c++ library, so I don’t know that it is applicable.

Maybe just check for thread.joinable() before calling thread.join() in couchbase-cxx-client ?

My understanding is that the c++ client already has an API for fork safety (introduced inhttps://jira.issues.couchbase.com/browse/CXXCBC-448 ) in the form of a cluster method which should be called before/after process forking (cluster.notify_fork), as demonstrated in this example:

https://github.com/couchbase/couchbase-cxx-client/blob/47e884717b265766b81e2a495f2493ff69e61d73/test/test_integration_examples.cxx#L752

The issue is that the Ruby client doesn’t call these methods, and the suggestion is that we override Ruby’s Process._fork method to ensure that these get called.

For further context, here is some past discussion on the Ruby issues tracker around features for handling this case:

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Fix versions

Story Points

Priority

Instabug

Open Instabug

Sentry

Zendesk Support

Created February 20, 2025 at 6:09 PM
Updated March 17, 2025 at 9:53 PM
Resolved March 17, 2025 at 9:53 PM
Instabug