Session files not cleaned except on linux

Bug #863895 reported by Alex
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Medium
Hugh Davenport

Bug Description

Since out Update to Mahara 1.4 the cron job isn't working any more.
Even though it is setup properly Mahare reports that the cron job isn't running. Here's what the Apache log says:

[DBG] e7 (lib/cron.php:146) Running core cron rebuild_artefact_parent_cache_dirty
[DBG] e7 (lib/cron.php:502) Skipping long-running cron job core_auth_handle_account_expiries (Wed, 21 Sep 2011 10:06:01 +0200).
[DBG] e7 (lib/cron.php:146) Running core cron activity_process_queue
[DBG] e7 (lib/cron.php:146) Running core cron import_process_queue
[DBG] e7 (lib/cron.php:168) ---------- cron finished Thu, 22 Sep 2011 09:35:01 +0200 ----------
[DBG] 38 (lib/cron.php:45) ---------- cron running Thu, 22 Sep 2011 09:36:01 +0200 ----------
[DBG] 38 (lib/cron.php:146) Running core cron rebuild_artefact_parent_cache_dirty
[DBG] 38 (lib/cron.php:502) Skipping long-running cron job core_auth_handle_account_expiries (Wed, 21 Sep 2011 10:06:01 +0200).
[DBG] 38 (lib/cron.php:168) ---------- cron finished Thu, 22 Sep 2011 09:36:01 +0200 ----------
[DBG] db (lib/cron.php:45) ---------- cron running Thu, 22 Sep 2011 09:37:01 +0200 ----------
[DBG] db (lib/cron.php:146) Running core cron rebuild_artefact_parent_cache_dirty
[DBG] db (lib/cron.php:502) Skipping long-running cron job core_auth_handle_account_expiries (Wed, 21 Sep 2011 10:06:01 +0200).
[DBG] db (lib/cron.php:168) ---------- cron finished Thu, 22 Sep 2011 09:37:01 +0200 ----------
A nonrecoverable error occured. This probably means you have encountered a bug in the systemxargs: illegal option -- r
xargs: Usage: xargs: [-t] [-p] [-e[eofstr]] [-E eofstr] [-I replstr] [-i[replstr]] [-L #] [-l[#]] [-n # [-x]] [-s size] [cmd [args ...]]
A nonrecoverable error occured. This probably means you have encountered a bug in the systemxargs: illegal option -- r

Server OS: SunOS
PHP Version: 5.2.9
Database: MySQL
Mahara Version: 1.4
Browser: Firefox 7.0.1

Alex (alex-nachtfieber)
description: updated
Revision history for this message
Richard Mansfield (richard-mansfield) wrote :

This will be caused by the following line in htdocs/auth/lib.php:

 exec('find ' . escapeshellarg(get_config('dataroot') . 'sessions') . ' -type f -mtime +1 | xargs -n 1000 -r rm');

It needs to be rewritten to work independently of the os.

Changed in mahara:
status: New → Triaged
importance: Undecided → Low
summary: - Cron Job not running properly
+ Session files not cleaned except on linux
tags: added: solaris
Revision history for this message
François Marier (fmarier) wrote :

Bumping priority since it means that sessions stick around for a really long time on non-linux platforms.

tags: added: security
Changed in mahara:
importance: Low → Medium
milestone: none → 1.5.0
tags: added: windows
Revision history for this message
Hugh Davenport (hugh-davenport) wrote :
Changed in mahara:
status: Triaged → In Progress
assignee: nobody → Hugh Davenport (hugh-catalyst)
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/909
Committed: http://gitorious.org/mahara/mahara/commit/df1d497a676e01928c6d5dbf06c9c27afddf3252
Submitter: Francois Marier (<email address hidden>)
Branch: master

commit df1d497a676e01928c6d5dbf06c9c27afddf3252
Author: Hugh Davenport <email address hidden>
Date: Fri Dec 2 12:09:23 2011 +1300

    Clean up session files in OS-independant way

    Bug #863895

    This changes the function to be similar to the function
    file_cleanup_old_cached_files in lib/file.php

    It uses php functions instead of relying on shell commands
    existing.

    Change-Id: Ie6b94f04e589e6f81c76d91fdc975744358dd2ab
    Signed-off-by: Hugh Davenport <email address hidden>

Changed in mahara:
status: In Progress → Fix Committed
Melissa Draper (melissa)
Changed in mahara:
status: Fix Committed → Fix Released
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.