Repository navigation
Conversation
vips_region_fetch evaluates the pipeline just like copy_memory and write_to_memory, so other Ruby threads stall until it returns. With a SourceCustom image it deadlocks, as libvips calls the read callback from a worker thread, which needs the GVL held by the thread in fetch.
Member
|
Please do not use LLMs to generate code or PR descriptions when contributing to libvips: EvidenceThe GitHub audit log indicate that the contribution was made using Claude Code: user_agent GitHub CLI 2.95.0 Agent/claude-code_2-1-330_agent |
Member
Contributor
Author
|
Thanks @kleisauke! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
vips_region_fetchevaluates the pipeline just likecopy_memoryandwrite_to_memory, so this attaches it withblocking: trueas well, following #446.Besides stalling other Ruby threads, holding the GVL here can deadlock the process when the image comes from a
Vips::SourceCustom. libvips calls the read callback from a worker thread, and that callback needs the GVL, which the thread insidefetchis holding. This came up while adding IO streaming to ImageProcessing, which loads images from aSourceCustom. There, callingwrite_to_memoryon ruby-vips 2.3.0 deadlocked the process. #446 fixes that on master, andfetchis the remaining call that evaluates the pipeline while holding the GVL.🤖 Generated with Claude Code