[wp-trac] [WordPress Trac] #64080: WP_Upgrader doesn't release lock on create_lock

WordPress Trac noreply at wordpress.org
Mon Oct 27 17:01:30 UTC 2025


#64080: WP_Upgrader doesn't release lock on create_lock
-------------------------------------------------+-------------------------
 Reporter:  skithund                             |       Owner:  skithund
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  6.9
Component:  Upgrade/Install                      |     Version:  4.5
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests reporter-   |     Focuses:
  feedback                                       |
-------------------------------------------------+-------------------------

Comment (by skithund):

 I'm unable to leave this alone and I'm getting somewhere. This seems to be
 caching issue/regression(?) and I've been barking at the wrong tree.

 `WP_Upgrader::create_lock()` creates a lock into the database with an
 INSERT query, bypassing what ever is used for handling/priming options
 cache. And since `get_option( 'lock.lock' );` is returning `false` right
 after INSERT, it's triggering "[https://github.com/WordPress/wordpress-
 develop/blob/trunk/src/wp-admin/includes/class-wp-upgrader.php#L1069-L1072
 If a lock couldn't be created, and there isn't a lock, bail.]" and not
 being able to re-create the lock.

 {{{#!php
 <?php
 global $wpdb;

 // Make sure lock doesn't exist in cache
 delete_option( 'lock.lock' );

 $wpdb->query(
         $wpdb->prepare(
                 'INSERT IGNORE INTO %i (option_name, option_value,
 autoload) VALUES (%s, %s, %s)',
                 $wpdb->options,
                 'lock.lock',
                 time(),
                 'off'
         )
 );
 var_dump( get_option( 'lock.lock' ) );
 wp_cache_flush();
 var_dump( get_option( 'lock.lock' ) );

 // Result:
 // bool(false)
 // string(10) "1761580496"
 }}}

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


More information about the wp-trac mailing list