Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Actualize lock files in a multi instance environment share the same path #6370

Open
kdanni opened this issue Apr 21, 2024 · 5 comments

Comments

@kdanni
Copy link

kdanni commented Apr 21, 2024

Describe the bug

Current installed version 1.23.1

In multi installation setup on hosted server where I have little agency instances running actualize cron jobs at same time share actualize lock files. Causing failed actualize job for every other instance after the first.

app/actualize_script.php:
$mutexFile = TMP_PATH . '/actualize.freshrss.lock';

I modified the "TMP_PATH . '/actualize.freshrss.lock';`" line to unique filenames per instance. And it solved my issue for now. However, I think this issue can cause problem for others.

To Reproduce

  1. Setup multiple instance.
  2. Setup cron actualize jobs to the same date.
  3. Check cron logs.
  4. See error in one: "FreshRSS feeds actualization was already running, so aborting new run..."

Expected behavior

Instances in the same environment installed different directory have different lock files.

FreshRSS version

Current installed version 1.23.1

Environment information

Installed on LAMP hosting service managed by Cpanel.

  • PHP 7.4+

Additional context

No response

@kdanni kdanni added the Bug (unconfirmed) issues thar could not reproduced yeat label Apr 21, 2024
@Alkarex
Copy link
Member

Alkarex commented Apr 21, 2024

Hello,
I would suggest you make a file ./constants.local.php with a unique temp directory for your various instances, like:

<?php
define('TMP_PATH', '/tmp/freshrss1/');

@math-GH math-GH added Documentation 📚 Support Support users to use FreshRSS and removed Bug (unconfirmed) issues thar could not reproduced yeat labels Apr 21, 2024
@kdanni
Copy link
Author

kdanni commented Apr 22, 2024

Thanks!

constants.local.php is a clean work around.
Scripting the directory creation was made things scalable. Also it works before and after version upgrade.

I still think lock files names including unique part per instance prevent collision out of box. It's in a tmp folder anyway.

<?php

$sysTmpDir = sys_get_temp_dir();
$dirMd5 = md5(__DIR__);

$tmpPath = $sysTmpDir . '/' . $dirMd5;
$dataPath = __DIR__ . '/data/' . $dirMd5; // Reference for finding the md5 hashed dir name.

if (!is_dir($tmpPath))
{
    mkdir($tmpPath, 0755, true);
}
if (!is_dir($dataPath))
{
    mkdir($dataPath, 0755, true);
}

define('TMP_PATH', $tmpPath);

@Alkarex
Copy link
Member

Alkarex commented Apr 22, 2024

I still think lock files names including unique part per instance prevent collision out of box

Yes, that would be reasonable. We need to find what value to use to be unique there. Maybe our salt.

@Frenzie
Copy link
Member

Frenzie commented Apr 22, 2024

Maybe our salt.

That sounds leaky.

@Alkarex
Copy link
Member

Alkarex commented Apr 22, 2024

I ment based on 🤓

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants