Moodle
  1. Moodle
  2. MDL-32236

SQLSRV db unit test cannot complete, driver's sp_getapplock query timing out.

    Details

    • Affected Branches:
      MOODLE_22_STABLE

      Description

      It seems the using the SQLSRV driver on apache on win2k8 server is causing time outs.
      I am unable to run the function DB unit tests to completion due to this error.

      Fatal error: Maximum execution time of 30 seconds exceeded in C:\server\workspace\mssql\lib\dml\sqlsrv_native_moodle_database.php on line 1330 (integration.git/master, for moodle.git/master its 'on line 1328' atm)

      the query seems to be

      ...
              $sql = "BEGIN
                          DECLARE @result INT
                          EXECUTE @result = sp_getapplock @Resource='$fullname',
                                                          @LockMode='Exclusive',
                                                          @LockOwner='Session',
                                                          @LockTimeout='$timeoutmilli'
                          SELECT @result
                      END";

      after this error, any other moodle page is timing out as well.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            Eloy Lafuente (stronk7) added a comment -

            And... what happens if you access to exactly the same database but using the mssql driver instead? Same problem? Or does it work under mssql?

            That will allow us to know if it's something general or particular to the sqlsrv driver (ours or MS). Note that the code in both drivers is 100% the same, so they should behave the same.

            Also, can you add the complete stack-trace of the error? Right now I don't know if that happens when some unittest is executed, or if it is the standard moodle DB sessions stuff the one causing the error.

            Finally, which MS PHP driver are you using? And which SQL*Server version? And are you using DB sessions or file sessions?

            Ciao

            Show
            Eloy Lafuente (stronk7) added a comment - And... what happens if you access to exactly the same database but using the mssql driver instead? Same problem? Or does it work under mssql? That will allow us to know if it's something general or particular to the sqlsrv driver (ours or MS). Note that the code in both drivers is 100% the same, so they should behave the same. Also, can you add the complete stack-trace of the error? Right now I don't know if that happens when some unittest is executed, or if it is the standard moodle DB sessions stuff the one causing the error. Finally, which MS PHP driver are you using? And which SQL*Server version? And are you using DB sessions or file sessions? Ciao
            Hide
            Michael de Raadt added a comment -

            I have experienced this also running SQL Server 2008 on Win7 with XAMPP.

            I have my timeout set very high, so it runs indefinitely. After this, my SQL Server agent dies and I cannot restart it without restarting Windows.

            Show
            Michael de Raadt added a comment - I have experienced this also running SQL Server 2008 on Win7 with XAMPP. I have my timeout set very high, so it runs indefinitely. After this, my SQL Server agent dies and I cannot restart it without restarting Windows.

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: