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

Throttled event logging is not thread-safe #3149

Open
zimri-leisher opened this issue Jan 21, 2025 · 1 comment
Open

Throttled event logging is not thread-safe #3149

zimri-leisher opened this issue Jan 21, 2025 · 1 comment
Labels
bug High Priority High Priority issue that needs to be resolved.

Comments

@zimri-leisher
Copy link
Collaborator

F´ Version 3.4.3
Affected Component All events with throttling

Problem Description

Adding throttle X to an event (in this example, ("YY_ZZ") generates the following code:

<snip>
  void ABCDEComponentBase ::
    log_XX_YY_ZZ()
  {
    // Check throttle value
    if (this->m_XX_YY_Throttle >= EVENTID_XX_YY_THROTTLE) {
      return;
    }
    else {
      this->m_XX_YY_Throttle++;
    }
<snip>

These are not thread-safe accesses to the m_XX_YY_Throttle variable, and so could result in dangerous behavior if two threads try to log the same event. Likely the best fix is to make m_XX_YY_Throttle atomic, and barring that, to add a lock around reads/writes to it.

Context / Environment

Execute fprime-util version-check and share the output.

Operating System: Linux
CPU Architecture: x86_64
Platform: Linux-5.15.133.1-microsoft-standard-WSL2-x86_64-with-glibc2.35
Python version: 3.10.12
CMake version: 3.22.1
Pip version: 22.0.2
Pip packages:
    fprime-tools==3.4.4
    fprime-gds==3.4.3
    fprime-fpp-*==2.1.0a3```
@zimri-leisher
Copy link
Collaborator Author

I believe this is also the case for telemetry writing when "update on change" is present.

@LeStarch LeStarch added the High Priority High Priority issue that needs to be resolved. label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug High Priority High Priority issue that needs to be resolved.
Projects
None yet
Development

No branches or pull requests

2 participants