WordPress.org

Make WordPress Core

Opened 13 days ago

Closed 4 hours ago

Last modified 65 minutes ago

#48778 closed defect (bug) (duplicate)

PDF Upload Bug in 5.3

Reported by: cranstantinople Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Media Keywords: reporter-feedback
Focuses: Cc:
PR Number:

Description

After upgrading to 5.3 I get an error when uploading certain pdf's. I manage multiple sites so I tried uploading the same pdf on a different site that wasn't upgraded and it worked. As soon as I upgraded it gave the same error.

It seems to upload the file itself but it never generates the thumbnails correctly. I've tried reuploading specific files I've uploaded in the past and after the upgrade those fail as well.

"Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page."

Attachments (3)

Annotation 2019-11-23 153112.jpg (52.5 KB) - added by cranstantinople 13 days ago.
Screenshot of Error
11-25-19.pdf (280.5 KB) - added by cranstantinople 13 days ago.
PDF in Question
Annotation 2019-11-24 163617.jpg (153.8 KB) - added by cranstantinople 12 days ago.
Screenshot of Error 2

Download all attachments as: .zip

Change History (19)

@cranstantinople
13 days ago

Screenshot of Error

@cranstantinople
13 days ago

PDF in Question

#1 @audrasjb
13 days ago

  • Component changed from General to Media
  • Keywords reporter-feedback added

Hi, thank you for opening a ticket and welcome to WordPress Trac!

I can't reproduce the issue on a fresh install (default theme and no plugin) no on several websites with few plugins.
May probably related to an issue with one of your plugins. Are you able to test on a fresh install?

Thanks
Jb

#2 @audrasjb
13 days ago

(I tested with your PDF file as well)

#3 @cranstantinople
12 days ago

hmm... I tried it with a new installation of WordPress and i still get the same error. Possibly could be a configuration issue with my host (Bluehost). I could open up a ticket with them as well.

@cranstantinople
12 days ago

Screenshot of Error 2

#4 @azaozz
10 days ago

@cranstantinople the "Unexpected response from the server…" error message replaced the old "HTTP error" message and means there was a serious error on the server, usually a PHP fatal error/server crash.

If you have access to the server logs, please try uploading several times then look at the logs. If you don't have access, contact your web hosting company and ask them to look at the error logs around the time you tried to upload. Hopefully the logs will contain more info on what's causing the error.

#5 follow-up: @digitaldrive
8 days ago

@azaozz I report Users experiencing the same issue exactly as described by @cranstantinople above.

Appeared immediately post 5.3 upgrade, occured on more than one site and I am able to reproduce on other WordPress sites of same system specifications on demand.

Seems to specifically affects PDFs that are over 1MB in size (thought I have not tested every file type/filesize combination - PDFs are critical to us).

PHP.ini file upload size is default of 2MB and prior to update, the same PDF was previously able to be uploaded without issue.

Relevant Nginx Access log except:

220.233.XXX.XXX - - [29/Nov/2019:00:39:57 +0000] "POST /wp-admin/async-upload.php HTTP/1.1" 413 610 "https://[redacted]/wp-admin/upload.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"

Uploading a test PDF of 1.2 MB throws HTTP 413 - Payload Too Large response status code.
Uploading a test PDF of 0.5MB returns 200 and is successful.

System Specifications

  • WordPress 5.3 (upgraded from WordPress 5.2.4)
  • PHP 7.2
  • Nginx 1.14.0
  • MySQL 5.7.28
  • OS: Ubuntu 18.04.3 LTS

PHP Error log: Clean - No error recorded

No server crash/no memory errors, the sites are still functional except PDFs over 1MB cannot be uploaded via WordPress Media Manager after site is upgraded to WordPress 5.3

Any suggestions on resolving this issue appreciated... alternatively we are looking at rolling back all affected sites to 5.2.4

#6 in reply to: ↑ 5 @azaozz
7 days ago

Replying to digitaldrive:

PHP.ini file upload size is default of 2MB and prior to update, the same PDF was previously able to be uploaded without issue.

There are actually three php.ini settings that affect max upload size: upload_max_filesize, post_max_size, and memory_limit. Note that post_max_size should be "substantially" larger as it affects the total size of all files when uploading more than one. In addition memory_limit should be larger than post_max_size.

Uploading a test PDF of 1.2 MB throws HTTP 413 - Payload Too Large response status code.
Uploading a test PDF of 0.5MB returns 200 and is successful.

This sounds like a (perhaps) different error than the original report on this ticket. The error here is that the file is not uploaded at all, not in post-processing/creating thumbnails.

Is it possible that some configuration has changed at about the same time WP was upgraded to 5.3? Could you try uploading other files that are larger than 1MB?

It is also possible (although unlikely) that the server is configured to throw a HTTP 413 error in some other cases. Perhaps contact your hosting company to confirm/rule this out.

#7 follow-up: @nullreturned
4 days ago

I haven't done too much debugging, but I'm getting the same issue as well. Anything I try to upload to the Media that's over 1MB in size is giving the same exact error. I've tried this with multiple file types. Anything over 1MB takes a very long time, and then errors with: "Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page." and nothing actually uploads. It is also insanely slow to get this to process through, and I have fairly fast (150mbs) uploads.

Files smaller than 1MB have no issues and are processed immediately. I've checked my host's phprc file and don't see anything that would limit it. I had turned on debugging, and no errors were returned (strangely). I've verified that both WordPress and my Host is set to limit it at 64M, so I'm not sure where the culprit may be.

#8 in reply to: ↑ description @SergeyBiryukov
3 days ago

Replying to cranstantinople:

It seems to upload the file itself but it never generates the thumbnails correctly. I've tried reuploading specific files I've uploaded in the past and after the upgrade those fail as well.

Appears to be the same issue as in #48853.

#9 @SergeyBiryukov
3 days ago

#48851 was marked as a duplicate.

#10 @tcowin
2 days ago

This may be an issue caused by an Nginx config value. I was able to resolve it on my sites by entering

client_max_body_size 10M;

in the server location block in the Nginx config file.

#11 @nullreturned
33 hours ago

@tcowin Is this still resolved for you? Has anyone else been able to confirm? If this is the fix, what do I tell my Hosting Support Team to get this fixed? I'm getting this with some png files that are under 1mb as well now.

#12 follow-up: @cranewest
8 hours ago

We are getting this error also. The server logs give us the following (I took the domain and IP out):

[Sun Dec 01 01:26:24 2019] [error] Page has no /MediaBox attribute. Using the current page size., referer: .../wp-admin/upload.php
[Sun Dec 01 01:26:24 2019] [error] malformed header from script. Bad header= %interp_exit .runexec2 : async-upload.php, referer: .../wp-admin/upload.php
[Sun Dec 01 01:26:24 2019] [error] GPL Ghostscript 8.70: Unrecoverable error, exit code 1, referer: .../wp-admin/upload.php

It seems certain PDF generators don't include the /MediaBox attribute or have some error in that attribute. Generating the PDF in a Acrobat will produce a file that uploads without the error.

We found this post talking about a bug in the version of Ghostscript running on our server: https://www.imagemagick.org/discourse-server/viewtopic.php?t=15005

We're working on getting Ghostscript updated to see if that clears up the issue.

#13 in reply to: ↑ 12 ; follow-up: @azaozz
5 hours ago

Replying to cranewest:

We found this post talking about a bug in the version of Ghostscript running on our server: https://www.imagemagick.org/discourse-server/viewtopic.php?t=15005

Thanks for the detailed info! It's really helpful :)

We're working on getting Ghostscript updated to see if that clears up the issue.

This particular error is tracked in #48853. Could you post there if updating Ghostscript fixed it please.

#14 in reply to: ↑ 7 @azaozz
5 hours ago

Replying to nullreturned:

Anything I try to upload to the Media that's over 1MB in size is giving the same exact error. I've tried this with multiple file types.
...
Files smaller than 1MB have no issues and are processed immediately.

This sounds like a different problem. Would be great if you can "dig up" some more info about what's limiting uploads to 1MB, then open another ticket with these details (if there's something WP can do to remedy it).

Unfortunately there are many "moving parts" here: server settings, PHP settings, post-processing of uploaded files, sometimes even browser/network related issues. But without a clearer picture of what's going on I'm afraid there's not much we can do.

#15 @azaozz
4 hours ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

@cranstantinople as @SergeyBiryukov pointed out in comment 8, this seems to be the same error as in #48853. Would it be possible to check the version of Ghostscript running on your server (perhaps from the hosting control panel) and report it there please.

Closing this as duplicate of #48853.

#16 in reply to: ↑ 13 @cranewest
65 minutes ago

So, we've been running on Ghostscript 8.7 for years now. Our hosting company doesn't want to change it, so we may not be able to find out if changing the version of Ghostscript will fix the error. I'll post here if we're able to though.

Replying to azaozz:

Replying to cranewest:

We found this post talking about a bug in the version of Ghostscript running on our server: https://www.imagemagick.org/discourse-server/viewtopic.php?t=15005

Thanks for the detailed info! It's really helpful :)

We're working on getting Ghostscript updated to see if that clears up the issue.

This particular error is tracked in #48853. Could you post there if updating Ghostscript fixed it please.

Note: See TracTickets for help on using tickets.