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

fix: columns map to prevent concurrent write and read #1327

Merged
merged 1 commit into from
Nov 21, 2023

Conversation

Maxibond
Copy link
Contributor

Sometimes running a code generation, I receive an error caused by concurrent read and map writes to the columns map.
Sync.Map will prevent it.

sqlboiler -c ./sqlboiler.toml psql

fatal error: concurrent map read and map write



goroutine 22 [running]:

github.com/volatiletech/sqlboiler/v4/drivers/sqlboiler-psql/driver.(*PostgresDriver).Columns(0xc000030540, {0x6ca5dc, 0x6}, {0xc0000a6140, 0xb}, {0x0, 0x0, 0x0}, {0xc000068df0, 0x1, ...})

	/go/pkg/mod/github.com/volatiletech/sqlboiler/v4@v4.12.0/drivers/sqlboiler-psql/driver/psql.go:610 +0x8a9

github.com/volatiletech/sqlboiler/v4/drivers.table({0x75de78, 0xc000030540}, {0x6ca5dc, 0x6}, {0xc0000a6140, 0xb}, {0x0, 0x0, _}, {0xc000068df0, ...})

	/go/pkg/mod/github.com/volatiletech/sqlboiler/v4@v4.12.0/drivers/interface.go:192 +0x128

github.com/volatiletech/sqlboiler/v4/drivers.tables.func1(0x4, {0xc0000a6140?, 0x0?})

	/go/pkg/mod/github.com/volatiletech/sqlboiler/v4@v4.12.0/drivers/interface.go:156 +0x1cf

created by github.com/volatiletech/sqlboiler/v4/drivers.tables

	/go/pkg/mod/github.com/volatiletech/sqlboiler/v4@v4.12.0/drivers/interface.go:153 +0x585



goroutine 1 [chan receive]:

github.com/volatiletech/sqlboiler/v4/drivers.concurrencyLimiter.get(...)

	/go/pkg/mod/github.com/volatiletech/sqlboiler/v4@v4.12.0/drivers/interface.go:388

github.com/volatiletech/sqlboiler/v4/drivers.tables({0x75de78, 0xc000030540}, {0x6ca5dc, 0x6}, {0x0?, 0x0, 0x0}, {0xc000068df0, 0x1, 0x1}, ...)

	/go/pkg/mod/github.com/volatiletech/sqlboiler/v4@v4.12.0/drivers/interface.go:152 +0x325

github.com/volatiletech/sqlboiler/v4/drivers.TablesConcurrently({0x75de78, 0xc000030540}, {0x6ca5dc, 0x6}, {0x0, 0x0, 0x0}, {0xc000068df0, 0x1, 0x1}, ...)

	/go/pkg/mod/github.com/volatiletech/sqlboiler/v4@v4.12.0/drivers/interface.go:119 +0x8e

github.com/volatiletech/sqlboiler/v4/drivers/sqlboiler-psql/driver.(*PostgresDriver).Assemble(0xc000030540, 0xcc?)

	/go/pkg/mod/github.com/volatiletech/sqlboiler/v4@v4.12.0/drivers/sqlboiler-psql/driver/psql.go:134 +0x83a

github.com/volatiletech/sqlboiler/v4/drivers.DriverMain({0x75d4f0, 0xc000030540})

	/go/pkg/mod/github.com/volatiletech/sqlboiler/v4@v4.12.0/drivers/driver_main.go:37 +0x496

main.main()

	/go/pkg/mod/github.com/volatiletech/sqlboiler/v4@v4.12.0/drivers/sqlboiler-psql/main.go:9 +0x34

@stephenafamo stephenafamo merged commit 73f2bf0 into volatiletech:master Nov 21, 2023
2 checks passed
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

Successfully merging this pull request may close these issues.

2 participants