Cron is not running

Bug #794490 reported by Michael Wuttke on 2011-06-08
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
High
François Marier
1.3
High
François Marier

Bug Description

Mahara v1.4rc3
Linux 2.6.26-2
PHP 5.2.6
Apache-Server 2.2.9
postgresql-Server 8.4

I was trying to setup the cronjob for mahara explained like in the wiki: https://wiki.mahara.org/index.php/System_Administrator%27s_Guide/Cron_Job. But it do not work.

See the entry in the /etc/crontab:
 */5 * * * * www-data php -c /etc/php5/apache2/php.ini /data/srv/www/mahara/lib/cron.php >> /var/log/mahara/cron.log 2>&1

and the output of log-file in /var/log/mahara/cron.log:
"A nonrecoverable error occured. This probably means you have encountered a bug in the system[WAR] 1f (lib/web.php:2291) redirect() should be called with either /[something] for local redirects or http[something] for absolute redirects
Call stack (most recent first):
  * redirect("ar/www/mahara/lib/cron.php") at /var/www/mahara/init.php:192
  * require("/var/www/mahara/init.php") at /var/www/mahara/lib/cron.php:33

A nonrecoverable error occured. This probably means you have encountered a bug in the system".

Has anybody an idea?

Thanx,
michael wuttke

Changed in mahara:
status: New → Confirmed

I can reproduce this, it's caused by the new code which attempts to redirect to https.

Changed in mahara:
importance: Undecided → High
milestone: none → 1.4.0
assignee: nobody → Richard Mansfield (richard-mansfield)
Hugh Davenport (hugh-davenport) wrote :

Hi Michael,

Thanks for reporting this bug. Someone will look into this soon.

For whoever looks into it:
There are a few things:
-The function
get_relative_script_path() (htdocs/lib/web.php:2434 (on master))
uses substr against get_script_path but giving the length of
get_mahara_install_subdirectory(), need to work out which one is needed

-The function
get_mahara_install_subdirectory (htdocs/lib/mahara.php:1993 (master))
uses strpos($wwwroot, '/'). This will return -1 if the wwwroot is
something like
https://localhost (ie. no trailing /)
This case should get picked up, because init.php adds a '/' at end if
there isn't one.

Cheers,

Hugh

Darryl Hamilton (lordp) wrote :

Hi Michael

Can you please attach your config.php file? I'd like to see what config options you are overriding.

Remove any sensitive information such as the database password first.

Thanks
Darryl

Changed in mahara:
assignee: Richard Mansfield (richard-mansfield) → nobody
Changed in mahara:
assignee: nobody → François Marier (fmarier)
Michael Wuttke (wuttke-berlin) wrote :
Michael Wuttke (wuttke-berlin) wrote :

Hi Darryl, Hi Hugh,

Thank you for your answers. Attached your you can find my config.php file.

Cheers,
Michael

Reviewed: https://reviews.mahara.org/302
Committed: http://gitorious.org/mahara/mahara/commit/872bd80eec2fb5070d38ad682379664d71bf45fe
Submitter: Richard Mansfield (<email address hidden>)
Branch: 1.4_STABLE

commit 872bd80eec2fb5070d38ad682379664d71bf45fe
Author: Francois Marier <email address hidden>
Date: Thu Jun 9 18:43:23 2011 +1200

    Revert "Remove wwwroot from the database (bug #780177)"

    This reverts commit fb38dd955ceed3601da954dd5b2e55b682e1ac03.

    It turns out that we do need the wwwroot to be in the database
    because the code that sends forum posts via email runs in php
    cli mode and is needs to get the hostname of the site to embed
    in the headers.

    While not specifically mentioned in bug #794490, it was spitting
    out warnings in the logs.

    Conflicts:

     htdocs/lib/db/upgrade.php
     htdocs/lib/version.php

    Change-Id: Icb734f939889453e80b53647748976648ee18419
    Signed-off-by: Francois Marier <email address hidden>

François Marier (fmarier) wrote :

Hi Michael,

I have just released 1.4rc4, would you be able to check if your cron problems are resolved?

  https://launchpad.net/mahara/+milestone/1.4rc4

Thank you so much for reporting this so quickly. You saved us from an embarrassing 1.4.0 release :)

Cheers,
Francois

Changed in mahara:
status: Confirmed → Fix Committed
Michael Wuttke (wuttke-berlin) wrote :

Hallo Francois,

i have installed the version 1.4rc4 and the cronjob seems to work.

See the output of log-file in /var/log/mahara/cron.log:
[DBG] 8d (lib/cron.php:45) ---------- cron running Fri, 10 Jun 2011 11:10:01 +0200 ----------
[DBG] 8d (lib/cron.php:502) Skipping long-running cron job core_activity_process_queue (Fri, 10 Jun 2011 11:05:01 +0200).
[DBG] 8d (lib/cron.php:146) Running core cron auth_handle_account_expiries
[DBG] 8d (lib/cron.php:146) Running core cron cron_check_for_updates
[DBG] 8d (lib/cron.php:146) Running core cron export_cleanup_old_exports
[DBG] 8d (lib/cron.php:146) Running core cron rebuild_artefact_parent_cache_complete
[DBG] 8d (lib/cron.php:146) Running core cron cron_site_data_daily
[DBG] 8d (lib/cron.php:146) Running core cron auth_clean_partial_registrations
[DBG] 8d (lib/cron.php:146) Running core cron recalculate_quota
[DBG] 8d (lib/cron.php:146) Running core cron auth_handle_institution_expiries
[DBG] 8d (lib/cron.php:146) Running core cron import_cleanup_old_imports
[DBG] 8d (lib/cron.php:146) Running core cron cron_clean_internal_activity_notifications
[DBG] 8d (lib/cron.php:146) Running core cron import_process_queue
[DBG] 8d (lib/cron.php:146) Running core cron auth_remove_old_session_files
[DBG] 8d (lib/cron.php:146) Running core cron rebuild_artefact_parent_cache_dirty
[DBG] 8d (lib/cron.php:168) ---------- cron finished Fri, 10 Jun 2011 11:10:07 +0200 ----------

But in the admin-webfrontend it shows me:
"Cron: Cron is not running."

Is this related to the reported bug: https://bugs.launchpad.net/mahara/+bug/776955?

Thank you for your help,
michael

Changed in mahara:
status: Fix Committed → Fix Released
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/379
Committed: http://gitorious.org/mahara/mahara/commit/5266d1b4406cfdad86a57b2080910319ba9ad883
Submitter: Richard Mansfield (<email address hidden>)
Branch: master

commit 5266d1b4406cfdad86a57b2080910319ba9ad883
Author: Francois Marier <email address hidden>
Date: Thu Jun 9 18:43:23 2011 +1200

    Revert "Remove wwwroot from the database (bug #780177)"

    This reverts commit fb38dd955ceed3601da954dd5b2e55b682e1ac03.

    It turns out that we do need the wwwroot to be in the database
    because the code that sends forum posts via email runs in php
    cli mode and is needs to get the hostname of the site to embed
    in the headers.

    While not specifically mentioned in bug #794490, it was spitting
    out warnings in the logs.

    Conflicts:

     htdocs/lib/db/upgrade.php
     htdocs/lib/version.php

    Change-Id: I36b33ac72eee01f71056a45c706f2fc8674620ec
    Signed-off-by: Francois Marier <email address hidden>

François Marier (fmarier) wrote :

Hi Iñaki,

I've just pushed a fix for this against 1.3_STABLE:

  https://reviews.mahara.org/432

Are you able to test that patch and confirm that it solves your problem?

Cheers,
Francois

Iñaki Arenaza (iarenaza) wrote :

Hi François,

yes it does solve it :)

Saludos.
Iñaki.

Ruslan Kabalin (rkabalin) wrote :

> yes it does solve it :)

Thanks Iñaki, I marked the change as verified then.

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/432
Committed: http://gitorious.org/mahara/mahara/commit/861d5f1ef3c1a2d32ea2149600522988bf31cd17
Submitter: Francois Marier (<email address hidden>)
Branch: 1.3_STABLE

commit 861d5f1ef3c1a2d32ea2149600522988bf31cd17
Author: Francois Marier <email address hidden>
Date: Thu Jun 9 18:32:28 2011 +1200

    init: only redirect to HTTPS when running in a browser

    The redirect to HTTPS added in 02cf299a59851c06ac9227a2f0df898392196cf6
    was causing problems when cron was running using PHP cli (bug #794490).

    Change-Id: I4d9dcf295a7582645c9ba4ba1935b6b277eff59b
    Signed-off-by: Francois Marier <email address hidden>

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

Other bug subscribers

Bug attachments