Skip to content

fix: catch missed output with reconnecting PTY #9094

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

Merged
merged 1 commit into from
Aug 14, 2023
Merged

Conversation

code-asher
Copy link
Member

@code-asher code-asher commented Aug 14, 2023

This is currently failing the tests pretty reliably.

I forgot that waiting on the cond releases the lock so it was possible to get pty output after writing the buffer but before adding the pty to the map. To fix, add the pty to the map while under the same lock where we read from the buffer.

The rest does not need to be behind the lock so I moved it out of doAttach, and that also means we no longer need
waitForStateOrContextLocked.

Copy link

@cdr-bot cdr-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is a hotfix and has been automatically approved.

  • ✅ Base is main
  • ✅ Has hotfix label
  • ✅ Head is from coder/coder
  • ✅ Less than 100 lines

@code-asher code-asher changed the title fix: reconnecting PTY flake fix: missed output with reconnecting PTY Aug 14, 2023
@code-asher code-asher changed the title fix: missed output with reconnecting PTY fix: catch missed output with reconnecting PTY Aug 14, 2023
@code-asher code-asher force-pushed the asher/pty-flake branch 2 times, most recently from 16c9105 to b054a12 Compare August 14, 2023 22:34
I forgot that waiting on the cond releases the lock so it was possible
to get pty output after writing the buffer but before adding the pty to
the map.  To fix, add the pty to the map while under the same lock where
we write to the buffer.

The rest does not need to be behind the lock so I moved it out of
doAttach, and that also means we no longer need
waitForStateOrContextLocked.

Also, this can hit a logger error saying the attach failed which fails
the tests however it is not that the attach failed, just that the
process already ran and exited.  So if the process exits move to the
close phase *without* an error.
@code-asher code-asher merged commit a08f7b8 into main Aug 14, 2023
@code-asher code-asher deleted the asher/pty-flake branch August 14, 2023 23:54
@github-actions github-actions bot locked and limited conversation to collaborators Aug 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant