Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-61439

Coding error (double lock release) in postgres_lock_factory.php

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.4.1
    • Fix Version/s: None
    • Component/s: Database SQL/XMLDB, Unknown
    • Labels:
      None
    • Affected Branches:
      MOODLE_34_STABLE

      Description

      Can't say if its relevant - I have recently upgraded from 3.2 to 3.4 and did some experiments with custom OAuth2 provider, so my database MAY be in some way broken.

      Yesterday I have started to receive errors from cron:

      {{Potential coding error - existing temptables found when disposing database. Must be dropped!
      PHP Warning:  pg_num_fields() expects parameter 1 to be resource, null given in /var/www/moodle/lib/dml/pgsql_native_moodle_database.php on line 779
      PHP Warning:  pg_fetch_all() expects parameter 1 to be resource, null given in /var/www/moodle/lib/dml/pgsql_native_moodle_database.php on line 788
      PHP Warning:  pg_free_result() expects parameter 1 to be resource, null given in /var/www/moodle/lib/dml/pgsql_native_moodle_database.php on line 789
      PHP Notice:  Trying to get property of non-object in /var/www/moodle/lib/classes/lock/postgres_lock_factory.php on line 216
      PHP Fatal error:  Uncaught coding_exception: Coding error detected, it must be fixed by a programmer: A lock was created but not released at:
      /var/www/moodle/lib/classes/task/manager.php on line 542}}

       

      After adding some debugging messages to release_lock function it seems that the same lock is released twice. The second time it happens

       $result = $this->db->get_record_sql('SELECT pg_advisory_unlock(:locktype, :token) AS unlocked', $params);

      returns false, and following

      $result = $result->unlocked === 't';

      throws an exception.

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              bartłomiejgolenko Bartłomiej Golenko
              Participants:
              Component watchers:
              Jake Dallimore, Jun Pataleta, Ryan Wyllie, Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
            • Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: