View Issue Details

This bug affects 1 person(s).
 2
IDProjectCategoryView StatusLast Update
20105Bug reportsAssetspublic2025-05-15 17:33
Reporter2BITS_PL Assigned To 
PrioritynoneSeverityminor 
Status newResolutionopen 
Product Version6.6.x 
Summary20105: AssetManager: inconsistent hashes due to filemtime in distributed deployments
Description

In distributed setups (e.g. behind a load balancer or using blue-green deployments), we're experiencing issues with inconsistent asset hashes caused by the use of filemtime() in the AssetManager.

The problem occurs because the generatePath() method uses filemtime() to build the asset directory hash. On multiple nodes, file modification times may differ despite identical content, leading to mismatched hashes. This causes 404 errors or missing assets when users switch between nodes.

Sticky sessions can partially mitigate this in load-balanced environments, but blue-green deployments still cause hash mismatches when switching traffic from one environment to another.

We have a few questions:

  1. What was the rationale behind using filemtime() as part of the hash?
  2. Since the asset versioning already includes globalAssetsVersion (which is automatically incremented when clearing assets via the admin panel), is filemtime() still necessary?
  3. If we override the behavior to exclude filemtime(), what are the risks?

This behavior makes it hard to maintain reliable deployments in production environments.

TagsNo tags attached.
Bug heat2
Complete LimeSurvey version number (& build)6.8.1+241120
I will donate to the project if issue is resolvedNo
Browser
Database type & versionSQL Server 2019
Server OS (if known)
Webserver software & version (if known)
PHP Versionv8.1.29 NTS x64

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2025-05-15 17:31

developer   ~82677

What was the rationale behind using filemtime() as part of the hash?

To be sure to have a new file when you update it.
Included in Yii

Since the asset versioning already includes globalAssetsVersion (which is automatically incremented when clearing assets via the admin panel), is filemtime() still necessary?

Yes : when you update a file : it was never reset except if you click on the button.

If we override the behavior to exclude filemtime(), what are the risks?

On a fixed environment : none

DenisChenu

DenisChenu

2025-05-15 17:33

developer   ~82678

Yii : https://github.com/LimeSurvey/LimeSurvey/blob/a7aaf89092a36e98b045344730315144f425cec0/vendor/yiisoft/yii/framework/web/CAssetManager.php#L328

Issue History

Date Modified Username Field Change
2025-05-15 13:27 2BITS_PL New Issue
2025-05-15 17:31 DenisChenu Note Added: 82677
2025-05-15 17:31 DenisChenu Bug heat 0 => 2
2025-05-15 17:33 DenisChenu Note Added: 82678