Skip to content

Commit b6e7498

Browse files
authored
fix(agent/reconnectingpty): generate rpty id before starting lifecycle (#15475)
Fixes #12687 There was a race condition where we would start the rpty lifecycle before generating the ID, leading to a data race where we would try to concurrently read and write the struct field.
1 parent bc9d875 commit b6e7498

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

agent/reconnectingpty/screen.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ func newScreen(ctx context.Context, cmd *pty.Cmd, options *Options, logger slog.
6767
timeout: options.Timeout,
6868
}
6969

70-
go rpty.lifecycle(ctx, logger)
71-
7270
// Socket paths are limited to around 100 characters on Linux and macOS which
7371
// depending on the temporary directory can be a problem. To give more leeway
7472
// use a short ID.
@@ -80,6 +78,8 @@ func newScreen(ctx context.Context, cmd *pty.Cmd, options *Options, logger slog.
8078
}
8179
rpty.id = hex.EncodeToString(buf)
8280

81+
go rpty.lifecycle(ctx, logger)
82+
8383
settings := []string{
8484
// Disable the startup message that appears for five seconds.
8585
"startup_message off",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy