Skip to content

Commit cff0526

Browse files
authored
Merge pull request #8072 from chaen/v8.0_fix_xrootSetRlimit2
[8.0] fix (gfal): smarter setrlimit
2 parents 9872ba6 + be2e49f commit cff0526

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/DIRAC/Resources/Storage/GFAL2_StorageBase.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,11 @@ def __init__(self, storageName: str, parameters: dict[str, str]):
143143
# Workaround for https://github.com/xrootd/xrootd/issues/2396
144144
# xrootd internaly sets nproc, so we save the limit and reset it
145145
# just after creating the context
146-
saved_limits = getrlimit(RLIMIT_NPROC)
146+
saved_limit = getrlimit(RLIMIT_NPROC)
147147
self.ctx = gfal2.creat_context()
148-
setrlimit(RLIMIT_NPROC, saved_limits)
148+
new_limit = getrlimit(RLIMIT_NPROC)
149+
if saved_limit != new_limit:
150+
setrlimit(RLIMIT_NPROC, saved_limit)
149151

150152
# by default turn off BDII checks
151153
self.ctx.set_opt_boolean("BDII", "ENABLE", False)

0 commit comments

Comments
 (0)