Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit988ee39

Browse files
authored
test: stop running Test_sshConfigProxyCommandEscape in parallel (#20009)
Fixescoder/internal#1035Or, at least, closes a remaining race that seems pretty likely.The tests in question write a file, close the file, then execute the file. Sometimes Linux errors saying "text file busy" which means the file is still open for writing.What I think is going on is:1. Test_sshConfigProxyCommandEscape goroutine opens the file and begins writing.2. Some other, unrelated test execs a command, which causes a `fork()` syscall. The child process now has a copy of the file descriptor to our open file.3. Test_sshConfigProxyCommandEscape goroutine executes the file and gets "text file busy".4. The child process calls the `exec` syscall, which closes the file (due to `CLOEXEC` being set).The race is very tight because 3 has to happen before 4 (and, 3 involves it's own fork/exec), but it's not impossible on a busy system.c.f.#14233 which was an earlier attempt to fix this. It only prevented the subtests from running in parallel. When the subtests were all running in parallel, the flake was fairly likely because you've got all this fork() activity happening at the same time. But, since the main test was in parallel there is still a chance a totally different test is `fork`'ing at in inopportune time.
1 parente878281 commit988ee39

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

‎cli/configssh_internal_test.go‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,13 @@ func Test_sshConfigSplitOnCoderSection(t *testing.T) {
135135
}
136136
}
137137

138-
// This test tries to mimic the behavior of OpenSSH
139-
// when executing e.g. a ProxyCommand.
140-
// nolint:tparallel
138+
// This test tries to mimic the behavior of OpenSSH when executing e.g. a ProxyCommand.
139+
// nolint:paralleltest
141140
funcTest_sshConfigProxyCommandEscape(t*testing.T) {
142-
t.Parallel()
141+
// Don't run this test, or any of its subtests in parallel. The test works by writing a file and then immediately
142+
// executing it. Other tests might also exec a subprocess, and if they do in parallel, there is a small race
143+
// condition where our file is open when they fork, and remains open while we attempt to execute it, causing
144+
// a "text file busy" error.
143145

144146
tests:= []struct {
145147
namestring

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp