Skip to content

lib/db: Don't ignore failures unmarshaling version lists - #6411

Merged
calmh merged 2 commits into
syncthing:masterfrom
imsodin:db/noIgnoreFVFail
Mar 16, 2020
Merged

calmh merged 2 commits into
syncthing:masterfrom
imsodin:db/noIgnoreFVFail

Conversation

@imsodin

@imsodin imsodin commented Mar 15, 2020

Copy link
Copy Markdown
Member

Doing other db work I noticed that VersionList is the only type where unmarshalling errors and invalid contents (empty) is just accepted and not acted on (neither fixed nor an error returned). For anything else, we just return the error. Looking at the history I don't see anything that justifies a special treatment for VersionList. Checkglobal now deletes invalid global entries and everywhere else they are just unmarshalled and an error is returned if invalid.

@calmh

calmh commented Mar 16, 2020

Copy link
Copy Markdown
Member

There's a subtle difference in that before in these places we skipped/continued for empty version lists, whereas now we just continue processing. I didn't look to see if the behavior is the same (I guess we'll typically loop over the versions, which is still a no-op), and I guess we generally shouldn't have any empty version lists either...

@calmh

calmh commented Mar 16, 2020

Copy link
Copy Markdown
Member

Right, it'll panic here and there if there are empty lists. Which there shouldn't be. But then we'll see it in sentry. So, Ok, I guess.

* master:
  lib/db: Use need func in withNeed and simplify (syncthing#6412)
  cmd/syncthing: Do auto-upgrade before startup (fixes syncthing#6384) (syncthing#6385)
@imsodin

imsodin commented Mar 16, 2020

Copy link
Copy Markdown
Member Author

Right, it'll panic here and there if there are empty lists. Which there shouldn't be. But then we'll see it in sentry. So, Ok, I guess.

Sorry, should have made that explicit: It does panic and I considered that ok, because it must never happen and if it does, it will have other consequences (db inconsistencies) and I'd rather know about them to have a chance of fixing it. Maybe it would be cleaner to check for empty version lists and return an error, instead of panicking due to an index out of range (the end result will still be a panic).

@calmh
calmh merged commit 1bd4ea0 into syncthing:master Mar 16, 2020
@imsodin
imsodin deleted the db/noIgnoreFVFail branch March 16, 2020 09:20
calmh added a commit to calmh/syncthing that referenced this pull request Mar 17, 2020
* master:
  lib/protocol: Zero pad index ID strings
  lib/db: Don't ignore failures unmarshaling version lists (syncthing#6411)
  lib/db: Use need func in withNeed and simplify (syncthing#6412)
  cmd/syncthing: Do auto-upgrade before startup (fixes syncthing#6384) (syncthing#6385)
  lib/db: Extend set test with second remote (syncthing#6402)
  gui, man, authors: Update docs, translations, and contributors
  lib/protocol: Use BlocksHash to compare block lists when available (syncthing#6401)
  lib/api: Ignore that one file that always shows up in git status
@calmh calmh added this to the v1.4.1 milestone Mar 18, 2020
@st-review st-review added the frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion label Mar 17, 2021
@syncthing syncthing locked and limited conversation to collaborators Mar 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants