coder / coder/websocket

Add protection against concurrent Readers

Open
#391 20 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
5.5k
Forks
372
PR merge metrics
No merged PRs in 30d

Description

During my use of the library(server and client both v1.8.7), the server occasionally receives the following prompt,

```
failed to get reader: received header with unexpected rsv bits set: false:true:true
```

which seems to be related to this part of the code.

**write.go** L300:

```
c.writeHeader.rsv1 = false
if flate && (opcode == opText || opcode == opBinary) {
c.writeHeader.rsv1 = true
}
```

Could you please confirm if it is necessary to add the following code here?

```
c.writeHeader.rsv1 = false
c.writeHeader.rsv2 = false
c.writeHeader.rsv3 = false
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in write.go around line 300 and trace how writeHeader.rsv1, rsv2, and rsv3 are set while concurrent readers or writers are active. Use the reported unexpected RSV-bits error as the failure signal. Done means the concurrent-reader scenario no longer produces invalid RSV bits, with a regression test covering the behavior if the repository has an appropriate test entry point.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.