Skip to content

fix: serialize Pty() copy with window-change updates - #266

Open
vulragrag-star wants to merge 1 commit into
gliderlabs:masterfrom
vulragrag-star:fix/265-pty-window-race
Open

vulragrag-star wants to merge 1 commit into
gliderlabs:masterfrom
vulragrag-star:fix/265-pty-window-race

Conversation

@vulragrag-star

Copy link
Copy Markdown

Fixes #265

Session.Pty() copied *sess.pty while the request loop updated Window on window-change with no lock, so a concurrent resize could tear Width/Height.

Hold the existing session mutex around the Pty() snapshot, pty-req setup, and window-change mutation; send on winch after unlocking so the handler cannot deadlock. Adds TestPtyWindowChangeDataRace (run under -race).

Pty() copied *sess.pty while the request loop wrote Window on
window-change with no lock, so a resize could tear Width/Height.
Use the existing session mutex for Pty(), pty-req, and window-change,
and send on winch after unlocking.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Data race between Session.Pty() and window-change handling

1 participant