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

Sticky blocks not being rendered after a random number is reached.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.9
    • Fix Version/s: 1.9
    • Labels:
      None
    • Environment:
      rhel5 OR ubuntu 7.1, mysql 5.0.22, php 5.16, apache 2.23
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      While setting up sticky blocks for our courses, we encountered an issue with Moodle 1.8.3 and 1.9 where some blocks aren't being rendered. After turning on debug, we noticed the following error messages upon rendering the stick blocks:

      Error: could not insert new context level "80", instance "8".

      • line 2246 of lib/accesslib.php: call to debugging()
      • line 2521 of lib/accesslib.php: call to create_context()
      • line 327 of blocks/moodleblock.class.php: call to get_context_instance()
      • line 326 of lib/blocklib.php: call to block_base->_add_edit_controls()
      • line 83 of admin/stickyblocks.php: call to blocks_print_group()

      Incorrect context specified

      • line 327 of lib/accesslib.php: call to debugging()
      • line 335 of blocks/moodleblock.class.php: call to has_capability()
      • line 326 of lib/blocklib.php: call to block_base->_add_edit_controls()
      • line 83 of admin/stickyblocks.php: call to blocks_print_group()

      Error: could not insert new context level "80", instance "8".

      • line 2246 of lib/accesslib.php: call to debugging()
      • line 2521 of lib/accesslib.php: call to create_context()
      • line 226 of blocks/moodleblock.class.php: call to get_context_instance()
      • line 256 of blocks/moodleblock.class.php: call to block_base->is_empty()
      • line 338 of lib/blocklib.php: call to block_base->_print_block()
      • line 83 of admin/stickyblocks.php: call to blocks_print_group()

      Incorrect context specified

      • line 327 of lib/accesslib.php: call to debugging()
      • line 228 of blocks/moodleblock.class.php: call to has_capability()
      • line 256 of blocks/moodleblock.class.php: call to block_base->is_empty()
      • line 338 of lib/blocklib.php: call to block_base->_print_block()
      • line 83 of admin/stickyblocks.php: call to blocks_print_group()

      I know the issue involves the context, block_instance, and block_pinned tables as the block_pinned will have an id that just happens to coincide with id of a block_instance, which is referenced by block_context.

      My colleague was able to break a fresh install of Moodle with this, so I am wondering what is up.

      It seems that stickyblocks is not writing to the block_instance and context tables. It is only writing to block_pinned, so when the id in block_pinned gets out of sync with the others, the problem occurs.

      If we manually add the corresponding ids to the block_instance and context tables, then the system behaves normally.

      This problem does not occur when adding non-sticky blocks.

      This problem does occur after adding over 6 sticky blocks on a FRESH install of moodle from MOODLE_19_STABLE CVS.

        Attachments

          Activity

            People

            Assignee:
            skodak Petr Skoda
            Reporter:
            rrusso33 Robert Russo
            Tester:
            Nicolas Martignoni
            Participants:
            Component watchers:
            Andrew Nicols, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan, Andrew Nicols, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              3/Mar/08