spot checking crashes borgmatic: OSError: [Errno 90] Message too long #1089
Labels
No labels
blocked
breaking
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
borgmatic-collective/borgmatic#1089
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What I'm trying to do and why
Running spot checking on one specific server which has several directories with a lot of files (100 000 files).
Steps to reproduce
No response
Actual behavior
Expected behavior
No response
Other notes / implementation ideas
Configuration of spot check:
The system on which this happens, has several directories with a very large amount of files (around 100000 files in one directory are possible). This does not happen on systems which don't have such large amount of files.
borgmatic version
1.9.14
borgmatic installation method
Rebuilt Debian Trxie (testing) package on Debian 12 Bookworm
Borg version
1.2.4
Python version
3.11.2
Database version (if applicable)
No response
Operating system and version
Debian 12 Bookworm
Thanks for filing this. The interesting thing is that the spot check code already batches calls to the
xxh64sumcommand, feeding it no more than 10,000 files per call even if you've got hundreds of thousands. But it looks like thatxxh64sumcommand is for some reason erroring anyway, and then the logging of that error blows up as well, because the log line is too big for your logging backend. (The logging of commands is already truncated to deal with exactly this sort of thing, but that doesn't help with traceback messages.)So the question is why
xxh64sumis failing. One idea is to try editing borgmatic's hard-coded number of files passed toxxh64sumper call. If you're game to try changing that in the source code, you'd do that by opening/usr/lib/python3/dist-packages/borgmatic/actions/check.pyas root and changingSAMPLE_PATHS_SUBSET_COUNTto a lower number like1000or even100.If that "fixes" the problem, then that indicates that borgmatic was giving too many files to
xxh64sum, perhaps too many for whatever shell you're using. (Incidentally, what shell are you using?) If that doesn't fix the problem, then that indicates there's some other reason whyxxh64sumis failing. In which case you could try copy and pasting the loggedxxh64sumcommand and running it to see if you can reproduce the problem outside of borgmatic and produce a more useful error message. But that might not even be necessary, because with a lower number of files passed to the command, logging may be able to display the full error without itself erroring.I suspect we are hitting one of these limits:
Many of the files have a path length between 100 to 200 characters.
I'm using bash.
I'll try lowering SAMPLE_PATHS_SUBSET_COUNT
Yeah, good insight there about those limits. Let me know what you find!
Tried to reproduce it by running
# systemd-run -p LoadCredentialEncrypted=borgmatic:/etc/credstore.encrypted/borgmatic/ borgmatic check -v 2 --only spot --progress --repo backup --forceBut after 24 hours it's still running and no errors. Maybe it requires a lucky combination of long paths to trigger.
I think I will just disable spot checking, as I'm not sure this is really useful on this system with such a large amount of files, where only a very tiny part of files could be checked if I don't want this to take so much time.
Thanks for trying to repro this. But yeah, spot checks are probabilistic by their nature, so one might need to run it several times to trigger the "lucky" combination of long paths—or simply raise
SAMPLE_PATHS_SUBSET_COUNTto an ungodly number. I can understand though if you don't want to bother with the spot check on that system.I'll still leave this ticket open though to see if I can come up with a repro here; if possible, I'd like the spot check to be more reliable rather than less... It's conceivable that lowering
SAMPLE_PATHS_SUBSET_COUNTcould "solve" the issue on most systems. I might even be able to catch the error and display a helpful error message.Welp, I can't seem to repro this on my system, even with a million files in a directory,
SAMPLE_PATHS_SUBSET_COUNTraised by a couple orders of magnitude, and thexxh64sumcommand deliberately failing. So what I'll do is just arbitrarily lowerSAMPLE_PATHS_SUBSET_COUNTby half and hope for the best. I'd be happy to revisit though if anyone has more repro info.Released in borgmatic 2.0.6!