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

Unclosed Gradebook recordsets from users iterator

XMLWordPrintable

      This is an alternative (or can be done in tandem) solution to MDL-81246 to resolve the unclosed recordsets in the Gradebook that cause Behat failures when using later PHP + SQL Server drivers

      See the error report originally from MDL-81246:

      Some HTML tags were opened in the body of the page but not closed.
       
          Open header/footer at:
              line 2683 of /lib/outputlib.php: call to xhtml_container_stack->log()
              line 1458 of /lib/outputrenderers.php: call to xhtml_container_stack->push()
              line 960 of /grade/lib.php: call to core_renderer->header()
              line 144 of /grade/report/user/index.php: call to print_grade_page_head()
          Close header/footer at:
              line 2711 of /lib/outputlib.php: call to xhtml_container_stack->log()
              line 1520 of /lib/outputrenderers.php: call to xhtml_container_stack->pop()
              line 213 of /grade/report/user/index.php: call to core_renderer->footer()
          Open box at:
              line 2683 of /lib/outputlib.php: call to xhtml_container_stack->log()
              line 3356 of /lib/outputrenderers.php: call to xhtml_container_stack->push()
              line 3344 of /lib/outputrenderers.php: call to core_renderer->box_start()
              line 3094 of /lib/outputrenderers.php: call to core_renderer->box()
              line 455 of /lib/setuplib.php: call to core_renderer->fatal_error()
              line ? of unknownfile: call to default_exception_handler()
          Close box at:
              line 2711 of /lib/outputlib.php: call to xhtml_container_stack->log()
              line 3368 of /lib/outputrenderers.php: call to xhtml_container_stack->pop()
              line 3344 of /lib/outputrenderers.php: call to core_renderer->box_end()
              line 3094 of /lib/outputrenderers.php: call to core_renderer->box()
              line 455 of /lib/setuplib.php: call to core_renderer->fatal_error()
              line ? of unknownfile: call to default_exception_handler()
       
          line 2727 of /lib/outputlib.php: call to debugging()
          line 1591 of /lib/outputrenderers.php: call to xhtml_container_stack->pop_all_but_last()
          line 1518 of /lib/outputrenderers.php: call to core_renderer->container_end_all()
          line 3120 of /lib/outputrenderers.php: call to core_renderer->footer()
          line 455 of /lib/setuplib.php: call to core_renderer->fatal_error()
          line ? of unknownfile: call to default_exception_handler()
       
      There are no more open containers. This suggests there is a nesting problem.
       
          Open header/footer at:
              line 2683 of /lib/outputlib.php: call to xhtml_container_stack->log()
              line 1458 of /lib/outputrenderers.php: call to xhtml_container_stack->push()
              line 960 of /grade/lib.php: call to core_renderer->header()
              line 144 of /grade/report/user/index.php: call to print_grade_page_head()
          Close header/footer at:
              line 2711 of /lib/outputlib.php: call to xhtml_container_stack->log()
              line 1520 of /lib/outputrenderers.php: call to xhtml_container_stack->pop()
              line 213 of /grade/report/user/index.php: call to core_renderer->footer()
          Open box at:
              line 2683 of /lib/outputlib.php: call to xhtml_container_stack->log()
              line 3356 of /lib/outputrenderers.php: call to xhtml_container_stack->push()
              line 3344 of /lib/outputrenderers.php: call to core_renderer->box_start()
              line 3094 of /lib/outputrenderers.php: call to core_renderer->box()
              line 455 of /lib/setuplib.php: call to core_renderer->fatal_error()
              line ? of unknownfile: call to default_exception_handler()
          Close box at:
              line 2711 of /lib/outputlib.php: call to xhtml_container_stack->log()
              line 3368 of /lib/outputrenderers.php: call to xhtml_container_stack->pop()
              line 3344 of /lib/outputrenderers.php: call to core_renderer->box_end()
              line 3094 of /lib/outputrenderers.php: call to core_renderer->box()
              line 455 of /lib/setuplib.php: call to core_renderer->fatal_error()
              line ? of unknownfile: call to default_exception_handler()
       
          line 2698 of /lib/outputlib.php: call to debugging()
          line 1520 of /lib/outputrenderers.php: call to xhtml_container_stack->pop()
          line 3120 of /lib/outputrenderers.php: call to core_renderer->footer()
          line 455 of /lib/setuplib.php: call to core_renderer->fatal_error()
          line ? of unknownfile: call to default_exception_handler()
       
      Exception - sqlsrv_free_stmt(): supplied resource is not a valid ss_sqlsrv_stmt resource
      Debug info:
      Error code: generalexceptionmessage
      Stack trace:
       
          line 136 of /lib/dml/sqlsrv_native_moodle_recordset.php: TypeError thrown
          line 136 of /lib/dml/sqlsrv_native_moodle_recordset.php: call to sqlsrv_free_stmt()
          line 80 of /lib/dml/sqlsrv_native_moodle_recordset.php: call to sqlsrv_native_moodle_recordset->close()
          line ? of unknownfile: call to sqlsrv_native_moodle_recordset->__destruct()
       
      Exception - Unknown error type: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in [dirroot]/lib/outputrenderers.php on line 1551
      Debug info:
      Error code: generalexceptionmessage
      Stack trace:
       
          line 157 of /lib/behat/lib.php: Exception thrown
          line ? of unknownfile: call to behat_error_handler()
          line 1551 of /lib/outputrenderers.php: call to str_replace()
          line 3120 of /lib/outputrenderers.php: call to core_renderer->footer()
          line 455 of /lib/setuplib.php: call to core_renderer->fatal_error()
          line ? of unknownfile: call to default_exception_handler()
      

      The initial errors are a symptom of the latter exceptions (sqlsrv_free_stmt(): supplied resource is not a valid ss_sqlsrv_stmt resource) that are caused by unclosed recordsets, and exhibited when running PHP 8.3 with SQL Server

      A further improvement to automatically detect these unclosed recordsets is proposed at MDL-81252

            pholden Paul Holden
            pholden Paul Holden
            Pedro Jordao Pedro Jordao
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            CiBoT CiBoT
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 35 minutes
                3h 35m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.