Skip to content

[stable32] fix: iappconfig cache sync#6237

Merged
vitormattos merged 3 commits intostable32from
backport/6234/stable32
Dec 18, 2025
Merged

[stable32] fix: iappconfig cache sync#6237
vitormattos merged 3 commits intostable32from
backport/6234/stable32

Conversation

@backportbot-libresign
Copy link
Copy Markdown

@backportbot-libresign backportbot-libresign Bot commented Dec 18, 2025

Backport of #6234

Warning, This backport had conflicts that were resolved with the ours merge strategy and is likely incomplete ⚠️

Todo

  • Review and resolve any conflicts
  • Amend HEAD commit to remove the line stating to skip CI

Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

IAppConfig uses per-process cache, causing race conditions when CLI
commands and HTTP requests execute simultaneously during Behat tests.
The CLI generates a ca_id, but HTTP requests see an empty cache and
generate a different ca_id, overwriting the CLI value.

Solution:
- Detect debug mode (automatically set during Behat tests)
- Apply file lock + cache clear workaround only in debug mode
- Production code remains unchanged for optimal performance

This fix resolves test failures in features/sign/request.feature:28
and features/sign/request.feature:61 where setup validation was
failing due to mismatched certificate paths.

Signed-off-by: Vitor Mattos <[email protected]>
When getCaId() finds an empty CA ID in cache, it now calls
clearCache(true) to reload from database before generating a new one.
This prevents race conditions in test environments where CLI commands
and HTTP requests may execute simultaneously with independent caches.

The solution is simpler than using file locks and works transparently
in both test and production environments with minimal overhead.

Signed-off-by: Vitor Mattos <[email protected]>
Replace 'libresign:configure:openssl --cn test' CLI commands with

HTTP POST requests to '/apps/libresign/api/v1/admin/certificate/openssl'

in integration tests to prevent race conditions between CLI and HTTP

processes during test execution.

This ensures all certificate setup happens via HTTP requests, avoiding

IAppConfig cache synchronization issues that can occur when mixing CLI

commands with HTTP requests in the same test scenario.

Signed-off-by: Vitor Mattos <[email protected]>

[skip ci]
@github-project-automation github-project-automation Bot moved this to 0. Needs triage in Roadmap Dec 18, 2025
@backportbot-libresign backportbot-libresign Bot added this to the Next Patch (32) milestone Dec 18, 2025
@vitormattos vitormattos marked this pull request as ready for review December 18, 2025 20:41
@vitormattos vitormattos merged commit 8d9b0b5 into stable32 Dec 18, 2025
3 checks passed
@vitormattos vitormattos deleted the backport/6234/stable32 branch December 18, 2025 20:41
@github-project-automation github-project-automation Bot moved this from 0. Needs triage to 4. to release in Roadmap Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant