Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server.types field is not thread safe #78

Open
Satbek opened this issue Jan 14, 2025 · 0 comments
Open

Server.types field is not thread safe #78

Satbek opened this issue Jan 14, 2025 · 0 comments

Comments

@Satbek
Copy link

Satbek commented Jan 14, 2025

Description:

The Server.types field is not thread-safe. It is used within context.value:

This field can be accessed concurrently by multiple goroutines. For example:

I encountered a concurrent map writes runtime error when running the load tests:


Error Log:

fatal error: concurrent map writes
fatal error: concurrent map writes

goroutine 130 [running]:
github.com/jackc/pgx/v5/pgtype.(*Map).PlanEncode(0x1400029a3f0, 0x14, 0x0, {0x1032d2260, 0x10375d5e0})
    /Users/s.turganbayev/go/pkg/mod/github.com/jackc/pgx/v5@v5.4.3/pgtype/pgtype.go:1179 +0x78
github.com/jackc/pgx/v5/pgtype.(*Map).Encode(0x1400029a3f0, 0x14, 0x0, {0x1032d2260, 0x10375d5e0}, {0x1037a7320, 0x0, 0x0})
    /Users/s.turganbayev/go/pkg/mod/github.com/jackc/pgx/v5@v5.4.3/pgtype/pgtype.go:1901 +0x4c
github.com/jeroenrinzema/psql-wire.Column.Write({0x0, 0x0, 0x0, {0x140003a0060, 0x2}, 0x0, 0x14, 0x0, 0x0}, {0x1033ed0d0, ...}, ...)
    /Users/s.turganbayev/go/pkg/mod/github.com/jeroenrinzema/psql-wire@v0.12.1/row.go:161 +0xd4
github.com/jeroenrinzema/psql-wire.Columns.Write({0x14080974000, 0x3, 0x140003a00a0?}, {0x1033ed0d0, 0x1400041c460}, {0x0, 0x0, 0x4?}, 0x140003f8360, {0x1408096c750, ...})
    /Users/s.turganbayev/go/pkg/mod/github.com/jeroenrinzema/psql-wire@v0.12.1/row.go:92 +0x1c4
...
created by github.com/jeroenrinzema/psql-wire.(*Server).Serve in goroutine 1
    /Users/s.turganbayev/go/pkg/mod/github.com/jeroenrinzema/psql-wire@v0.12.1/wire.go:114 +0x184
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

No branches or pull requests

1 participant