You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
supabase := supabase.CreateClient(SUPABASE_URL, SUPABASE_ANON_KEY)
for i := 0; i < status.Upload; i++ {
go ProcessUploadImage(i, doneChannel, deleteChannel, supabaseStorage)
}
`
Expected behavior
Either documentation to explain the problem or a change to include a mutex
Bug report
Describe the bug
Using one supabase client with multiple goroutines and multiple calls to
UploadOrUpdateFile()
might cause a race condition toMIMEHeader.Set()
To Reproduce
`
func ProcessUploadImage(){
c, d := storageClient.UploadFile("images", dbImage.externalPath, file, storage_go.FileOptions{
ContentType: &dbImage.format,
})
}
supabase := supabase.CreateClient(SUPABASE_URL, SUPABASE_ANON_KEY)
for i := 0; i < status.Upload; i++ {
go ProcessUploadImage(i, doneChannel, deleteChannel, supabaseStorage)
}
`
Expected behavior
Either documentation to explain the problem or a change to include a mutex
Stdout with -race flag
`
WARNING: DATA RACE
Write at 0x00c000038d20 by goroutine 35:
runtime.mapassign_faststr()
C:/Program Files/Go/src/runtime/map_faststr.go:203 +0x0
net/textproto.MIMEHeader.Set()
C:/Program Files/Go/src/net/textproto/header.go:22 +0x413
net/http.Header.Set()
C:/Program Files/Go/src/net/http/header.go:40 +0x375
github.com/supabase-community/storage-go.(*Client).UploadOrUpdateFile()
C:/Users/hawai/go/pkg/mod/github.com/supabase-community/storage-go@v0.7.0/storage.go:38 +0x309
github.com/supabase-community/storage-go.(*Client).UploadFile()
C:/Users/hawai/go/pkg/mod/github.com/supabase-community/storage-go@v0.7.0/storage.go:76 +0x39e
main.UploadImage()
C:/Users/hawai/OneDrive/Skrivbord/Projects/ULTRA/Veckans300/go/main.go:203 +0x2f2
main.ProcessUploadImage()
C:/Users/hawai/OneDrive/Skrivbord/Projects/ULTRA/Veckans300/go/main.go:227 +0xc4
main.main.func6()
C:/Users/hawai/OneDrive/Skrivbord/Projects/ULTRA/Veckans300/go/main.go:433 +0x5d
Previous write at 0x00c000038d20 by goroutine 36:
runtime.mapassign_faststr()
C:/Program Files/Go/src/runtime/map_faststr.go:203 +0x0
net/textproto.MIMEHeader.Set()
C:/Program Files/Go/src/net/textproto/header.go:22 +0x413
net/http.Header.Set()
C:/Program Files/Go/src/net/http/header.go:40 +0x375
github.com/supabase-community/storage-go.(*Client).UploadOrUpdateFile()
C:/Users/hawai/go/pkg/mod/github.com/supabase-community/storage-go@v0.7.0/storage.go:38 +0x309
github.com/supabase-community/storage-go.(*Client).UploadFile()
C:/Users/hawai/go/pkg/mod/github.com/supabase-community/storage-go@v0.7.0/storage.go:76 +0x39e
main.UploadImage()
C:/Users/hawai/OneDrive/Skrivbord/Projects/ULTRA/Veckans300/go/main.go:203 +0x2f2
main.ProcessUploadImage()
C:/Users/hawai/OneDrive/Skrivbord/Projects/ULTRA/Veckans300/go/main.go:227 +0xc4
main.main.func6()
C:/Users/hawai/OneDrive/Skrivbord/Projects/ULTRA/Veckans300/go/main.go:433 +0x5d
Goroutine 35 (running) created at:
main.main()
C:/Users/hawai/OneDrive/Skrivbord/Projects/ULTRA/Veckans300/go/main.go:433 +0x40a
Goroutine 36 (running) created at:
main.main()
C:/Users/hawai/OneDrive/Skrivbord/Projects/ULTRA/Veckans300/go/main.go:433 +0x40a
==================
WARNING: DATA RACE
Write at 0x00c00016c200 by goroutine 35:
net/textproto.MIMEHeader.Set()
C:/Program Files/Go/src/net/textproto/header.go:22 +0x424
net/http.Header.Set()
C:/Program Files/Go/src/net/http/header.go:40 +0x375
github.com/supabase-community/storage-go.(*Client).UploadOrUpdateFile()
C:/Users/hawai/go/pkg/mod/github.com/supabase-community/storage-go@v0.7.0/storage.go:38 +0x309
github.com/supabase-community/storage-go.(*Client).UploadFile()
C:/Users/hawai/go/pkg/mod/github.com/supabase-community/storage-go@v0.7.0/storage.go:76 +0x39e
main.UploadImage()
C:/Users/hawai/OneDrive/Skrivbord/Projects/ULTRA/Veckans300/go/main.go:203 +0x2f2
main.ProcessUploadImage()
C:/Users/hawai/OneDrive/Skrivbord/Projects/ULTRA/Veckans300/go/main.go:227 +0xc4
main.main.func6()
C:/Users/hawai/OneDrive/Skrivbord/Projects/ULTRA/Veckans300/go/main.go:433 +0x5d
Previous write at 0x00c00016c200 by goroutine 36:
net/textproto.MIMEHeader.Set()
C:/Program Files/Go/src/net/textproto/header.go:22 +0x424
net/http.Header.Set()
C:/Program Files/Go/src/net/http/header.go:40 +0x375
github.com/supabase-community/storage-go.(*Client).UploadOrUpdateFile()
C:/Users/hawai/go/pkg/mod/github.com/supabase-community/storage-go@v0.7.0/storage.go:38 +0x309
github.com/supabase-community/storage-go.(*Client).UploadFile()
C:/Users/hawai/go/pkg/mod/github.com/supabase-community/storage-go@v0.7.0/storage.go:76 +0x39e
main.UploadImage()
C:/Users/hawai/OneDrive/Skrivbord/Projects/ULTRA/Veckans300/go/main.go:203 +0x2f2
main.ProcessUploadImage()
C:/Users/hawai/OneDrive/Skrivbord/Projects/ULTRA/Veckans300/go/main.go:227 +0xc4
main.main.func6()
C:/Users/hawai/OneDrive/Skrivbord/Projects/ULTRA/Veckans300/go/main.go:433 +0x5d
Goroutine 35 (running) created at:
main.main()
C:/Users/hawai/OneDrive/Skrivbord/Projects/ULTRA/Veckans300/go/main.go:433 +0x40a
Goroutine 36 (running) created at:
main.main()
C:/Users/hawai/OneDrive/Skrivbord/Projects/ULTRA/Veckans300/go/main.go:433 +0x40a
fatal error: concurrent map writes
goroutine 37 [running]:
net/textproto.MIMEHeader.Set(...)
C:/Program Files/Go/src/net/textproto/header.go:22
net/http.Header.Set(...)
C:/Program Files/Go/src/net/http/header.go:40
github.com/supabase-community/storage-go.(*Client).UploadOrUpdateFile(0xc000172000, {0x1406238be, 0x6}, {0xc000582640, 0x36}, {0x1406ce080?, 0xc00008c000}, 0x0, {0xc00076fd70, 0x1, ...})
C:/Users/hawai/go/pkg/mod/github.com/supabase-community/storage-go@v0.7.0/storage.go:38 +0x414
github.com/supabase-community/storage-go.(*Client).UploadFile(...)
C:/Users/hawai/go/pkg/mod/github.com/supabase-community/storage-go@v0.7.0/storage.go:76
main.UploadImage({{0xc000702400, 0x40}, {0xc000582640, 0x36}, 0x63a69, {0xc000624196, 0xa}}, 0x0?)
C:/Users/hawai/OneDrive/Skrivbord/Projects/ULTRA/Veckans300/go/main.go:203 +0x39f
main.ProcessUploadImage(0x0?, 0x0?, 0x0?, 0x0?)
C:/Users/hawai/OneDrive/Skrivbord/Projects/ULTRA/Veckans300/go/main.go:227 +0xc5
created by main.main in goroutine 1
C:/Users/hawai/OneDrive/Skrivbord/Projects/ULTRA/Veckans300/go/main.go:433 +0x40b
`
The text was updated successfully, but these errors were encountered: