Closed bobgromozeka closed 22 hours ago
Describe the bug We are using sqlc and pgx as it's driver (pgxpool). This is fatal error that we get sometimes
| fatal error: concurrent map read and map write | goroutine 16295435 [running]: | github.com/jackc/pgx/v5/internal/stmtcache.(*LRUCache).Invalidate(0xc0015beed0, {0x1649030, 0x1e2}) | /go/pkg/mod/github.com/jackc/pgx/v5@v5.7.1/internal/stmtcache/lru_cache.go:65 +0x3a | github.com/jackc/pgx/v5.(*baseRows).Close(0xc000c20000) | /go/pkg/mod/github.com/jackc/pgx/v5@v5.7.1/rows.go:177 +0xf9 | github.com/jackc/pgx/v5.(*baseRows).Next(0xc000c20000) | /go/pkg/mod/github.com/jackc/pgx/v5@v5.7.1/rows.go:221 +0x85
To Reproduce
rows, err := q.db.Query(ctx, "select * from ......", arg.FarmID, arg.Search) if err != nil { return nil, err } defer rows.Close() items := []*FindClientsAndUsersRow{} for rows.Next() { var i FindClientsAndUsersRow if err := rows.Scan( &i.ID, &i.Name, &i.Email, &i.Type, ); err != nil { return nil, err } items = append(items, &i) }
Expected behavior No fatal error.
Actual behavior Concurrent map read and write
Version
Looks like the problem was caused by using one transaction in different goroutines. Our bad, closing this issue.
Describe the bug We are using sqlc and pgx as it's driver (pgxpool). This is fatal error that we get sometimes
To Reproduce
Expected behavior No fatal error.
Actual behavior Concurrent map read and write
Version