Hi @ravanh,
Thanks for sharing the full stack trace. That’s really helpful!
What’s happening here is that Action Scheduler is trying to query the database during PHP’s shutdown sequence, but by that point the MySQL connection has already been closed by the server. Since the error fires after the response has been sent, it’s not interrupting any user-facing requests. It’s log noise rather than a functional problem, but it’s still worth investigating properly.
This often occurs on LiteSpeed-based hosting (which your log prefix confirms) where database connections are freed earlier than other server configurations.
To help dig further, could you share your System Status Report? Go to WooCommerce → Status → Get system report, paste it at https://pastebin.com and share the link here. We’d like to check your WooCommerce version, PHP version, and hosting environment in particular.
In the meantime, are you noticing any actual functional issues on the site? Like slow admin, stuck orders, checkout problems, or is it purely the log entries?
Looking forward to your response.
Hi @frankremmy thanks for your explanation. Here is the system report https://pastebin.com/b1BccSrr (will expire in a week)
We are indeed running into issues like 504 responses and “database gone away” responses. They seem to occur only periodically, in spurts, then calm for a while. Weird but it does seem to be in line with your explanation…
So these mysqli_get_server_info(): Argument #1 ($mysql) must be of type mysqli, null given errors are likely a result of that same issue?
Hi @ravanh,
Thanks for the system status and the additional context.
Yes, exactly right. The mysqli_get_server_info fatal errors are a symptom of the same underlying issue, not a separate problem. Here’s what’s happening: when the database connection drops mid-request (causing the “MySQL server has gone away” error), WooCommerce’s shutdown hooks still fire at the end of the PHP request cycle, but by that point the $wpdb connection object is null. When Action Scheduler then tries to query the database during that shutdown sequence, it fatals because there’s nothing to connect to. Fix the root cause and both errors go away.
The intermittent 504s and database connection drops are a hosting infrastructure issue rather than anything WooCommerce is causing. The pattern you’re describing (sporadic bursts, then calm) is typical of a few things worth investigating with your host:
- Database connection pool exhaustion – too many concurrent connections exceeding the server’s limit, causing new requests to get dropped temporarily
- MySQL
wait_timeout or interactive_timeout being too low — connections being closed by the server before PHP has finished with them
- Memory or CPU hitting limits periodically under load, causing MySQL to restart or drop connections
I’d recommend contacting your hosting provider and sharing the error logs with them. Ask them specifically to check MySQL connection limits, wait_timeout settings, and whether there are any resource spikes correlating with when the errors occur.
One other thing we noticed in your system status: your Daily Cron is not scheduled. This can compound background processing issues. Please go to WooCommerce → Status → Tools and reschedule the cron jobs.
I hope that helps point you in the right direction!
Hi, thanks for the suggestions!
Please go to WooCommerce → Status → Tools and reschedule the cron jobs.
Is that the tool called Re-schedule expired transient files cleanup or are there more?
Hi there!
The “Re-schedule expired transient cleanup” option is only for clearing temporary cached data and is unrelated to WooCommerce cron scheduling.
The log you shared initially, indicates the site lost its database connection during execution, and afterward WooCommerce’s Action Scheduler tried to run a database query using an invalid/null MySQL connection.
The key part is:
mysqli_get_server_info(): Argument #1 ($mysql) must be of type mysqli, null given
That means the $wpdb database connection object became null, usually because:
- The MySQL server temporarily disconnected
- The database server restarted
- The connection timed out
- The hosting server ran out of resources (CPU/RAM/connections)
So this is generally related to an underlying hosting/database stability issue. I would suggest contacting your hosting provider and asking them to review the server logs to identify what is exactly causing the issue. They should be able to help you resolve it.
Let us know what they suggest.
Hi @shahzeenfarooq yes I’ve contacted the hosting provider. The issue is under review…
Can you tell me which Status > Tools to use to reschedule cron jobs as @frankremmy suggested needs to be done?
Hi there!
Thank you for the update.
Sorry for the confusion earlier by default, there is no built-in option under WooCommerce → Status → Tools to manually re-schedule the wc_admin_daily cron job.
I would suggest asking your hosting provider to check whether the wc_admin_daily event is running properly on the server. Alternatively, you can use the WP Crontrol plugin to manually create or re-schedule the cron event.
Here are the steps you can follow:
- Click “Add Cron Event”
- Fill in the fields as follows:
Hook name
wc_admin_daily
Arguments
Next run
- Select Now (or set a time a few minutes in the future)
Recurrence
- Click Add Event
Let us know if that work for you
Thanks @shahzeenfarooq, I followed the steps and the wc_admin_daily hook now appears in the cron events list with action Automattic\WooCommerce\Internal\Admin\Events->do_wc_admin_daily()
Would you know how this event could go missing? It was never actively deleted…