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

500 Error processing thumbnail for uploaded media #13099

Closed
raphgilles opened this issue Feb 17, 2020 · 23 comments
Closed

500 Error processing thumbnail for uploaded media #13099

raphgilles opened this issue Feb 17, 2020 · 23 comments

Comments

@raphgilles
Copy link

raphgilles commented Feb 17, 2020

Hello,

I have a problem on a fresh instance. All worked fine, and I don't know why I can't upload on it anymore and the instance don't parse external medias too.

I have nothing in logs and in Sidekiq. Just this error when I try to upload. So I investigate and it seems to be an error due to a thing called Paperclip. But not sure.

Have someone an idea ?

Thank you !

@ClearlyClaire
Copy link
Contributor

Can you check if by any chance your Gemfile.lock has been modified?

@raphgilles
Copy link
Author

Hello,
What can I do for that ? I have my Gemfile.lock but how to know if it has been modified ?

@ClearlyClaire
Copy link
Contributor

git diff Gemfile.lock should do it

@raphgilles
Copy link
Author

Thank you. It returned nothing :

$ git diff Gemfile.lock
$

@raphgilles
Copy link
Author

I must to precise that I tried to reinstall but with the same issue.
I don't understand because all worked and stopped instantly without any action from me.

@Gargron
Copy link
Member

Gargron commented Feb 17, 2020

Do you have imagemagick installed?

@ClearlyClaire
Copy link
Contributor

Hm, ok. Do you happen to have the full log for what made you think the issue was with Paperclip?

The error should be in mastdon-web's logs (journalctl -u mastodon-web --follow)

@Gargron
Copy link
Member

Gargron commented Feb 17, 2020

Is your disk full by any chance?

@raphgilles
Copy link
Author

raphgilles commented Feb 17, 2020

Do you have imagemagick installed?

Yes !

Hm, ok. Do you happen to have the full log for what made you think the issue was with Paperclip?

The error should be in mastdon-web's logs (journalctl -u mastodon-web --follow)

It result this :

Feb 17 16:29:02 stuntSOCIAL-2gb-nbg1-1 bundle[28264]: [07cb7f5a-9012-4a79-880e-c9c8c2206a5d] [paperclip] Trying to link /tmp/RackMultipart20200217-28337-aaxxaq.jpg to /tmp/535d2bfc8ba3df4794188a7457eec17d20200217-28337-z4rul2.jpg
Feb 17 16:29:02 stuntSOCIAL-2gb-nbg1-1 bundle[28264]: [07cb7f5a-9012-4a79-880e-c9c8c2206a5d] Command :: file -b --mime '/tmp/535d2bfc8ba3df4794188a7457eec17d20200217-28337-z4rul2.jpg'
Feb 17 16:29:02 stuntSOCIAL-2gb-nbg1-1 bundle[28264]: [07cb7f5a-9012-4a79-880e-c9c8c2206a5d] [paperclip] Trying to link /tmp/535d2bfc8ba3df4794188a7457eec17d20200217-28337-z4rul2.jpg to /tmp/5f2a952e61748c64a6da1ae929d4f4df20200217-28337-3n9cd1.jpg
Feb 17 16:29:02 stuntSOCIAL-2gb-nbg1-1 bundle[28264]: [07cb7f5a-9012-4a79-880e-c9c8c2206a5d] Command :: file -b --mime '/tmp/5f2a952e61748c64a6da1ae929d4f4df20200217-28337-3n9cd1.jpg'
Feb 17 16:29:02 stuntSOCIAL-2gb-nbg1-1 bundle[28264]: [07cb7f5a-9012-4a79-880e-c9c8c2206a5d] Command :: identify -format %m '/tmp/535d2bfc8ba3df4794188a7457eec17d20200217-28337-z4rul2.jpg[0]'
Feb 17 16:29:02 stuntSOCIAL-2gb-nbg1-1 bundle[28264]: [07cb7f5a-9012-4a79-880e-c9c8c2206a5d] method=POST path=/api/v1/media format=html controller=Api::V1::MediaController action=create status=500 duration=35.42 view=1.05 db=1.25
Feb 17 16:29:08 stuntSOCIAL-2gb-nbg1-1 bundle[28264]: [dd4064e0-f601-4612-a69d-310bdd2554a3] method=GET path=/api/v1/timelines/home format=html controller=Api::V1::Timelines::HomeController action=show status=200 duration=24.23 view=1.33 db=5.61

Is your disk full by any chance?

And no !

@Gargron
Copy link
Member

Gargron commented Feb 17, 2020

I don't see a clear error. Could it be imagemagick runs out of RAM while trying to convert the image, and so the upload cancels?

@raphgilles
Copy link
Author

Mmhhh. That's something to verify. I have only 2GB of memory on this VPS and less than 100MB free.

@raphgilles
Copy link
Author

raphgilles commented Feb 17, 2020

Ok, I upgraded to 4GB with 2GB free, but it's not that.

Can it be in rapport with an upgrade of Node ? The only thing I did after installation was to upgrade node (v10.19.0).

@ClearlyClaire
Copy link
Contributor

no, node isn't involved in this
it's weird you'd have a 500 error without an actual exception and a stack trace…

@raphgilles
Copy link
Author

I continue to investigate, but I repeat the same things since yesterday because I have no idea about what happened.

I also checked to chdown to the mastodon user the access of all folders.

@ClearlyClaire
Copy link
Contributor

oh, we do eat paperclip errors without giving any more information… interesting

@ClearlyClaire
Copy link
Contributor

Could you edit app/controllers/api/v1/media_controller.rb to replace:

  rescue Paperclip::Error
    render json: processing_error, status: 500
  end

with

  rescue Paperclip::Error => e
    Rails.logger.warn "#{e}"
    render json: processing_error, status: 500
  end

restart mastodon-web, try again and check the logs?

@raphgilles
Copy link
Author

Yes! I have this.

Feb 18 01:42:07 stuntSOCIAL-2gb-nbg1-1 bundle[11732]: [6d6bd7dc-6a32-450d-9a3c-5c5efb17ea2c] [paperclip] Trying to link /tmp/RackMultipart20200218-11783-19oddoh.jpg to /tmp/535d2bfc8ba3df4794188a7457eec17d20200218-11783-1f1tgew.jpg
Feb 18 01:42:07 stuntSOCIAL-2gb-nbg1-1 bundle[11732]: [6d6bd7dc-6a32-450d-9a3c-5c5efb17ea2c] Command :: file -b --mime '/tmp/535d2bfc8ba3df4794188a7457eec17d20200218-11783-1f1tgew.jpg'
Feb 18 01:42:07 stuntSOCIAL-2gb-nbg1-1 bundle[11732]: [6d6bd7dc-6a32-450d-9a3c-5c5efb17ea2c] [paperclip] Trying to link /tmp/535d2bfc8ba3df4794188a7457eec17d20200218-11783-1f1tgew.jpg to /tmp/efca2e78ff494d78002ff9fca3c32b2420200218-11783-79l00h.jpg
Feb 18 01:42:07 stuntSOCIAL-2gb-nbg1-1 bundle[11732]: [6d6bd7dc-6a32-450d-9a3c-5c5efb17ea2c] Command :: file -b --mime '/tmp/efca2e78ff494d78002ff9fca3c32b2420200218-11783-79l00h.jpg'
Feb 18 01:42:07 stuntSOCIAL-2gb-nbg1-1 bundle[11732]: [6d6bd7dc-6a32-450d-9a3c-5c5efb17ea2c] Command :: identify -format %m '/tmp/535d2bfc8ba3df4794188a7457eec17d20200218-11783-1f1tgew.jpg[0]'
Feb 18 01:42:07 stuntSOCIAL-2gb-nbg1-1 bundle[11732]: [6d6bd7dc-6a32-450d-9a3c-5c5efb17ea2c] There was an error running identify for 535d2bfc8ba3df4794188a7457eec17d20200218-11783-1f1tgew
Feb 18 01:42:07 stuntSOCIAL-2gb-nbg1-1 bundle[11732]: [6d6bd7dc-6a32-450d-9a3c-5c5efb17ea2c] method=POST path=/api/v1/media format=html controller=Api::V1::MediaController action=create status=500 duration=232.27 view=4.74 db=19.56

@raphgilles
Copy link
Author

Another information. When I try to upload a video :

-- Logs begin at Sat 2020-02-15 11:54:46 CET. --
Feb 18 02:15:41 vloggersSOCIAL-stuntSOCIAL-2gb-nbg1-1 bundle[13939]: [32e9ccb0-bde0-4092-9a79-b72a4f97ee99]
Feb 18 02:15:41 vloggersSOCIAL-stuntSOCIAL-2gb-nbg1-1 bundle[13939]: [32e9ccb0-bde0-4092-9a79-b72a4f97ee99] Terrapin::ExitStatusError (Command 'convert '/tmp/312f7900422182c9e563d7a496a2415420200218-13970-1x889yx20200218-13970-j851j7.png' RGB:-' returned 1. Expected 0
Feb 18 02:15:41 vloggersSOCIAL-stuntSOCIAL-2gb-nbg1-1 bundle[13939]: Here is the command output: STDOUT:
Feb 18 02:15:41 vloggersSOCIAL-stuntSOCIAL-2gb-nbg1-1 bundle[13939]: STDERR:
Feb 18 02:15:41 vloggersSOCIAL-stuntSOCIAL-2gb-nbg1-1 bundle[13939]: convert: no decode delegate for this image format PNG' @ error/constitute.c/ReadImage/562. Feb 18 02:15:41 vloggersSOCIAL-stuntSOCIAL-2gb-nbg1-1 bundle[13939]: convert: no images defined RGB:-' @ error/convert.c/ConvertImageCommand/3273.
Feb 18 02:15:41 vloggersSOCIAL-stuntSOCIAL-2gb-nbg1-1 bundle[13939]: ):
Feb 18 02:15:41 vloggersSOCIAL-stuntSOCIAL-2gb-nbg1-1 bundle[13939]: [32e9ccb0-bde0-4092-9a79-b72a4f97ee99]
Feb 18 02:15:41 vloggersSOCIAL-stuntSOCIAL-2gb-nbg1-1 bundle[13939]: [32e9ccb0-bde0-4092-9a79-b72a4f97ee99] lib/paperclip/blurhash_transcoder.rb:8:in make' Feb 18 02:15:41 vloggersSOCIAL-stuntSOCIAL-2gb-nbg1-1 bundle[13939]: [32e9ccb0-bde0-4092-9a79-b72a4f97ee99] app/controllers/api/v1/media_controller.rb:10:in create'

@raphgilles
Copy link
Author

OK !

I fully uninstalled Imagemagick :

sudo apt remove --purge imagemagick

&

wget imagemagick.org/download/ImageMagick.tar.gz
tar zxvf ImageMagick.tar.gz
cd ImageMagick-6.8.2-10
./configure
make uninstall

I re-installed it :

sudo apt-get install imagemagick

&

wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
tar xvfz ImageMagick.tar.gz
cd ImageMagick-*
./configure --disable-shared
make
sudo make install

And it works a new. Thank you for your help !

@ClearlyClaire
Copy link
Contributor

ClearlyClaire commented Feb 18, 2020 via email

@raphgilles
Copy link
Author

I tried before just with the package manager but it didn't work.

@thorsummoner
Copy link

i found this thread while researching this issue: #3676 (comment) (probably unrelated)

@Justinzobel
Copy link

Justinzobel commented Jul 29, 2022

I'm getting this error as well.

Gem.lock file no changes
100GB+ free on disk
5.8GB free RAM
Version: ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org installed from Ubuntu focal repo.

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

5 participants