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

Access to MavlinkCommandSender::_work_queue without locking the mutex #2438

Closed
snow910 opened this issue Nov 11, 2024 · 3 comments · Fixed by #2439
Closed

Access to MavlinkCommandSender::_work_queue without locking the mutex #2438

snow910 opened this issue Nov 11, 2024 · 3 comments · Fixed by #2439
Labels

Comments

@snow910
Copy link

snow910 commented Nov 11, 2024

void MavlinkCommandSender::queue_command_async(
    const CommandLong& command, const CommandResultCallback& callback)
{
    if (_command_debugging) {
        LogDebug() << "COMMAND_LONG " << (int)(command.command) << " to send to "
                   << (int)(command.target_system_id) << ", " << (int)(command.target_component_id);
    }

    CommandIdentification identification = identification_from_command(command);

    for (const auto& work : _work_queue) {
        if (work->identification == identification && callback == nullptr) {
            if (_command_debugging) {
                LogDebug() << "Dropping command " << static_cast<int>(identification.command)
                           << " that is already being sent";
            }
            return;
        }
    }
    // ...
}

Access to _work_queue without locking the mutex

@julianoes
Copy link
Collaborator

Hmm 🤔, that doesn't look right indeed. Do you want to make a pull request to fix it?

@julianoes
Copy link
Collaborator

Given the system_tests segfaults, I wanted to try this out immediately and did the PR, sorry.

@snow910
Copy link
Author

snow910 commented Nov 12, 2024

Thank you :)

@snow910 snow910 closed this as completed Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants