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

MiniMagick::Image @tempfile exists after GC? #555

Closed
fuminori-ido-m opened this issue Sep 6, 2023 · 2 comments
Closed

MiniMagick::Image @tempfile exists after GC? #555

fuminori-ido-m opened this issue Sep 6, 2023 · 2 comments

Comments

@fuminori-ido-m
Copy link

MiniMagick::Image.create creates @tempfile (ruby Tempfile object) at:

tempfile = MiniMagick::Utilities.tempfile(ext.to_s.downcase, &block)

at MiniMagick::Utilities#tempfile:

Tempfile.new(["mini_magick", ...

Is this @tempfile guaranteed to exist during minimagick operation (e.g. convert)? I'm asking this question because:

  1. This temporary file is sometimes disappeared under high CPU pressure in our application.
  2. ruby Tempfile is deleted at GC and at exit according to ruby doc.
@janko
Copy link
Member

janko commented Sep 6, 2023

The tempfile should only deleted by GC if nothing is referencing the Tempfile object anymore. MiniMagick is internally implemented to keep a reference while commands are being executed. Is there any specific code you're concerned about?

@fuminori-ido-m
Copy link
Author

Thank you for your prompt reply, @janko !

MiniMagick is internally implemented to keep a reference while commands are being executed

I think so too and I couldn't reproduce tempfile disappearance while enforce GC.start in my debug console during minimagick operation. But... I saw sometimes tempfile disappearance happened during minimagick convert operation under CPU high pressure.

It could be another reason of tempfile disappearance (maybe disk size shortage(even though I already checked it), or something??) so please close this issue if you do not see any problem.

@janko janko closed this as completed Jun 7, 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

No branches or pull requests

2 participants