Skip to content

Commit 07adcb3

Browse files
author
Alexey Izbyshev
committed
gh-102184: Test os.sync() only if "largefile" resource is enabled
Calling `os.sync()` when the Linux page cache is large and full of dirty pages and the storage device is slow can block the process in "uninterruptible sleep" state for minutes, making the test run unkillable even with SIGKILL. Avoid this by testing `os.sync()` only if "largefile" resource is enabled.
1 parent 5b9573e commit 07adcb3

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

Lib/test/test_posix.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,12 @@ def testNoArgFunctions(self):
6666
NO_ARG_FUNCTIONS = [ "ctermid", "getcwd", "getcwdb", "uname",
6767
"times", "getloadavg",
6868
"getegid", "geteuid", "getgid", "getgroups",
69-
"getpid", "getpgrp", "getppid", "getuid", "sync",
69+
"getpid", "getpgrp", "getppid", "getuid",
7070
]
71+
# gh-102184: Don't test sync() by default since it might cause heavy
72+
# I/O and block for a long time.
73+
if support.is_resource_enabled('largefile'):
74+
NO_ARG_FUNCTIONS.append("sync")
7175

7276
for name in NO_ARG_FUNCTIONS:
7377
posix_func = getattr(posix, name, None)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Test ``os.sync()`` only if "largefile" resource is enabled.

0 commit comments

Comments
 (0)