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

Ractor Binary Copy Error #594

Open
LRFalk01 opened this issue Oct 15, 2024 · 2 comments
Open

Ractor Binary Copy Error #594

LRFalk01 opened this issue Oct 15, 2024 · 2 comments

Comments

@LRFalk01
Copy link

When attempting to run a 'copy_data' within a Ractor using binary format, I receive the following error:

lib/pg/connection.rb:223:in `copy_data': can not access non-shareable objects in constant PG::Connection::BinarySignature by non-main ractor. (Ractor::IsolationError)

This appears to be resolved if I freeze the constant:

PG::Connection::BinarySignature = "PGCOPY\n\377\r\n\0".b.freeze

When running copy_data with the default TextEncoder path, it just works. I think the fix here is probably to just freeze the constant defined here.

@larskanis
Copy link
Collaborator

Alternative solution is to remove the .b from the BinarySignature. Then the frozen_string_literals come into action, so that it becomes shareable. I'll prepare a PR with test case.

Anyway I'm happy to see there is someone out there who's using the new Ractor support!

@LRFalk01
Copy link
Author

I'm happy that RubyPG has Ractor support! 😂

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

No branches or pull requests

2 participants