Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-16672

CRM/Core/BAO/Cache->cleanup() breaks registrations / contributions

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 4.6.3
    • Fix Version/s: Unscheduled
    • Component/s: None
    • Labels:
      None
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding

      Description

      Issues

      There appear to be a number of issues in the caching system, two particularly affect in-progress event registrations and donations (transactions).

      1) The admin action ‘Cleanup caches’ destroys in-progress sessions for transactions because it truncates civicrm_cache.

      Steps to recreate: Start an event registration with a confirmation page. Move on in the process, and then clear the caches. Go back or continue on the form results in a fatal error: 'Could not find a valid value for ID'

      2) The CRM/Core/BAO/Cache->cleanup() method seems to be run on many page requests. This function appears to generate a random number and has a 0.13% chance of clearing old transactions from the cache (more than 30 minutes old). This seems really bizarre.

      Steps to observe: Place a dsm() or print() into the cleanup() method to see how often it is run.

      Why resolve

      The issue only manifests itself for us because some of our event registration forms can actually take more than 30 minutes to complete (if a user is referring to a printed programme at the time). As a workaround we can just increase the cache timeout for transactions, defined in cleanup().
      However, it feels like the way caching is handled in Civi should be centralised better; and probably not triggered ‘randomly’ by standard page requests, with the cache lifetime defined in code.

      Proposed solution

      I may put together a wiki page with a full proposal, but some ideas to step in the right direction:

      • Remove fatal error for timed-out event transactions; mirror the contribution form which displays the ‘your session has expired’ message
      • Remove the cleanup() method that is randomly called
      • Only clear caches using the scheduled job which has been designed for the process
      • Make cache lifetimes configurable, or inherit session times from the CMS
      • Give admins safe and full cache reset options, the former wouldn’t erase in-progress transactions, the latter would display a warning that in-progress transactions will be erased

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                john John K.
              • Votes:
                2 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated: