Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial Ractor support #365

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sandlerr
Copy link

Allows users to create / open databases, send queries, and process ResultSets inside a Ractor. However, does not allow passing the gem's domain objects through the Ractor communication channels.

See #299 .

@sandlerr sandlerr mentioned this pull request Dec 28, 2022
test/test_integration_ractor.rb Outdated Show resolved Hide resolved
@sandlerr
Copy link
Author

sandlerr commented Jan 5, 2023

Is there any outstanding feedback here? Thanks

Copy link
Member

@tenderlove tenderlove left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems fine to me. I haven't investigated everything we need to do to make C extensions Ractor safe but I think this is fine to start with!

@flavorjones
Copy link
Member

Great, I'll rebase and merge it today or tomorrow.

@flavorjones
Copy link
Member

flavorjones commented Jan 10, 2024

So it seems like in Ruby 3.3, trying to pass a Database between ractors results in a Ractor::RemoteError being raised; but in earlier versions of Ruby it makes an implicit copy of the object. This means that the test_ractor_share_database test hangs.

I'm not sure if this is intentional behavior or not. @sandlerr or @tenderlove do you know?

Edit: to be explicit, the RemoteError is wrapping Ractor::Error: can not copy SQLite3::Database object.

@flavorjones
Copy link
Member

OK, that exception started to get raised in ruby/ruby@ce47ee00 as a fix, so I'm just going to adapt the test to the different behaviors before and after 3.3.0.

@flavorjones flavorjones force-pushed the sandlerr/ractor branch 2 times, most recently from 0f4db3d to 104ea23 Compare January 10, 2024 22:09
@tenderlove tenderlove mentioned this pull request Jan 10, 2024
19 tasks
@flavorjones
Copy link
Member

The stress test hangs under Ruby 3.3 with as few as 3 ractor writers, and it's not clear to me why.

@flavorjones flavorjones self-requested a review January 11, 2024 04:05
@tenderlove tenderlove self-assigned this Jan 24, 2024
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.

3 participants