Support-Forum

jDownloads 4.x Random File Permission Corruption After Concurrent Multi-Category Cron Sync with Exte

Started by max1987martin, 29.05.2026 14:32:18

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

max1987martin

Hello everyone,

I am facing a very strange issue with jDownloads 4.x on Joomla 5 after implementing an automated synchronization system for external download repositories.

Environment setup:

Joomla 5.2.x
PHP 8.3
MariaDB 11
jDownloads 4.1 beta
Redis object cache enabled
Nginx reverse proxy
External storage mounted via NFS
Around 48,000 downloadable files
Multi-category inheritance with custom user group permissions

Problem details:

I created a cron-based synchronization script which automatically scans external mounted directories every 15 minutes and updates jDownloads entries through the database and plugin events.

The issue only appears when:

Multiple users download files during synchronization
Cache preloading is enabled
Files belong to nested categories with inherited permissions
Download method is set to "PHP Script"
Simultaneous frontend uploads occur

Symptoms:

Random files become inaccessible for specific user groups
Download counters duplicate inconsistently
Some file IDs return 404 while database entries still exist
Occasionally category permissions reset partially
Rarely, the same file appears duplicated with different checksum values
Logs show no SQL errors
Redis cache purge changes behavior temporarily
Issue disappears if direct download mode is enabled instead of PHP Script mode

Additional strange behavior:

When OPCache is disabled, the problem frequency decreases significantly, but frontend category rendering becomes slower.  mcdvoice

I already tested:

Rebuilding categories
Repairing assets table
Reinstalling jDownloads
Disabling all third-party plugins
Switching from NFS to local SSD storage
Different PHP memory and execution limits
Manual database optimization
Joomla debug mode

Nothing fully fixes the issue.

Has anyone experienced race-condition-like behavior inside jDownloads during concurrent download + sync operations with external mounted storage systems?

I suspect there may be a locking issue between category asset inheritance, cache invalidation, and file permission evaluation during simultaneous cron execution.

Any ideas where to investigate next?
  •  

ColinM

Hi
It sounds to that the 'cron-based synchronization script which automatically scans external mounted directories every 15 minutes and updates jDownloads entries through the database and plugin events' could be in conflict with jD activity. If your script and jD are active simultaneously then there could be a 'challenge' as they both access the same database.
Article "Limited Access Example - A members Organisation'

Colin
Colin M
  •  

max1987martin

  •  

Arno

Hi.
Thanks for your detailed report.

At the moment this does not look like a clear standalone jDownloads core bug, but rather like a high-concurrency integration issue in a very complex setup (frequent sync writes + active frontend traffic + cache layer + nested ACL inheritance).

A practical way to narrow it down is:

1. Ensure sync jobs never overlap (single worker / locking).
2. Temporarily disable Redis object cache during sync runs.
3. Run one test cycle with no simultaneous frontend uploads/downloads.
4. Avoid direct DB writes unless all related data/asset/cache steps are handled consistently.
5. Compare behavior between direct download mode and PHP script mode under the same workload.

In such environments, race-condition-like effects can happen if external sync processes and live frontend operations update related records at the same time.

If you can provide a minimal reproducible setup (small category tree, exact sync sequence, exact changed records), we can investigate much more precisely.
Best Regards / Gruß
Arno
Please make a Donation for jDownloads and/or write a review on the Joomla! Extensions directory!
  •