session_write_close() errors during Behat

Bug #1428918 reported by Aaron Wells on 2015-03-06
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Medium
Unassigned

Bug Description

The session changes that we made for the Bug 1352028 bulk loader status bar (closing the session after each update) cause the Behat CLI installer script to throw a whole lot of the following PHP warning:

PHP Warning: session_write_close(): open(/home/aaronw/dataroot/mahara/behat/sessions/7/4/3/sess_743cc5981da7bf0026f59d27bbb2adf5, O_RDWR) failed: No such file or directory (2) in /home/aaronw/www/mahara/htdocs/auth/session.php on line 309
ensure session!
/home/aaronw/dataroot/mahara/behat/sessions
743cc5981da7bf0026f59d27bbb2adf5
PHP Stack trace:
PHP 1. {main}() /home/aaronw/www/mahara/htdocs/testing/frameworks/behat/cli/util.php:0
PHP 2. BehatTestingUtil::install_site() /home/aaronw/www/mahara/htdocs/testing/frameworks/behat/cli/util.php:91
PHP 3. upgrade_mahara() /home/aaronw/www/mahara/htdocs/testing/frameworks/behat/classes/util.php:85
PHP 4. log_info() /home/aaronw/www/mahara/htdocs/lib/mahara.php:218
PHP 5. log_message() /home/aaronw/www/mahara/htdocs/lib/errors.php:85
PHP 6. Session->add_info_msg() /home/aaronw/www/mahara/htdocs/lib/errors.php:206
PHP 7. Session->ro_session() /home/aaronw/www/mahara/htdocs/auth/session.php:204
PHP 8. session_write_close() /home/aaronw/www/mahara/htdocs/auth/session.php:309
PHP 9. error() /home/aaronw/www/mahara/htdocs/auth/session.php:309
PHP 10. log_message() /home/aaronw/www/mahara/htdocs/lib/errors.php:441
PHP 11. Session->add_error_msg() /home/aaronw/www/mahara/htdocs/lib/errors.php:206
PHP 12. Session->ro_session() /home/aaronw/www/mahara/htdocs/auth/session.php:221
PHP 13. session_write_close() /home/aaronw/www/mahara/htdocs/auth/session.php:309

Aaron Wells (u-aaronw) wrote :

After much investigation I'm not sure of the precise cause of this problem, except that it's caused by calling session_write_close() repeatedly during CLI execution of the install script by Behat. Running the install script normally, doesn't cause this problem. And doing the install through the web interface instead of CLI, also doesn't cause this problem.

Since the CLI interface doesn't actually generate and use sessions anyway, the easiest fix is just to make the functions in our Session class short-circuit if you're running in CLI.

Reviewed: https://reviews.mahara.org/4365
Committed: http://gitorious.org/mahara/mahara/commit/958b9401fb0e43910984209f8582f28951629ec1
Submitter: Ghada El-Zoghbi (<email address hidden>)
Branch: master

commit 958b9401fb0e43910984209f8582f28951629ec1
Author: Aaron Wells <email address hidden>
Date: Fri Mar 6 15:07:51 2015 +1300

Bug 1428918: Don't bother with opening & closing session, in CLI

Repeated calls to session_write_close() during CLI, are causing
problems for Behat (for some reason). Since the CLI doesn't actually
do anything with these session calls anyway, let's just skip it.

Change-Id: I0c6142d2fd3df203b7635fb9c0bae13fd4ec854a

Changed in mahara:
status: New → Fix Committed
importance: Undecided → Medium
milestone: none → 15.04.0
Robert Lyon (robertl-9) on 2015-04-17
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers