Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Data race onConn.closeErr #436

Closed
Closed
Milestone
@haha454

Description

@haha454

When I run my go program with race detector enabled, following logs were observed.

WARNING: DATA RACElocal-setup-websocket-api-1  | Write at 0x00c0002e31b0 by goroutine 129:local-setup-websocket-api-1  |   nhooyr.io/websocket.(*Conn).setCloseErrLocked()local-setup-websocket-api-1  |       /go/pkg/mod/nhooyr.io/websocket@v1.8.10/close.go:288 +0xd0local-setup-websocket-api-1  |   nhooyr.io/websocket.(*Conn).setCloseErr()local-setup-websocket-api-1  |       /go/pkg/mod/nhooyr.io/websocket@v1.8.10/close.go:282 +0x4clocal-setup-websocket-api-1  |   nhooyr.io/websocket.(*Conn).timeoutLoop()local-setup-websocket-api-1  |       /go/pkg/mod/nhooyr.io/websocket@v1.8.10/conn.go:190 +0x224local-setup-websocket-api-1  |   nhooyr.io/websocket.newConn.func2()local-setup-websocket-api-1  |       /go/pkg/mod/nhooyr.io/websocket@v1.8.10/conn.go:137 +0x80local-setup-websocket-api-1  |local-setup-websocket-api-1  | Previous read at 0x00c0002e31b0 by goroutine 165:local-setup-websocket-api-1  |   nhooyr.io/websocket.(*Conn).CloseNow()local-setup-websocket-api-1  |       /go/pkg/mod/nhooyr.io/websocket@v1.8.10/close.go:117 +0x138......

Apparently it's because when it's being set, it's protected byc.closeMu.
https://github.com/nhooyr/websocket/blob/e3a2d32f704fb06c439e56d2a85334de04b50d32/close.go#L288

However it's not when it's being read.
https://github.com/nhooyr/websocket/blob/e3a2d32f704fb06c439e56d2a85334de04b50d32/close.go#L117

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp