• Hi there! After the recent v2 update to the WP Store Locator plugin, we received the notice that “74994 current store locations need to be converted to custom post types” (yes, we do actually have that many stores in the system 😛 ). However, when I click on “Start Converting” it only runs for 12 seconds before failing with this error: “The script converting the locations timed out.” I’ve attempted everything to increase the PHP execution time, the WordPress execution time, and any other execution time I can find on our server, but the converter always times out after 12 seconds. I even verified via phpinfo() that for this specific website, the max execution time was sufficient. Its really odd too, because it’s timing out well before even the default 30 second execution time. Any thoughts? I’m wondering if it has to do with the large number of store locations… The website runs on cPanel and sits on a server I have full administration rights for. Thanks!

    https://wordpress.org/plugins/wp-store-locator/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Tijmen Smit

    (@tijmensmit)

    I think I know why you get the error.

    After the script that converts all the locations is started, an additional ajax request is made every 10 seconds to count the amount of converted stores. This is done to make sure the upgrade script is still running, and to give the user an update on the amount of locations that is left to convert.

    If after 10 seconds the number of converted stores is the same as 10 sec before, then nothing happened and the timeout msg is shown.

    Maybe because of the almost 75000 locations the sql chokes somewhere. It does do a select * on the wpsl_stores table, and if that takes longer then 10 sec ( no idea if it does, but with 75000 locations it could take a bit longer ), then nothing was converted within 10 sec and you get the timeout msg. Which is not what really happened, the sql is simple still running.

    You can easily test if this is the case by opening the /admin/js/wpsl-cpt-upgrade.js and on line 31 ( ver 2.0.2 ), you have this line of code.

    updateInterval = setInterval( function() { convertCptCount(); }, 10000 );

    Change the 10000 to 20000 or even 30000. This will make it wait 20 or 30 seconds before checking if the script is still running.

    If this doesn’t change anything, then try to enable wp_debug and wp_debug_log and check if any errors show up in the debug log in the /wp-content/debug.log file.

    Let me know if changing the update interval makes a difference, or if something shows up in the debug.log file.

    Thread Starter Vimpelli

    (@vimpelli)

    Thanks for the reply!

    Changed the interval to 30000
    > still get the timeout message
    > nothing in the debug.log.

    Changed the interval to 100000
    > runs for a lot longer, but eventually I still get the timeout message
    > nothing in the debug.log.

    Just for kicks, I tried it in a different browser, all the to same effect. For the record, this is a pretty clean install too. Turning on wp_debug doesn’t generate any warnings or errors, and only one notice.

    Plugin Author Tijmen Smit

    (@tijmensmit)

    The number of stores it needs to convert doesn’t change at all, even after setting it to 100000?

    If you check the ‘All Stores’ page there is nothing there?

    Plugin Author Tijmen Smit

    (@tijmensmit)

    Do you happen to have all the stores locations in a csv file?

    Plugin Author Tijmen Smit

    (@tijmensmit)

    Can you run this sql query in phpmyadmin, and see how long it takes to complete? Do replace the ‘name_of_your_db’ with the name of the actual wpsl table, it looks like this dbname_wpsl_stores

    (SELECT * FROM name_of_your_db ORDER BY wpsl_id DESC LIMIT 74994) ORDER BY wpsl_id ASC
    Thread Starter Vimpelli

    (@vimpelli)

    The number of stores it needs to convert doesn’t change at all, even after setting it to 100000?
    If you check the ‘All Stores’ page there is nothing there?

    > Correct, the number of store locations that need to be converted never changes. It’s been at 74994 since I started trying.
    > Correct, the ‘All Stores’ page shows nothing.

    Do you happen to have all the stores locations in a csv file?

    > Yes! I do have all the stores in a csv file. It’s an 11MB file.

    Can you run this sql query in phpmyadmin, and see how long it takes to complete? Do replace the ‘name_of_your_db’ with the name of the actual wpsl table, it looks like this dbname_wpsl_stores

    > I was not able to successfully run this query in phpmyadmin. When I tried to run it the first time, it ran for exactly 5 minutes before giving a 500 internal server error. I tried running it a few more times, just changing the number of rows queried, and it worked with anything under 5,000 rows. Then I went and looked in the /usr/local/cpanel/logs/error_log file, and it showed this: PHP Fatal error: Maximum execution time of 300 seconds exceeded in /usr/local/cpanel/base/3rdparty/phpMyAdmin/libraries/DisplayResults.class.php on line 2959
    Which makes sense because it was erroring out at exactly 5 minutes.
    So I tried running the query from a remote mysql client – Sequel Pro – and it worked perfectly. It was able to return all 74994 rows in 1.19s. I ran it a few times and every time it worked perfectly.

    Plugin Author Tijmen Smit

    (@tijmensmit)

    It’s really weird why phpmyadmin takes 5min+ to run the query, and the remote mysql client does it in 1.19s.

    But anyway, can you send me an email at tijmen at wpstorelocator.co? I’m working on a CSV importer, and I think in your case it’s the easiest fix to convert the locations.

    You do have to cut the CSV file up in smaller parts, because I don’t think you are allowed to upload a 11mb file in WP, and also because with 11mb you will likely run into the max execution time of 300 seconds if the file is to big.

    I’ve seen timeouts when adding just one location. However, clicking Preview while entering the store info, works every time. So, i do that while i’m adding individually and all is well.

    Not sure if that’s going to help the OP directly, but it may be related.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Store Locations Convert Timing Out’ is closed to new replies.