[wp-trac] [WordPress Trac] #57271: Cron unschedule / reschedule event errors

WordPress Trac noreply at wordpress.org
Mon Feb 19 18:01:29 UTC 2024


#57271: Cron unschedule / reschedule event errors
----------------------------------------+------------------------------
 Reporter:  domainsupport               |       Owner:  audrasjb
     Type:  defect (bug)                |      Status:  assigned
 Priority:  normal                      |   Milestone:  Awaiting Review
Component:  Cron API                    |     Version:  6.0
 Severity:  normal                      |  Resolution:
 Keywords:  has-patch needs-unit-tests  |     Focuses:
----------------------------------------+------------------------------

Comment (by emilycestmoi):

 Spent a few more minutes on this today as I am consistently seeing this
 error every 30 minutes or so. I added some debug logging in class-
 wpdb.php. Basically what I am seeing when this error occurs is that
 mysqli_query("UPDATE `wp_options` SET `option_value` =
 'THE_SERIALIZED_DATA' WHERE option_name = 'cron'"); does not throw any
 errors but the affected row count after the query is 0, which is the
 source of the error that propagates back up to cause the error we are
 seeing.

 From class-wpdb.php:


 {{{
 private function _do_query( $query ) {
     if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES ) {
         $this->timer_start();
     }

     if ( ! empty( $this->dbh ) ) {

         $this->result = mysqli_query( $this->dbh, $query );
         // AFFECTED ROWS = 0 FOR THE UPDATE HERE -- mysqli_affected_rows(
 $this->dbh ) === 0
     }

 ...

 }}}

 I am attempting to take a look at the mysqli driver to see if I can get
 any additional error information out of it. Interestingly if I add a query
 like "mysqli_query($this->dbh, "SELECT COUNT(*) FROM wp_options WHERE
 option_name = 'cron'");" to check to see if there is a wp_options entry
 for cron before the mysqli_query($this->dbh, "UPDATE ... WHERE option_name
 = 'cron'") runs then the failed update moves to a different query (in my
 case a woocommerce UPDATE returns 0 affected rows where 1 is expected, and
 I get a different exception in woocommerce). It seems like the $this->dbh
 is not executing the update/or is overloaded/or is waiting or something
 and/or skipping the update for some reason/??.

 My DB (Mysql 8.0.36) has plenty of resources, and has no issues with
 connection limits (Max connections I've ever seen are less than half of my
 mysql hard limit), additionally this error does not occur anywhere else on
 my server, so it must be something independent of mysql resources.

 Will see if I can get more error information out of mysqli.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57271#comment:52>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list