Using LVM snapshots results in extra output #1068
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#1068
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
I am running with LVM snapshots enabled and am seeing quite a few messages about leaked file descriptors, for instance:
This would be fixed if
execute_command_and_capture_outputwould setclose_fds=Truewhich it cannot due to the command saying:So one option would be to allow the caller to pass through
close_fds, I don't think credentials are needed for lvm commands or accept the leak and passLVM_SUPPRESS_FD_WARNINGS=1as env. Another option would be to figure out what those file descriptors are and manually set close_on_exec on them (if that is possible).What would you prefer?
Steps to reproduce
No response
Actual behavior
No response
Expected behavior
No response
Other notes / implementation ideas
No response
borgmatic version
No response
borgmatic installation method
No response
Borg version
No response
Python version
No response
Database version (if applicable)
No response
Operating system and version
No response
Ah yes, I took the lazy approach with
close_fds=False, and I guess this is the consequence. You are correct that the LVM hook doesn't need/use credentials. Probably adding aclose_fdsargument (defaulting toTrue) to the variousexecute_*functions makes the most sense. And then passingclose_fds=Falsefrom any callers that make use of this functionality. Off the top of my head, that's at least:mariadb.py,mysql.py, andmongodb.pyinhooks/data_source/and alsoborg/environment.py.The latter is probably the reason I made the lazy choice here;
make_environment()is responsible for setting the credential, but it's called by pretty much everything inborg/*.pyand alsoactions/check.py, soexecute_*function calls in those files would have to be updated.Let me know if this is something you're interested in taking on or if instead you're running screaming once you see the scope. 😄
(I'd also be fine with an even more surgical solution that only passes the file descriptors used. That seems like even more work though.)
Sorry for the late response, apparently I did not get an email notification :/
I'll try to take a look at the surgical solution, might need some time though since I will be at DjangoCon Europe next week…
Okay, no worries. Enjoy the convention! And let me know if it turns out you can't get to this. Thanks!
I have added a simple PR to borgmatic-collective/borgmatic#1074 -- worked fine locally. This approach is the "safe" approach, it is really hard to determine if and when file descriptors get passed in, so before breaking something I opted least invasive patch. If over time all calls get converted to
close_fds=Trueorpass_fdsgets added to the other calls, then we could flip the default at some point.While playing with my backup I ran into borgmatic-collective/borgmatic#1074 where I am not sure how to fix yet ;)
Thanks so much for doing this!
Released in borgmatic 2.0.6!