WordPress.org

Make WordPress Core

Opened 9 months ago

Closed 6 months ago

Last modified 6 months 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:
Focuses: Cc:

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 9 months ago.
Screenshot of Error
11-25-19.pdf (280.5 KB) - added by cranstantinople 9 months ago.
PDF in Question
Annotation 2019-11-24 163617.jpg (153.8 KB) - added by cranstantinople 9 months ago.
Screenshot of Error 2

Download all attachments as: .zip

Change History (23)

@cranstantinople
9 months ago

Screenshot of Error

@cranstantinople
9 months ago

PDF in Question

#1 @audrasjb
9 months 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
9 months ago

(I tested with your PDF file as well)

#3 @cranstantinople
9 months 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
9 months ago

Screenshot of Error 2

#4 @azaozz
9 months 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
9 months 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
9 months 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
8 months 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
8 months 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
8 months ago

#48851 was marked as a duplicate.

#10 @tcowin
8 months 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 follow-up: @nullreturned
8 months 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 months 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
8 months 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
8 months 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
8 months 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
8 months 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.

#17 in reply to: ↑ 11 @tcowin
8 months ago

Replying to nullreturned:

@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.

@nullreturned It is the solution for us. This is a config setting that has to go in the Nginx config on your server -- where it's placed in the config could affect all sites on the server, or just a single site.

http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size

#18 @luciantstoian
6 months ago

same problem here. I just tested uploading on another site, just to make sure, everything worked fine on wordpress 5.1.4, after updating I get Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page.. If I try uploading files through admin and http error on front end.
Has anyone figures this out?

Last edited 6 months ago by luciantstoian (previous) (diff)

#19 @skylabb
6 months ago

  • Resolution duplicate deleted
  • Status changed from closed to reopened

I have the same issue uploading PDF with exact error message. Some more details per my observation:

I don't think the problem is caused by any plugin conflict. I deactivated all plugins for the site and the problem persisted. Of this same site running the past couple years using the same server, WP theme and plugins, I never had this issue until recently along with a bunch of other users after WP upgrades.

The issue is that after I hit the upload button, a new square box in the media lib view pan shows the upload process with a progress RED bar. Then the error message comes up. And if I refresh my screen, the uploaded file shows up in libary list as normally. It seems auto server response process is not working properly in the uploading process requiring a manual screen refresh.

Also interestingly, I have a different WP stall in latest version on a different server and using different theme, the second site doesn't have the upload issue. The square box in library pan shows a BLUE upload progress bar, then the screen refreshes itself to show success upload updates.

From my observation above, I'd say the latest versions of WP are probably having some glitch or are conflicting with certain server environments or design themes. But, you can't blame the server or theme because these existing elements used to be working just fine with previous WP versions. It is WP that introduces something new in recent versions and comes into conflict with existing setups. And this seems to be affecting quite a few sites, not just a couple isolated cases. In other words, WP is the problem per my conclusion.

Last edited 6 months ago by skylabb (previous) (diff)

#20 @audrasjb
6 months ago

  • Keywords reporter-feedback removed
  • Resolution set to duplicate
  • Status changed from reopened to closed

Hello,

Thank you for adding these details/informations.
The ticket wasn't closed because it's invalid, but because the issue is already addressed in a pre-existing ticket: #48853.

Could you please share the above information in the related ticket?

Many thanks!

Note: See TracTickets for help on using tickets.