-
-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Paperclip styles syntax #12812
Paperclip styles syntax #12812
Conversation
This is an odd case of multiple people being wrong, I think. |
Yes, you are correct. I am still looking into this. All I did was bypass the styles, it solves the problem but it's a work around and not the real issue. I will continue to dig deeper into this, tested this just now but no luck. It really looks like something to do with Docker but can't find the source. |
You said the jobs were getting stuck. Were you getting |
No error. Even Rails debug didn't show a thing. It just reaches this point and freezes:
If multiple jobs get stuck like this, federation just stops indefinitely. Jobs don't timeout when they are stuck like this. It happened yesterday to a couple of instances I host. All because a single user from a MissKey instance had an animated gif header with dimensions that needed resize and posts from that user were boosted. Every boost got a different job and every job froze attempting to fetch the header. This is what caused me to rush out with a fix because I couldn't have instances that stop to federate. Initially I thought it was the STDOUT overflow error that caused previous issues #9368 and #12088 but adding loglevel on the command did not solve it. |
So, what I found:
The specific gif that caused this issue had 200 frames with 1280x620 and 578 KB. It takes MS over 20 seconds to process this image and by the limits in place (2MB no frame limit) it could be 3 times larger. |
After looking more into this, I believe that animated gifs will always be tricky to convert/resize. I couldn't find a simple solution. Currently the header/avatar is being handled by Paperclip/ImageMagick and like ImageMagick resize animation page says:
I am currently testing just setting a timeout for ImageMagick via environment variables MAGICK_TIME_LIMIT to see if that helps to avoid freezing Sidekiq jobs. Like mentioned on PaperClip docs. It won't solve the problem but hopefully it avoids halting Sidekiq. |
I was running into an issue where Sidekiq was getting jobs stuck indefinitely when attempting to import a new account header. Doing the manual regenerate via the web interface also failed.
After digging around, I found that it only happened on header files using animated gifs that needed conversion/rescaling and only on instances using Docker.
What worked for me was changing
styles
tostyle
on paperclip calls as mentioned here: thoughtbot/paperclip#1405 (comment)This puzzles me because PaperClip is deprecated and according to that user (in 2016)
style
was the new syntax. Also, can't understand why it only affects Dockers installs.So, I don't know if this will break for others (not using Docker) and it would be great if someone tested it as I don't have a non Docker test setup.
Also, https://github.com/tootsuite/mastodon/blob/master/app/models/preview_card.rb also uses
styles
but haven't tested it and didn't what to PR before I do.