Skip to content

fix: catch missed output with reconnecting PTY#9094

Merged
code-asher merged 1 commit into
mainfrom
asher/pty-flake
Aug 14, 2023
Merged

fix: catch missed output with reconnecting PTY#9094
code-asher merged 1 commit into
mainfrom
asher/pty-flake

Conversation

@code-asher

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

Copy link
Copy Markdown
Member

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.

@cdr-bot cdr-bot Bot left a comment

Copy link
Copy Markdown

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