Close file descriptors after process exit#5983
Merged
christian-monch merged 1 commit intodatalad:maintfrom Sep 16, 2021
Merged
Conversation
Even a `datalad --version` leave open file descriptors around. This change closes all FDs after a process has exited and any protocol-based post-processing has completed. I am not at all confident that this should be done unconditionally, though.
Member
|
oh, is that the fix for #5965 ? ! |
Codecov Report
@@ Coverage Diff @@
## maint #5983 +/- ##
==========================================
- Coverage 90.32% 90.23% -0.09%
==========================================
Files 308 308
Lines 42111 42114 +3
==========================================
- Hits 38035 38001 -34
- Misses 4076 4113 +37
Continue to review full report at Codecov.
|
Member
Author
|
That would fit the description, yes. |
Member
confirming -- it does! Thank you again! will add close statement(git)lena:~datalad/datalad-maint[maint]git
$> datalad --version
datalad 0.15.0+2.g1e0f732c1
(dev3) 1 15305.....................................:Wed 15 Sep 2021 11:45:05 AM EDT:.
(git)lena:~datalad/datalad-maint[maint]git
$> DATALAD_LOG_LEVEL=1 python -Werror -c 'import datalad.version as m;print(m.__version__)'
[Level 5] Instantiating ssh manager
[Level 5] Done importing main __init__
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/yoh/proj/datalad/datalad-maint/datalad/version.py", line 17, in <module>
warnings.warn(
DeprecationWarning: datalad.version module will be removed in 0.16. Please use datalad.__version__ (no other __*_version__ variables are to be provided).
[Level 5] Exiting
Exception ignored in: <_io.FileIO name=3 mode='rb' closefd=True>
ResourceWarning: unclosed file <_io.FileIO name=3 mode='rb' closefd=True>
Exception ignored in: <_io.FileIO name=5 mode='rb' closefd=True>
ResourceWarning: unclosed file <_io.FileIO name=5 mode='rb' closefd=True>
(dev3) 1 15306 ->1.....................................:Wed 15 Sep 2021 11:45:26 AM EDT:.
(git)lena:~datalad/datalad-maint[maint]git
$> git fetch gh-mih
From https://github.com/hanke/datalad
* [new branch] bf-closefd -> gh-mih/bf-closefd
ff6f7eacc..5178ae629 maint -> gh-mih/maint
* [new branch] nf-gogs -> gh-mih/nf-gogs
* [new branch] rf-pbsrunner -> gh-mih/rf-pbsrunner
(dev3) 1 15307.....................................:Wed 15 Sep 2021 11:45:33 AM EDT:.
(git)lena:~datalad/datalad-maint[maint]git
$> git co bf-closefd
Branch 'bf-closefd' set up to track remote branch 'bf-closefd' from 'gh-mih'.
Switched to a new branch 'bf-closefd'
(dev3) 1 15308.....................................:Wed 15 Sep 2021 11:45:40 AM EDT:.
(git)lena:~datalad/datalad-maint[bf-closefd]git
$> DATALAD_LOG_LEVEL=1 python -Werror -c 'import datalad.version as m;print(m.__version__)'
[Level 5] Instantiating ssh manager
[Level 5] Done importing main __init__
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/yoh/proj/datalad/datalad-maint/datalad/version.py", line 17, in <module>
warnings.warn(
DeprecationWarning: datalad.version module will be removed in 0.16. Please use datalad.__version__ (no other __*_version__ variables are to be provided).
[Level 5] Exiting
(dev3) 1 15309 ->1.....................................:Wed 15 Sep 2021 11:45:42 AM EDT:.
(git)lena:~datalad/datalad-maint[bf-closefd]git
$> DATALAD_LOG_LEVEL=1 python -Werror -c 'import datalad as m;print(m.__version__)'
[Level 5] Instantiating ssh manager
[Level 5] Done importing main __init__
0.15.0+3.g7346365ce
[Level 5] Exiting
|
yarikoptic
approved these changes
Sep 15, 2021
Member
yarikoptic
left a comment
There was a problem hiding this comment.
CI is green, I am happy ;) Thank you @mih ! Let's wait for verdict by @christian-monch
Contributor
|
Looks good. I think the files can be closed unconditionally in this case. |
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.
Even a
datalad --versionleave open file descriptors around. Thischange closes all FDs after a process has exited and any
protocol-based post-processing has completed.
I am not at all confident that this should be done unconditionally,
though.
Run
PYTHONDEVMODE=1 datalad --versionto see the pre/post effect.Closes #5965