woocommerce / action-scheduler

A scalable, traceable job queue for background processing large queues of tasks in WordPress. Specifically designed for distribution in WordPress plugins (and themes) - no server access required.
https://actionscheduler.org
GNU General Public License v3.0
642 stars 117 forks source link

Fatal error: Uncaught RuntimeException: Error saving action: Error saving action #631

Closed surajv closed 3 years ago

surajv commented 4 years ago

When activating WooCommerce on specific websites, it is throwing a fatal error, making websites inaccessible.

Prerequisites (mark completed items with an [x]):

Describe the bug The following fatal error is being thrown when someone tries to activate the WooCommerce plugin: Fatal error: Uncaught RuntimeException: Error saving action: Error saving action: Table 'mydbname.myprefix_actionscheduler_actions' doesn't exist in /mypath/wp-content/plugins/woocommerce/packages/action-scheduler/classes/migration/ActionScheduler_DBStoreMigrator.php:44 User has to use FTP to delete the plugin files to restore the website to a working state.

Expected behavior The fatal error should not be happening.

Actual behavior A clear and concise description of what actually happens. Please be as descriptive as possible;

Steps to reproduce the bug (We need to be able to reproduce the bug in order to fix it.) Steps to reproduce the bug:

  1. Go to install a new plugin screen
  2. Choose WooCommerce or upload the files manually via FTP
  3. Try to activate the plugin and the fatal error occurs

Isolating the problem (mark completed items with an [x]):

WordPress Environment WooCommerce wasn't getting enabled but here's the system report

``` ### wp-core ### version: 5.5.1 site_language: en_US user_language: en_US timezone: Asia/Kolkata permalink: /%postname%/ https_status: true multisite: false user_registration: 1 blog_public: 1 default_comment_status: open environment_type: production user_count: 1816 dotorg_communication: true ### wp-dropins (1) ### advanced-cache.php: true ### wp-active-theme ### name: JNews (jnews) version: 7.1.3 author: Jegtheme author_website: http://****.com/ parent_theme: none theme_features: core-block-patterns, menus, automatic-feed-links, title-tag, post-thumbnails, align-wide, customize-selective-refresh-widgets, post-formats, html5, woocommerce, wc-product-gallery-zoom, wc-product-gallery-lightbox, wc-product-gallery-slider, auto-load-next-post, editor-styles, editor-style, widgets theme_path: /home4/zgt9ng4u/public_html/****.com/wp-content/themes/jnews auto_update: Disabled ### wp-themes-inactive (1) ### Twenty Twenty: version: 1.5, author: the WordPress team,Auto-updates disabled ### wp-plugins-active (16) ### Advanced noCaptcha & invisible Captcha: version: 6.1.3, author: Shamim Hasan (latest version: 6.1.4), Auto-updates disabled AMP: version: 2.0.4, author: AMP Project Contributors, Auto-updates disabled Elementor: version: 3.0.11, author: Elementor.com, Auto-updates disabled Envato Market: version: 2.0.5, author: Envato, Auto-updates disabled JNews - AMP Extender: version: 7.0.3, author: Jegtheme, Auto-updates disabled JNews - Essential: version: 7.0.5, author: Jegtheme, Auto-updates disabled JNews - Frontend Submit: version: 7.0.4, author: Jegtheme, Auto-updates disabled JNews - Gutenberg: version: 7.0.0, author: Jegtheme, Auto-updates disabled JNews - Social Share: version: 7.0.3, author: Jegtheme, Auto-updates disabled JNews - View Counter: version: 7.0.0, author: Jegtheme, Auto-updates disabled OneSignal Push Notifications: version: 2.1.4, author: OneSignal, Auto-updates disabled Rank Math SEO: version: 1.0.49, author: Rank Math, Auto-updates disabled Trinity Audio: version: 2.7.1, author: Trinity Audio, Auto-updates disabled WP Activity Log: version: 4.1.4, author: WP White Security, Auto-updates disabled WP GDPR Compliance: version: 1.5.4, author: Van Ons, Auto-updates disabled WP Super Cache: version: 1.7.1, author: Automattic, Auto-updates disabled ### wp-media ### image_editor: WP_Image_Editor_Imagick imagick_module_version: 1654 imagemagick_version: ImageMagick 6.7.6-8 2016-07-19 Q16 http://www.imagemagick.org file_uploads: File uploads is turned off post_max_size: 260M upload_max_filesize: 256M max_effective_size: 256 MB max_file_uploads: 20 imagick_limits: imagick::RESOURCETYPE_AREA: 46 GB imagick::RESOURCETYPE_DISK: -1 imagick::RESOURCETYPE_FILE: 12288 imagick::RESOURCETYPE_MAP: 48 MB imagick::RESOURCETYPE_MEMORY: 48 MB imagick::RESOURCETYPE_THREAD: not available gd_version: bundled (2.1.0 compatible) ghostscript_version: 8.71 ### wp-server ### server_architecture: Linux 4.14.135-214.ELK.el6.x86_64 x86_64 httpd_software: Apache php_version: 7.3.23 64bit php_sapi: cgi-fcgi max_input_variables: 1000 time_limit: 30 memory_limit: 256M max_input_time: 60 upload_max_filesize: 256M php_post_max_size: 260M curl_version: 7.72.0 OpenSSL/1.1.1h suhosin: false imagick_availability: true pretty_permalinks: true htaccess_extra_rules: true ### wp-database ### extension: mysqli server_version: 5.6.41-84.1 client_version: mysqlnd 5.0.12-dev - 20150407 - $Id: 7cc7cc96e675f6d72e5cf0f267f48e167c2abb23 $ ### wp-constants ### WP_HOME: undefined WP_SITEURL: undefined WP_CONTENT_DIR: /home4/zgt9ng4u/public_html/****.com/wp-content WP_PLUGIN_DIR: /home4/zgt9ng4u/public_html/****.com/wp-content/plugins WP_MAX_MEMORY_LIMIT: 256M WP_DEBUG: false WP_DEBUG_DISPLAY: true WP_DEBUG_LOG: false SCRIPT_DEBUG: false WP_CACHE: true CONCATENATE_SCRIPTS: undefined COMPRESS_SCRIPTS: undefined COMPRESS_CSS: undefined WP_LOCAL_DEV: undefined DB_CHARSET: utf8 DB_COLLATE: undefined ### wp-filesystem ### wordpress: writable wp-content: writable uploads: writable plugins: writable themes: writable mu-plugins: writable ### amp_wp ### amp_mode_enabled: reader amp_reader_theme: legacy amp_templates_enabled: post, post, page, attachment, elementor_library, archive-template, custom-mega-menu, footer, custom-post-template amp_serve_all_templates: This option does not apply to Reader mode. amp_css_transient_caching_disabled: false amp_css_transient_caching_threshold: 5000 transients per day amp_css_transient_caching_sampling_range: 14 days amp_css_transient_caching_transient_count: 137 amp_css_transient_caching_time_series: 20200928: 171 20200929: 164 20200930: 166 20201001: 164 20201002: 144 20201003: 143 20201004: 141 20201005: 139 20201006: 139 20201007: 137 20201008: 137 20201009: 137 20201011: 137 20201012: 137 amp_libxml_version: 2.9.7 ```
juliaamosova commented 4 years ago

Hi @surajv,

Thank you for reporting the issue. According to the error message, it seems to be caused by the Action Scheduler which is being developed in another repository: https://github.com/woocommerce/action-scheduler.

I am going to move your bug report there so that the right team could take a look further.

roykho commented 4 years ago

Hi @surajv,

Can you please check your database and see if the table mydbname.myprefix_actionscheduler_actions exists?

Thanks!

surajv commented 4 years ago

Hi Roy,

In most of the single installations, all the tables were present, but for some reason, value for this option schema-ActionScheduler_StoreSchema was not updating to the latest AS version, so we asked our users to use this onetime code:

add_action( 'init', function() { delete_option( 'schema-ActionScheduler_StoreSchema' ); } );

And it resolved the issue.

Please note, all of these single installations were not using WooCommerce, but Action Schedular tables were added by some other plugins which are using this library.

There were some other issues like missing tables on multisite etc., for that, we had to write a custom script which adds those tables, please refer to this solution: https://rankmath.com/kb/fatal-error-after-1-0-49-update/

roykho commented 4 years ago

Thanks for the additional information. Do you happen to know what version is stated in the options table for schema-ActionScheduler_StoreSchema on the sites that had this problem?

surajv commented 3 years ago

Hi @roykho, sorry for the late reply, it was like 3.0.1607082479

barryhughes commented 3 years ago

Closing (as essentially the same thing is captured in #653).

andymoorey2k commented 3 years ago

Thank you all for this informative space. I ran into this now. I am facing this challenge today and i am just starting up on website creation and coding.

andymoorey2k commented 3 years ago

This is the error code also,

Fatal error: Uncaught RuntimeException: Error saving action: Error saving action: INSERT command denied to user 'u762617409_g1bbc'@'127.0.0.1' for table 'wp_actionscheduler_actions' in /home/u762617409/domains/bimcotrade.com/public_html/wp-content/plugins/woocommerce/packages/action-scheduler/classes/migration/ActionScheduler_DBStoreMigrator.php:44 Stack trace: #0 /home/u762617409/domains/bimcotrade.com/public_html/wp-content/plugins/woocommerce/packages/action-scheduler/classes/data-stores/ActionScheduler_HybridStore.php(242): ActionScheduler_DBStoreMigrator->save_action(Object(ActionScheduler_Action), NULL) #1 /home/u762617409/domains/bimcotrade.com/public_html/wp-content/plugins/woocommerce/packages/action-scheduler/classes/ActionScheduler_ActionFactory.php(177): ActionScheduler_HybridStore->save_action(Object(ActionScheduler_Action)) #2 /home/u762617409/domains/bimcotrade.com/public_html/wp-content/plugins/woocommerce/packages/action-scheduler/classes/ActionScheduler_ActionFactory.php(84): ActionScheduler_ActionFactor in /home/u762617409/domains/bimcotrade.com/public_html/wp-content/plugins/woocommerce/packages/action-scheduler/classes/migration/ActionScheduler_DBStoreMigrator.php on line 44

florentchouzy commented 1 year ago

Hi everybody, i have a problem with my Multi website, since my update of woocommerce, i have a fatal error... I tried to install Snippets and Action Scheduler but each time the fatal error come again... like this :

Fatal error: Uncaught RuntimeException: Error saving action: Error saving action: INSERT command denied to user 'o3489363'@'infong-eu183.clienthosting.eu' for table 'wp_11_actionscheduler_actions' in /homepages/0/d471927047/htdocs/wp-content/plugins/action-scheduler/classes/migration/ActionScheduler_DBStoreMigrator.php:44 Stack trace: #0 /homepages/0/d471927047/htdocs/wp-content/plugins/action-scheduler/classes/data-stores/ActionScheduler_HybridStore.php(242): ActionScheduler_DBStoreMigrator->save_action(Object(ActionScheduler_Action), NULL) #1 /homepages/0/d471927047/htdocs/wp-content/plugins/action-scheduler/classes/ActionScheduler_ActionFactory.php(244): ActionScheduler_HybridStore->save_action(Object(ActionScheduler_Action)) #2 /homepages/0/d471927047/htdocs/wp-content/plugins/action-scheduler/classes/ActionScheduler_ActionFactory.php(114): ActionScheduler_ActionFactory->store(Object(ActionScheduler_Action)) #3 /homepages/0/d471927047/htdocs/wp-content/plugins/action-scheduler/functions.php(81): ActionScheduler_ActionFactory->single_unique('action_schedule...', Array, 1676457678, 'action-schedule...', false) #4 /homepages/0/d471927047/htdocs/wp-content/plugins/action-scheduler/classes/migration/Scheduler.php(89): as_schedule_single_action(1676457678, 'action_schedule...', Array, 'action-schedule...') #5 /homepages/0/d471927047/htdocs/wp-content/plugins/action-scheduler/classes/migration/Controller.php(119): Action_Scheduler\Migration\Scheduler->schedule_migration() #6 /homepages/0/d471927047/htdocs/wp-includes/class-wp-hook.php(307): Action_Scheduler\Migration\Controller->schedule_migration('') #7 /homepages/0/d471927047/htdocs/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array) #8 /homepages/0/d471927047/htdocs/wp-includes/plugin.php(474): WP_Hook->do_action(Array) #9 /homepages/0/d471927047/htdocs/wp-settings.php(609): do_action('wp_loaded') #10 /homepages/0/d471927047/htdocs/wp-config.php(99): require_once('/homepages/0/d4...') #11 /homepages/0/d471927047/htdocs/wp-load.php(50): require_once('/homepages/0/d4...') #12 /homepages/0/d471927047/htdocs/wp-admin/admin.php(34): require_once('/homepages/0/d4...') #13 /homepages/0/d471927047/htdocs/wp-admin/plugins.php(10): require_once('/homepages/0/d4...') #14 {main} thrown in /homepages/0/d471927047/htdocs/wp-content/plugins/action-scheduler/classes/migration/ActionScheduler_DBStoreMigrator.php on line 44

i used Wordpress 5.9.5 and i am lost Help me please Florent

barryhughes commented 1 year ago

@andymoorey2k, @florentchouzy: this issue is now closed, and so it would be appreciated if you could create a new issue.

I would also note it may not be the case that this is the same problem: unless you have identified that the table in question is actually missing, this may in fact be a permissions/grants problem and the solution will be to provide your database user with the necessary privileges to interact with the actions table. If you are unsure how to do this, I recommend speaking with your web host for further assistance.

Other than that, if you need more help from us we'd be happy to look at these situations in more detail—but, again, please create a new issue for that :-)

lakayanzz commented 1 year ago

Hello, I have a similar problem, I have a WordPress and yesterday the website stopped working and this message started appearing through the Woocomerce plugins. I hope you can help me

Fatal error: Uncaught RuntimeException: Error al guardar la acción: Error al guardar la acción: Unknown column 'priority' in 'field list' in /home/orbits/orbitsstore.cl/wp-content/plugins/woocommerce/packages/action-scheduler/classes/migration/ActionScheduler_DBStoreMigrator.php:44 Stack trace: #0 /home/orbits/orbitsstore.cl/wp-content/plugins/woocommerce/packages/action-scheduler/classes/data-stores/ActionScheduler_HybridStore.php(242): ActionScheduler_DBStoreMigrator->save_action() #1 /home/orbits/orbitsstore.cl/wp-content/plugins/woocommerce/packages/action-scheduler/classes/ActionScheduler_ActionFactory.php(327): ActionScheduler_HybridStore->save_action() #2 /home/orbits/orbitsstore.cl/wp-content/plugins/woocommerce/packages/action-scheduler/classes/ActionScheduler_ActionFactory.php(315): ActionScheduler_ActionFactory->store() #3 /home/orbits/orbitsstore.cl/wp-content/plugins/woocommerce/packages/action-scheduler/functions.php(102): ActionScheduler_ActionFactory->create() #4 /home/orbits/orbitsstore.cl/wp-content/pl in /home/orbits/orbitsstore.cl/wp-content/plugins/woocommerce/packages/action-scheduler/classes/migration/ActionScheduler_DBStoreMigrator.php on line 44 Ha habido un error crítico en esta web. Por favor, comprueba la bandeja de entrada del correo electrónico del administrador de tu sitio para obtener instrucciones.

barryhughes commented 1 year ago

Thanks for creating a fresh issue for this, @lakayanzz.