Skip to content

flake: TestLogout/NoURLFile #257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ethanndickson opened this issue Dec 17, 2024 · 4 comments
Open

flake: TestLogout/NoURLFile #257

ethanndickson opened this issue Dec 17, 2024 · 4 comments
Assignees
Labels

Comments

@ethanndickson
Copy link
Member

https://github.com/coder/coder/actions/runs/12365872187/job/34511667687

=== FAIL: cli TestLogout/NoURLFile (0.01s)
    logout_test.go:76: 
        	Error Trace:	C:/a/coder/coder/pty/ptytest/ptytest.go:31
        	            				C:/a/coder/coder/cli/logout_test.go:76
        	Error:      	Received unexpected error:
        	            	create pseudo console (-2147024890):
        	            	    github.com/coder/coder/v2/pty.newPty
        	            	        C:/a/coder/coder/pty/pty_windows.go:72
        	            	  - The operation completed successfully.
        	Test:       	TestLogout/NoURLFile
    --- FAIL: TestLogout/NoURLFile (0.01s)

Spotted on Windows Postgres tests.
Might be due to Windows os.Remove returning earlier than it should?

@ethanndickson
Copy link
Member Author

Feel free to reassign, though I assume you have experience debugging Windows specific test flakes.

@hugodutka
Copy link

@ethanndickson I don't have much experience with Windows-specific flakes unfortunately. The work I did to make the Windows test suite pass with Postgres was just improving Postgres performance in our CI so that test timings would be more similar to what we get on Linux.

Converting the error code -2147024890 to hex gives 0x80070006, which stands for E_HANDLE - Handle that is not valid (error code table at the bottom of the page). Not sure if it refers to the input/output handles passed to the create pseudo console call or something else. os.Pipe has a suspicious-looking docstring that "The Windows handles underlying the returned files are marked as inheritable by child processes." Assigning this to @mafredri as he last modified this code - maybe you have an idea what might be causing this flake?

@mafredri
Copy link
Member

mafredri commented Jan 10, 2025

Unless this is a repeating issue, I don't think it's worth investing in a fix. I don't know enough about Windows to even have an idea of what causes failures to create pseudo consoles 😅.

@spikecurtis as you've also worked with the Windows pty implementation, do you have any ideas?

os.Pipe has a suspicious-looking docstring that "The Windows handles underlying the returned files are marked as inheritable by child processes."

Good eye @hugodutka, I'd say this is a trait we want as usually the pty package is used to spawn a new command. However, whether or not it could wreak havoc as used in the test suite is something I'm not sure of.

Here's my speculative list of causes (everything may be false and incorrect):

  • Too many pseudo consoles created (like Unix open files limits)?
  • Two pseudo consoles created at the exact same time (parallelism) by the same process, maybe Windows doesn't like that?

Things we can try if this issue repeats:

  • Reduce test parallelism on Windows
  • Modify pty package to retry CreatePseudoConsole if it fails (this might be a bad idea though)

@hugodutka
Copy link

@mafredri had the same idea to reduce test parallelism in coder/coder#16090 - it seems to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants