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

Compiled templates are truncated

    Details

    • Type: Bug
    • Status: In Progress
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 4.6.28, 4.7.20
    • Fix Version/s: Unscheduled
    • Component/s: None
    • Labels:
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Sprint:
      4.7.11 Drupal, 4.7.10 Developery stuff
    • Funding Source:
      Contributed Code

      Description

      CiviCRM has patched Smarty.class.php with a validateCompilePath() method.

      This method is not safe for concurrent processes which may be using the same compiled templates, because it actually truncates the compiled template which it is validating. If another process is including the template which is being validated/truncated, it'll fail with a cryptic "bus error".

      My initial hack was to avoid the bus error on concurrent processes by opening the file for appending, which avoids truncating the file in place.

      The PR has now been updated to remove the broken validateCompilePath() method altogether.  Instead, a sha256 hash is generated and used as the filename.  This resolves additional race conditions: 1) creating an empty file that is expected to be a compiled template and 2) unlinking a compiled template that was expected to be there.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                mfb Mark Burdett
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated: