Skip to content

ChunkyPNG::Canvas.from_file fails outside main Ractor #170

@TheHashTableSlasher

Description

@TheHashTableSlasher

Trying to run the following code:

require 'chunky_png'

ractor = Ractor.new { ChunkyPNG::Canvas.from_file("some_image.png") }
img = ractor.take
# do something with img...

results in a Ractor::IsolationError saying that some constant is non-shareable. To work around this, I had to manually freeze any constants that were accessed by the call. These were the ones I had to freeze for this specific example (i.e. putting this code at the top allows the example to run):

ChunkyPNG::Chunk::CHUNK_TYPES.freeze
ChunkyPNG::EXTRA_BYTE.freeze

I haven't messed around with any of the other functions yet, so I'm sure there are other non-frozen constants in the library that may need to be frozen to allow some methods to work with Ractors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions