Skip to content

Discard blank transaction placeholders on recovery - #459

Open
huangkongsheng wants to merge 1 commit into
matth-x:mainfrom
huangkongsheng:fix/discard-blank-tx-placeholder
Open

huangkongsheng wants to merge 1 commit into
matth-x:mainfrom
huangkongsheng:fix/discard-blank-tx-placeholder

Conversation

@huangkongsheng

Copy link
Copy Markdown

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.

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

No deployments
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.

Interrupted transaction allocation leaves an unrecoverable placeholder Transaction on flash, permanently blocking the connector

1 participant