Credit a restored control function for the address claim that restored it - #17
Draft
Arjan-Woltjer wants to merge 4 commits into
Draft
Credit a restored control function for the address claim that restored it#17Arjan-Woltjer wants to merge 4 commits into
Arjan-Woltjer wants to merge 4 commits into
Conversation
Updated AgIsoStack to 29dab887a48bb204aae983b06052d52b0f2314d5
Added a basic example showing how to receive machine speed messages.
…d it update_address_table()'s restore branch puts a previously-pruned control function back into controlFunctionTable because it has just announced its address, but never sets claimedAddressSinceLastAddressClaimRequest on it. The CF therefore re-enters the table already eligible for pruning, and is evicted again on the very next address-claim roll-call. That turns a single eviction into a self-sustaining cycle. Observed on real hardware (Teensy 4.1, Ag Leader InCommand 1200 as VT/TC on a New Holland tractor) as unbroken "is now offline" -> "has claimed address" -> "is now offline" churn every 1-2 seconds, running for 300+ seconds, on a bus issuing roll-calls roughly every 3 seconds. While that cycle runs, the CF's table entry is repeatedly nulled, so get_source_control_function() stops resolving for its address and process_can_message_for_global_and_partner_callbacks() silently drops broadcasts from it -- taking the VT and TC clients down with it while the device is still transmitting normally. The flag is true by definition at this point: the only way to reach this branch is by processing that CF's own Address Claim message, which is exactly what the flag records. Mirrors Open-Agriculture/AgIsoStack-plus-plus#718, which applies the same fix to the equivalent (since-refactored) code on that repo's main branch. See Open-Agriculture/AgIsoStack-plus-plus#717 for the full analysis.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mirror of AgIsoStack-plus-plus#718 for this fork. Same one-line fix; the surrounding code differs because that repo's
mainhas since refactored this function, so the change is ported rather than cherry-picked.The bug
update_address_table()'s restore branch returns a previously-pruned control function tocontrolFunctionTablebecause it has just announced its address — but never setsclaimedAddressSinceLastAddressClaimRequeston it. The CF therefore re-enters the table already eligible for pruning, andprune_inactive_control_functions()evicts it again on the very next roll-call.The flag is true by definition at that point: the only way to reach this branch is by processing that control function's own Address Claim message, which is exactly what the flag records. The sibling branch immediately above does precisely this for a CF already in the table.
Why it matters
It converts a single eviction into a self-sustaining cycle. While that cycle runs, the CF's table entry is repeatedly nulled, so
message.get_source_control_function()stops resolving for its address andprocess_can_message_for_global_and_partner_callbacks()silently drops every broadcast from it — a client bound to that CF goes deaf while the device is still transmitting normally.Found on real hardware: Teensy 4.1 running this fork at 0.1.5, Ag Leader InCommand 1200 acting as VT and TC on a New Holland tractor with the usual ECU population. Observed as unbroken
is now offline→has claimed address→is now offlinechurn every 1–2 seconds, sustained for 300+ seconds, on a bus issuing address-claim roll-calls roughly every 3 seconds.Full analysis and field evidence: AgIsoStack-plus-plus#717.
Notes
teensy41cross-compile in the downstream project that found it. Not separately field-verified in isolation, because with our other local workaround in place it is a no-op for our own partners by construction — it matters for every other CF on the bus, and for anyone who doesn't carry that workaround.🤖 Generated with Claude Code