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

Closures within the course renderer cause fatal errors when using eAccelerator

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.6, 2.4.3, 2.5
    • Fix Version/s: 2.3.7, 2.4.4
    • Component/s: Course
    • Labels:
    • Testing Instructions:
      Hide
      1. Enable eAccelerator.
      2. Log in as an admin.
      3. Browse to a course and turn on editing.
      4. Test that the activity chooser displays without errors.
      5. Under 2.5 (master), with multiple courses and cats, try all the frontpage combinations (list of courses, cats, combo...) logged and not logged. Navigating along cats...
      Show
      Enable eAccelerator. Log in as an admin. Browse to a course and turn on editing. Test that the activity chooser displays without errors. Under 2.5 (master), with multiple courses and cats, try all the frontpage combinations (list of courses, cats, combo...) logged and not logged. Navigating along cats...
    • Workaround:
      Hide

      Disable eAccelerator.

      Show
      Disable eAccelerator.
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull Master Branch:
      wip-MDL-39432-m25

      Description

      To reproduce:

      1. Enable eAccelerator.
      2. Log in as an admin.
      3. Browse to a course and turn on editing.

      Fatal error: Invalid opcode 153/1/8. in /var/www/integration/course/renderer.php on line 203
      Call Stack

      1. Time Memory Function Location
        1 0.0009 760928
        Unknown macro: {main}

        ( ) ../view.php:0
        2 1.4550 76235776 require( '/var/www/integration/course/format/topics/format.php' ) ../view.php:276
        3 1.4568 76241192 format_section_renderer_base->print_multiple_section_page( ) ../format.php:56
        4 1.4705 76246064 core_course_renderer->course_section_add_cm_control( ) ../renderer.php:724
        5 1.5501 83682312 core_course_renderer->course_modchooser( ) ../renderer.php:456

      There are a couple of closure style anonymous functions within course/renderer.php.
      This issue was noticed with the use of closures within the lti module as per MDL-36060.
      Dan has created MDL-39430 to decide the future for us supporting for eAccelerator however for the time being it is probably worth just quickly converting these to lambda style anonymous functions.

      Many thanks
      Sam

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            samhemelryk Sam Hemelryk added a comment -

            Easy fix, up for integration now.

            May depend upon the direction that MDL-39430 takes.

            Show
            samhemelryk Sam Hemelryk added a comment - Easy fix, up for integration now. May depend upon the direction that MDL-39430 takes.
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Integrated, thanks!

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Integrated, thanks!
            Hide
            fred Frédéric Massart added a comment - - edited

            Sorry, but I have to fail this test because I can't even get to the course page.

            Fatal error: Invalid opcode 153/1/8. in /home/fred/www/repositories/im/moodle/lib/coursecatlib.php on line 2098 
             
            Call Stack: 0.0005 784208 
            1. {main}() /home/fred/www/repositories/im/moodle/index.php:0 2.0932 112770872
            2. core_course_renderer->frontpage_my_courses() /home/fred/www/repositories/im/moodle/index.php:209 2.0993 112793352
            3. core_course_renderer->coursecat_courses() /home/fred/www/repositories/im/moodle/course/renderer.php:1821 2.3433 115192120
            4. core_course_renderer->coursecat_coursebox() /home/fred/www/repositories/im/moodle/course/renderer.php:1260 2.3449 115197048
            5. core_course_renderer->coursecat_coursebox_content() /home/fred/www/repositories/im/moodle/course/renderer.php:1097 2.3449 115197320
            6. course_in_list->get_course_overviewfiles() /home/fred/www/repositories/im/moodle/course/renderer.php:1134 
            

            This might be caused by some listings that I have enabled on the front page. See frontpageloggedin.

            I also noticed that there are more closures throughout the code, Behat make use of some for instance.

            Show
            fred Frédéric Massart added a comment - - edited Sorry, but I have to fail this test because I can't even get to the course page. Fatal error: Invalid opcode 153/1/8. in /home/fred/www/repositories/im/moodle/lib/coursecatlib.php on line 2098   Call Stack: 0.0005 784208 1. {main}() /home/fred/www/repositories/im/moodle/index.php:0 2.0932 112770872 2. core_course_renderer->frontpage_my_courses() /home/fred/www/repositories/im/moodle/index.php:209 2.0993 112793352 3. core_course_renderer->coursecat_courses() /home/fred/www/repositories/im/moodle/course/renderer.php:1821 2.3433 115192120 4. core_course_renderer->coursecat_coursebox() /home/fred/www/repositories/im/moodle/course/renderer.php:1260 2.3449 115197048 5. core_course_renderer->coursecat_coursebox_content() /home/fred/www/repositories/im/moodle/course/renderer.php:1097 2.3449 115197320 6. course_in_list->get_course_overviewfiles() /home/fred/www/repositories/im/moodle/course/renderer.php:1134 This might be caused by some listings that I have enabled on the front page. See frontpageloggedin . I also noticed that there are more closures throughout the code, Behat make use of some for instance.
            Hide
            samhemelryk Sam Hemelryk added a comment - - edited

            Cheers Fred - that one was indeed missed.
            No doubt tied to something on the front page I don't have on my site, and annoyingly missed because my grep didn't include whitespace after the word function.
            I'll get a branch up for that shortly and get someone to pull it in and reopen this.

            In regards to the other closures could you please head to MDL-39430 and just see if there are issues linked there for them.
            If not would you mind creating issues it would nice to fix these up.

            Many thanks
            Sam

            Show
            samhemelryk Sam Hemelryk added a comment - - edited Cheers Fred - that one was indeed missed. No doubt tied to something on the front page I don't have on my site, and annoyingly missed because my grep didn't include whitespace after the word function. I'll get a branch up for that shortly and get someone to pull it in and reopen this. In regards to the other closures could you please head to MDL-39430 and just see if there are issues linked there for them. If not would you mind creating issues it would nice to fix these up. Many thanks Sam
            Hide
            fred Frédéric Massart added a comment -

            Hi Sam,

            Some issues are linked with MDL-39430, but not all of them. Though, Eloy's grep in the latter issue identified all of them, so I assume no more action are required.

            Cheers,
            Fred

            Show
            fred Frédéric Massart added a comment - Hi Sam, Some issues are linked with MDL-39430 , but not all of them. Though, Eloy's grep in the latter issue identified all of them, so I assume no more action are required. Cheers, Fred
            Hide
            samhemelryk Sam Hemelryk added a comment -

            Cool thanks Fred.

            I've got a branch up to address the other anonymous functions now.
            It'll need a good review as the other closures used were more in depth.

            Branch: wip-MDL-39432-m25-i
            Diff: https://github.com/samhemelryk/moodle/commit/wip-MDL-39432-m25-i

            Cheers
            Sam

            Show
            samhemelryk Sam Hemelryk added a comment - Cool thanks Fred. I've got a branch up to address the other anonymous functions now. It'll need a good review as the other closures used were more in depth. Branch: wip- MDL-39432 -m25-i Diff: https://github.com/samhemelryk/moodle/commit/wip-MDL-39432-m25-i Cheers Sam
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Note: code looks ok, just if you can amend testing instructions and verify it's 2.5 only... TIA!

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Note: code looks ok, just if you can amend testing instructions and verify it's 2.5 only... TIA!
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            (unit tests passing)

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - (unit tests passing)
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            (and yes, it's 2.5 only)

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - (and yes, it's 2.5 only)
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Extra commit applied to master, should fix the coursecats problem. Please verify it does not happen anymore.

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Extra commit applied to master, should fix the coursecats problem. Please verify it does not happen anymore.
            Hide
            fred Frédéric Massart added a comment -

            Thanks, the test now passes on 2.3 onwards. Cheers!

            Show
            fred Frédéric Massart added a comment - Thanks, the test now passes on 2.3 onwards. Cheers!
            Hide
            poltawski Dan Poltawski added a comment -

            Thanks! You're changes are now spread to the world through this git and our source control repositories.

            No time to rest though, we've got days to make 2.5 the best yet!

            ciao

            Show
            poltawski Dan Poltawski added a comment - Thanks! You're changes are now spread to the world through this git and our source control repositories. No time to rest though, we've got days to make 2.5 the best yet! ciao

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  13/May/13