Missing directories in <sitedata>/sessions makes login fail

Bug #1736843 reported by Cecilia Vela Gurovic
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Cecilia Vela Gurovic
17.10
Fix Released
High
Unassigned
18.04
Fix Released
High
Cecilia Vela Gurovic

Bug Description

In <sitedata>/sessions there should be directories named 0,1,2,..9,a,b..,f
There should always be all of them present, if they are not there we create them.
When we check the sessions dir, we assume there could be only two possibilities: We have all of them or we have none. That's why we only check for the first one (0).
In the case where some of these directories are missing, but the 0 is present, we will see the following error when we try to login:

"Mahara: Site unavailable
Something in the way you're interacting with Mahara is causing an error.
Details if any, follow:

Logged out user can not be stored in usr_session"

Call stack (most recent first):

    log_message("session_regenerate_id(): Failed to create(read) se...", 8, true, true, "/home/ceciliavg/maharacode/maharatest/htdocs/auth/...", 507) at /home/ceciliavg/maharacode/maharatest/htdocs/lib/errors.php:521
    error(4096, "session_regenerate_id(): Failed to create(read) se...", "/home/ceciliavg/maharacode/maharatest/htdocs/auth/...", 507, array(size 0)) at Unknown:0
    session_regenerate_id(true) at /home/ceciliavg/maharacode/maharatest/htdocs/auth/session.php:507
    Session->regenerate_id() at /home/ceciliavg/maharacode/maharatest/htdocs/auth/user.php:1681
    LiveUser->authenticate(object(stdClass), "1") at /home/ceciliavg/maharacode/maharatest/htdocs/auth/user.php:1518
    LiveUser->login("admin", "********") at /home/ceciliavg/maharacode/maharatest/htdocs/auth/lib.php:1520
    login_submit(object(Pieform), array(size 6)) at /home/ceciliavg/maharacode/maharatest/htdocs/lib/pieforms/pieform.php:542
    Pieform->__construct(array(size 9)) at /home/ceciliavg/maharacode/maharatest/htdocs/lib/mahara.php:5022
    pieform_instance(array(size 9)) at /home/ceciliavg/maharacode/maharatest/htdocs/auth/lib.php:521
    auth_setup() at /home/ceciliavg/maharacode/maharatest/htdocs/init.php:389
    require("/home/ceciliavg/maharacode/maharatest/htdocs/init....") at /home/ceciliavg/maharacode/maharatest/htdocs/index.php:16

[WAR] 46 (auth/session.php:510) session_regenerate_id() failed
Call stack (most recent first):

    log_message("session_regenerate_id() failed", 8, true, true) at /home/ceciliavg/maharacode/maharatest/htdocs/lib/errors.php:95
    log_warn("session_regenerate_id() failed") at /home/ceciliavg/maharacode/maharatest/htdocs/auth/session.php:510
    Session->regenerate_id() at /home/ceciliavg/maharacode/maharatest/htdocs/auth/user.php:1681
    LiveUser->authenticate(object(stdClass), "1") at /home/ceciliavg/maharacode/maharatest/htdocs/auth/user.php:1518
    LiveUser->login("admin", "********") at /home/ceciliavg/maharacode/maharatest/htdocs/auth/lib.php:1520
    login_submit(object(Pieform), array(size 6)) at /home/ceciliavg/maharacode/maharatest/htdocs/lib/pieforms/pieform.php:542
    Pieform->__construct(array(size 9)) at /home/ceciliavg/maharacode/maharatest/htdocs/lib/mahara.php:5022
    pieform_instance(array(size 9)) at /home/ceciliavg/maharacode/maharatest/htdocs/auth/lib.php:521
    auth_setup() at /home/ceciliavg/maharacode/maharatest/htdocs/init.php:389
    require("/home/ceciliavg/maharacode/maharatest/htdocs/init....") at /home/ceciliavg/maharacode/maharatest/htdocs/index.php:16

Changed in mahara:
assignee: nobody → Cecilia Vela Gurovic (ceciliavg)
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/8329

Changed in mahara:
status: Confirmed → In Progress
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/8329
Committed: https://git.mahara.org/mahara/mahara/commit/9318a19f838c52199e9cbf2ed8e68bff35b4d2a7
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 9318a19f838c52199e9cbf2ed8e68bff35b4d2a7
Author: Cecilia Vela Gurovic <email address hidden>
Date: Thu Dec 7 16:53:54 2017 +1300

Bug 1736843: recreate the sessions dirs when clear_all_caches deletes them

when calling clear_all_caches(true), the dataroot/sessions
directories will be deleted
we recreate them again at that moment instead of
waiting until the Session checks

behatnotneeded

Change-Id: I1ea2318cda4743d4908f5cb51990b02aa385a1ea

Robert Lyon (robertl-9)
Changed in mahara:
status: In Progress → Fix Committed
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/8346

Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

The review from 13 December was abandonded.

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Patch for "17.10_STABLE" branch: https://reviews.mahara.org/8380

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/8380
Committed: https://git.mahara.org/mahara/mahara/commit/c26a140ea5a028f3f04dc41e23d2ebdb61f48f1b
Submitter: Robert Lyon (<email address hidden>)
Branch: 17.10_STABLE

commit c26a140ea5a028f3f04dc41e23d2ebdb61f48f1b
Author: Cecilia Vela Gurovic <email address hidden>
Date: Thu Dec 7 16:53:54 2017 +1300

Bug 1736843: recreate the sessions dirs when clear_all_caches deletes them

when calling clear_all_caches(true), the dataroot/sessions
directories will be deleted
we recreate them again at that moment instead of
waiting until the Session checks

behatnotneeded

Change-Id: I1ea2318cda4743d4908f5cb51990b02aa385a1ea

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.