Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rare fatal error caused by ActionScheduler not installing correctly #853

Closed
1 task
fpcorso opened this issue Jul 15, 2020 · 11 comments
Closed
1 task

Rare fatal error caused by ActionScheduler not installing correctly #853

fpcorso opened this issue Jul 15, 2020 · 11 comments
Labels
Milestone

Comments

@fpcorso
Copy link
Contributor

fpcorso commented Jul 15, 2020

Describe the bug

A few admins have reported an error occurring when the plugin is updated or first installed that appears to be coming from within Action Scheduler. Will update here as we have more info.

Site information

Popup Maker version: 1.11.0

Errors

One Admin reported this error in the forums here: https://wordpress.org/support/topic/version-1-11-breaks-my-site/

The error message (I replaced private information with xxxx):
Uncaught RuntimeException: Error saving action: Error saving action: Table ‘xxxxxxxxx.xxx_actionscheduler_actions’ doesn’t exist in /home/xxxxxxxx/xxxx/wp-content/plugins/popup-maker/packages/action-scheduler/classes/migration/ActionScheduler_DBStoreMigrator.php:44

Another admin reported this stacktrace in the forums here: https://wordpress.org/support/topic/critical-error-after-update-4/#post-13124120

Fatal error: Uncaught RuntimeException: Error saving action: Error saving action: Table ‘ccw_wp.wpccw_actionscheduler_actions’ doesn’t exist in /var/www/html/wp-content/plugins/popup-maker/packages/action-scheduler/classes/migration/ActionScheduler_DBStoreMigrator.php:44 
Stack trace: #0 /var/www/html/wp-content/plugins/popup-maker/packages/action-scheduler/classes/data-stores/ActionScheduler_HybridStore.php(242): ActionScheduler_DBStoreMigrator->save_action(Object(ActionScheduler_Action), NULL) #1 
/var/www/html/wp-content/plugins/popup-maker/packages/action-scheduler/classes/ActionScheduler_ActionFactory.php(177): ActionScheduler_HybridStore->save_action(Object(ActionScheduler_Action)) #2 
/var/www/html/wp-content/plugins/popup-maker/packages/action-scheduler/classes/ActionScheduler_ActionFactory.php(84): ActionScheduler_ActionFactory->store(Object(ActionScheduler_Action)) #3 
/var/www/html/wp-content/plugins/popup-maker/packages/action-scheduler/functions.php(36): ActionScheduler_ActionFactory->single(‘action_schedule…’, in 
/var/www/html/wp-content/plugins/popup-maker/packages/action-scheduler/classes/migration/ActionScheduler_DBStoreMigrator.php on line 44
@fpcorso fpcorso changed the title Rare fatal error from not installing ActionScheduler Rare fatal error caused by ActionScheduler not installing correctly Jul 15, 2020
@danieliser
Copy link
Member

danieliser commented Jul 17, 2020

@fpcorso So I have been tracking this one for a week or so trying to figure out what is going on. Seems its not related to us at all, but rather the current release of Action Scheduler. It is affecting WooCommerce as well:

I haven't been able to make a determination yet but I believe its related to the create table query having something not quite right, at least for the version of MySQL these users are using.

Specifically I noted this comment in one of those issues:
ERROR 1067 (42000): Invalid default value for 'scheduled_date_gmt'

CREATE TABLE wp_actionscheduler_actions (
	action_id bigint(20) unsigned NOT NULL auto_increment,
	hook varchar(191) NOT NULL,
	status varchar(20) NOT NULL,
	scheduled_date_gmt datetime NOT NULL default '0000-00-00 00:00:00',
	scheduled_date_local datetime NOT NULL default '0000-00-00 00:00:00',
	args varchar(191),
	schedule longtext,
	group_id bigint(20) unsigned NOT NULL default '0',
	attempts int(11) NOT NULL default '0',
	last_attempt_gmt datetime NOT NULL default '0000-00-00 00:00:00',
	last_attempt_local datetime NOT NULL default '0000-00-00 00:00:00',
	claim_id bigint(20) unsigned NOT NULL default '0',
	extended_args varchar(8000) DEFAULT NULL,
	PRIMARY KEY  (action_id),
	KEY hook (hook(191)),
	KEY status (status),
	KEY scheduled_date_gmt (scheduled_date_gmt),
	KEY args (args(191)),
	KEY group_id (group_id),
	KEY last_attempt_gmt (last_attempt_gmt),
	KEY claim_id (claim_id)
) ${charset_collate}

Strangely I have encountered that when working on the new analytics tables on MySQL 5.7.

But this leads me to think that woocommerce/action-scheduler#587 is the true root of this. So I need to review my commits and see if I can work out what might be the cause here as well.

@danieliser
Copy link
Member

Ahh yes I remember: https://stackoverflow.com/questions/36882149/error-1067-42000-invalid-default-value-for-created-at

Its an sql_mode that causes this issue.

I think I ended up switching to timestamp, but they seem to have worked it out yesterday so we hopefully can update that package shortly with a fix: woocommerce/action-scheduler#587 (comment)

@fpcorso fpcorso added this to the 1.11.1 milestone Jul 17, 2020
@fpcorso
Copy link
Contributor Author

fpcorso commented Jul 22, 2020

@danieliser Seems the Action Scheduler package hasn't resolved this issue yet. If I get the other issues in 1.11.1 fixed, we may need to punt this one to the next hotfix release.

@danieliser
Copy link
Member

@fpcorso - one option is to manually make the tweaks after gulp release but before svn ci

That way our users can avoid the errors in the mean time.

@fpcorso fpcorso modified the milestones: v1.11.1, v1.12 Aug 3, 2020
@danieliser
Copy link
Member

Added notes about potential changes to resolve this here: woocommerce/action-scheduler#587 (comment)

@danieliser
Copy link
Member

@fpcorso There seems to be some hope, other plugins have found workarounds for their users, and this one shows the workaround but also says they fixed it, haven't read the full details or looked at the code, but good place to start on solving it maybe: https://wordpress.org/support/topic/plugin-is-not-working-after-upgrade-please-fix-asap/

@fpcorso
Copy link
Contributor Author

fpcorso commented Aug 19, 2020

@danieliser I reviewed that support topic thread (which is two pages) but some users continued to experience the issue even after updating. However, they did say if the user went to WPForms > Tools > Scheduled Actions it would generate the tables. That may be a useful solution too since we are adding Scheduled Actions in our 1.12 update. Not sure if that tab automatically does that or if we'd have to add some code.

@danieliser
Copy link
Member

@fpcorso WooCommerce suggested the same thing, somehow visiting that page causes it to recheck tables and install them again.

But if the plugin fatals on install, it doesn't much matter haha.

That said I do wonder if the users experiencing this have WP_DEBUG enabled.

@fpcorso fpcorso modified the milestones: v1.12, v1.13 Sep 14, 2020
@fpcorso fpcorso modified the milestones: v1.13, v1.14 Oct 6, 2020
@fpcorso fpcorso modified the milestones: v1.14, v1.15 Nov 25, 2020
@fpcorso fpcorso modified the milestones: v1.15, v1.16 Dec 17, 2020
@danieliser
Copy link
Member

danieliser commented Feb 2, 2021

@tonyfelice Appreciate the feedback. So it could be related to table prefixes you think?

@tonyfelice
Copy link

tonyfelice commented Feb 2, 2021 via email

@danieliser
Copy link
Member

@tonyfelice We may end up just removing our usage of it and finding an alternative. It seemed like it should be a super reliable choice early on since its maintained by WooCommerce, but sigh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants