Repository navigation
Discard blank transaction placeholders on recovery - #459
Open
huangkongsheng wants to merge 1 commit into
Open
huangkongsheng wants to merge 1 commit into
huangkongsheng wants to merge 1 commit into
Conversation
createTransaction() commits the empty tx object to flash before the caller fills it in. A device reset in that window leaves a tx file whose start/stop opNrs are still 0 and whose idTag is empty; on the next boot it loads back as active-but-never-started and blocks the connector forever (matth-x#455). allocateTransaction()'s cleanup now also treats such blank entries as dangling. A real tx that was authorized before the reset has an idTag and is unaffected.
This branch has not been deployed
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.
Fixes #455
createTransaction()commits the empty tx object to flash before the caller fills it in (idTag, start opNr). A device reset in that window leaves a tx file like the one in the issue: start/stop opNrs are 0, the idTag is empty, and on the next boot it loads back as active-but-never-started, permanently blocking the connector.allocateTransaction()already cleans dangling silent and aborted txs before allocating a new one - this extends that check with blank entries: a tx whose start opNr is 0 and whose idTag is empty was never populated, so it gets removed like the other dangling records.A real tx that was authorized before the reset has an idTag and is kept, so the normal recovery path is unchanged. The change is 1 condition in the existing cleanup loop; CI (platformio tests, incl. ChargingSessions) verifies it.