Skip to content

Commit 8bd43f1

Browse files
chaenweb-flow
authored andcommitted
sweep: DIRACGrid#8072 fix (gfal): smarter setrlimit
1 parent beafcc5 commit 8bd43f1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/DIRAC/Resources/Storage/GFAL2_StorageBase.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,11 @@ def __init__(self, storageName: str, parameters: dict[str, str]):
142142
# Workaround for https://github.com/xrootd/xrootd/issues/2396
143143
# xrootd internaly sets nproc, so we save the limit and reset it
144144
# just after creating the context
145-
saved_limits = getrlimit(RLIMIT_NPROC)
145+
saved_limit = getrlimit(RLIMIT_NPROC)
146146
self.ctx = gfal2.creat_context()
147-
setrlimit(RLIMIT_NPROC, saved_limits)
147+
new_limit = getrlimit(RLIMIT_NPROC)
148+
if saved_limit != new_limit:
149+
setrlimit(RLIMIT_NPROC, saved_limit)
148150

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

0 commit comments

Comments
 (0)