Skip to content

Use Process._fork hook to handle dispatcher thread cleanup logic #386

@pedro-stanaka

Description

@pedro-stanaka

Summary

In Ruby 3.1 we introduced the Process._fork (see PR), which was targeted at the specific use case that we have in the library, where we need to keep track of fork() calls and properly handle state cleaning/flushing on dispatcher threads.

We should replace the complex logic for handling dispatcher threads in both the Aggregator and the BatchedSink with those hooks. If possible, create some kind of cross cutting module that uses some kind of Pub/Sub architecture to let the interested components know a fork happened.

Caveats

Note that since that is a feature from Ruby 3.1 we would have to drop support for Ruby < 3.1. But that should not be a problem since, at the time of this writing, 3.0 is EOL (April 2024) and 3.4 is on the verge of going GA.

Relates to #384

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions