• Resolved padc

    (@padc)


    I am trying to scan a large image library to import its media to my WordPress database. The can returns all files as expected.

    If I choose to import all missing files, the process aborts after a few seconds with this error:

    [Media Sync] [AJAX error] error E: Service Unavailable

    Looking at the console, I see a POST error:
    503 (Service Unavailable)

    I have found that I can import media files from scan results if I choose fewer than 10 files at a time, and this does not always work.

    I have set the server and WP memory to 256M, and increased the PHP.ini max_execution_time to 300.

    Any advice appreciated as it will take ages to import all files in batches of 10 or less.

    Is there a way to throttle requests so the server doesn’t reject them?

Viewing 8 replies - 16 through 23 (of 23 total)
  • Plugin Author erolsk8

    (@erolsk8)

    Hey @simonkane, I added plugin options and a checkbox there to turn on debugging. But I guess you saw it in that screenshot 🙂

    Plugin Author erolsk8

    (@erolsk8)

    I made a video of what’s happening (with the latest version – 1.2.6): https://share.nim.bz/o0u79qNm

    This is super useful @padc, thank you! But it’s so strange, it’s like it doesn’t even start the import. Maybe that failed request (in Network tab) has a request size that is too large (post_max_size): https://stackoverflow.com/questions/2364840/what-is-the-size-limit-of-a-post-request
    This wouldn’t be size of images, but just their path/name (so just text).
    Or maybe max_input_vars is set to too low in PHP:
    https://stackoverflow.com/questions/10303714/php-max-input-vars

    One other thought that may have an impact…

    The old site (from where the media originated) has Settings > Media > Organize my uploads into month- and year-based folders checked, whereas the new (dev) site does not.

    This means all media to be imported is within year > month folders, and existing media is just loose in the Uploads folder.

    Don’t know if this has a bearing on things??

    Interesting, I don’t think I ever tried this scenario. It shouldn’t matter, but who knows, it might be it.

    • This reply was modified 2 years, 5 months ago by erolsk8.
    • This reply was modified 2 years, 5 months ago by erolsk8.
    Plugin Author erolsk8

    (@erolsk8)

    @simonkane I hope that’s just some cache issue since you got the new version 🥶

    Thread Starter padc

    (@padc)

    Thanks @erolsk8,

    Contacted my host. They said the site was using too many resources and asked if it was possible to slow the requests coming in via the plugin. However, I don’t think the plugin was making an excessive number of requests…

    I have moved the site to a different server and now Media Sync seems to be working perfectly. I’ve been able to import a batch of 100+ images in one go!

    Many apologies this seems to have been somewhat wasted time, but perhaps you could look to add an option to manually throttle the request rate in future. Either that or add a one-click import button in the file list. (It’s a bit of a pain to tick files one by one, then click the import button each time.)

    • This reply was modified 2 years, 5 months ago by padc.
    Plugin Author erolsk8

    (@erolsk8)

    I have moved the site to a different server and now Media Sync seems to be working perfectly.

    Wow, this is also very useful info, and I’ll think about optimizing it to work on more servers. I already know some people have problems scanning all the files (if there are like >10-20k photos), so even before import.

    Recently I had an idea to add a new option for some “Minimal UI” or “No UI”, which would either just “blindly” import all files (without even listing them), or to have pagination but still allow “select all” (since that’s the primary focus of this plugin). I just hope I’ll find some time to do some of these things.

    It’s a bit of a pain to tick files one by one, then click the import button each time.

    There is a “select all” checkbox at the top (above all other checkboxes). If that’s what you mean.

    By the way, this new version I did yesterday was 99% done months ago, I just found it yesterday and pushed it 🙂

    But thanks for all the feedback and recordings, it’s very insightful because many people complain but it’s so hard to replicate.

    Thread Starter padc

    (@padc)

    Thanks @erolsk8

    I was aware of the select all – I meant something like this (for those experiencing problems with the batch):

    https://share.nim.bz/jkuEAxL4

    Plugin Author erolsk8

    (@erolsk8)

    Oh, I see, so quite the opposite 🙂
    I’ll think about it. Thanks again for all the feedback.

    Plugin Contributor Simon Kane

    (@simonkane)

    So, it turns out this issue is pretty much the “standard” one – and I don’t mean that negatively to either of you.

    Pushing the “driver” to client-side solves the PhP limit issue that batch processes of all kinds tend to run into — but opens the door to throttles imposed by IMO unreasonable hosting. Such explains why this isn’t happening to everyone.

    P.S. I haven’t had a chance to test the almost certainly unrelated issue I have/had. I note that it is on my horribly mucked up test server. If it happens on my staging or prod servers, I’ll open a new ticket.

Viewing 8 replies - 16 through 23 (of 23 total)
  • The topic ‘Import fails with 503 Service Unavailable’ is closed to new replies.