Skip to content

Backport various bugfixes to v3#2936

Open
julianoes wants to merge 8 commits into
v3from
v3-backport
Open

Backport various bugfixes to v3#2936
julianoes wants to merge 8 commits into
v3from
v3-backport

Conversation

@julianoes

@julianoes julianoes commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Backports ~35 bugfixes from main to v3 ahead of the next v3 patch release.

Since main diverged from v3 (moved to cpp/src/, migrated core to asio, renamed headers to .hpp, switched to fmt-style logging), none of these cherry-picked mechanically — each was semantically ported to v3's layout (src/, .h headers, threadpool/_work_queue, LogWarn() << logging) and verified. asio-contract-only fixes were excluded because the underlying bug doesn't exist in v3's model.

Builds clean; 290 unit tests + 83 system tests pass.

Fixes by area

FTP client/server

Parsing / safety

Request-message / mission / libmav

  • fix wrong-request matching in MavlinkRequestMessage::handle_any_message
  • fix callback deletion race on rapid requests (core: fix deleting of callback on rapid requests of messages #2894); cancel pending timeouts in destructor
  • lock _system_ids on the libmav receive path; ignore duplicate/out-of-order mission items
  • reindex non-extended parameter view; enlarge libmav accumulation buffer

Parameter server

Core races

  • fix erase-remove UB in unregister_statustext_handler; synchronize statustext/param-changed handler lists
  • guard _configuration with a dedicated mutex; capture watchdog fields by value

Plugins

Deliberately not backported

Commits are grouped by area rather than one-per-PR; happy to reshape if preferred.

CI

Backports the following fixes from main to v3:
- 10c1196 core: fix out-of-bounds read in MavlinkFtpServer::_data_as_string
- 93a625b core: check ofstream (not ifstream) after seekp in FTP _work_write
- 9235e52 core: fix FTP server deadlock joining burst thread while holding _mutex
- 48b4987 core: make FTP server target ids atomic
- cbac9c0 core: reject FTP burst offset past file size to avoid huge allocation
- a565b66 fix: reject FTP responses with unexpected seq_number (#2850)
Backports the following fixes from main to v3:
- bd632eb core: fix UAF when unregister_all_blocking misses _register_later_table (#2876)
- 4fea94b core: avoid std::stoi terminate() when parsing metadata uri component id
- 5c5eea8 core: check fopen result before using it in download_file_to_path
- 1bfd363 core: fix out-of-bounds read on non-terminated PARAM_EXT_SET custom value
- 2e1c78c core: guard against NULL getpwuid() in get_cache_directory
- c97fa91 fix to properly remove the trailing null byte (#2899)
- 46b3c9a core: reject trailing garbage when parsing port and baudrate
- 6d68e3d core: check inet_ntop result in resolve_hostname_to_ip
Backports the following fixes from main to v3:
- 62c60ac core: fix message matching in MavlinkRequestMessage::handle_any_message
- 020777a core: fix deleting of callback on rapid requests of messages (#2894)
- c863cdf core: cancel pending timeouts in MavlinkRequestMessage destructor
- 89e663d core: lock _system_ids when inserting from the libmav receive path
- fa747afe core: ignore duplicate/out-of-order mission items on the server
- 8737229 core: reindex non-extended parameter view contiguously
- 21cba79 core: enlarge libmav accumulation buffer to avoid dropping messages
Backports the following fixes from main to v3:
- 845f382 core: send PARAM_ERROR for missing/wrong-type non-extended PARAM_SET
- dfac8d4 param_server: allow updating an already-provided param after lockdown (#2916)
- 673cecd core: notify param value changes on every used protocol (#2915)
- 3e70e89 core: don't invoke param subscription callbacks under _all_params_mutex

Note: main uses asio::post to defer the value-change broadcast/callbacks; on v3
this is re-expressed with the existing _work_queue and by invoking subscription
callbacks after releasing _all_params_mutex.
Backports the following fixes from main to v3:
- cffa8f6 core: fix erase-remove idiom in unregister_statustext_handler
- 67d4631 core: synchronize statustext and param-changed handler lists
- 6c643aa core: guard MavsdkImpl::_configuration with a dedicated mutex
- 79534d2 core: capture callback watchdog fields by value to avoid data race

Note: main's asio-executor confinement does not apply to v3; the underlying
races are fixed here with dedicated std::mutex members instead.
Backports the following fixes from main to v3:
- 546cd8e camera_server: fix deadlock between send_capture_status and send_tracking_status_with_interval (#2893)
- c371785 Join sending_tracking_status thread before destruction (#2912)
- 35686f1 mavlink_direct: fix setting target_component (#2919)
- 1155116 fix: clear MavlinkDirect callbacks on deinit to avoid teardown race (#2869)
- fd43ce5 log_streaming: fix backend teardown race
- 85e7dc6 fix(mavlink_passthrough): export operator<< for Result with MAVSDK_PUBLIC (#2881)
Backport of ca430cc (#2900). The windows-2025 runner image migrated
from VS 2022 (VS 17) to VS 2026 (VS 18) in June 2026; update all cmake
generator strings accordingly.
Backport of dfc69b5 (#2927).

process_heartbeat() stops setpoint streaming when the vehicle is not in
offboard mode more than 3 seconds after the grace start. That timestamp
was only written in start(), so before the first start() it was still
epoch 0 and the guard always passed: any heartbeat between the first
set_*() and start() reset the setpoint state, and start() then failed
with NoSetpointSet. Frequent under lockstep SITL with a speed factor.

Stamp the grace start whenever streaming transitions out of NotActive so
the watchdog covers the gap between the first setpoint and start().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant