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

Formatting functions not thread safe #180

Closed
mariyamkhalid opened this issue Aug 21, 2023 · 10 comments
Closed

Formatting functions not thread safe #180

mariyamkhalid opened this issue Aug 21, 2023 · 10 comments
Labels
Bug Report a reproducible bug or regression

Comments

@mariyamkhalid
Copy link

Hello,

I encountered an issue with the following code:

package main

import (
	"fmt"
	"time"

	"github.com/golang-module/carbon/v2"
)

func say(rawTime carbon.Carbon) {
	formatted := rawTime.ToShortMonthString()
	fmt.Println(formatted)
}

func main() {
	rawTime := carbon.Parse("2022-05-01", carbon.UTC)
	go say(rawTime)
	go say(rawTime)
	go say(rawTime)
	time.Sleep(100 * time.Millisecond)
}

golang version: 1.19

carbon version:v2.2.3

time zone: UTC

I expected to get:

May
May
May

But I actually get:

fatal error: concurrent map read and map write

goroutine 11 [running]:
github.com/golang-module/carbon/v2.Carbon.ToShortMonthString({{0x0, 0xed9ffc480, 0x0}, 0x0, 0x250b420, 0xc00061a940, {0x0, 0x0}}, {0x0, 0x0, ...})
        /Users/mariyam.khalid/workspace/ntbue-insights-service/vendor/github.com/golang-module/carbon/v2/outputer.go:61 +0x1ed
tableau/ntbue-insights-service/internal/facts_test.say({{0x0, 0xed9ffc480, 0x0}, 0x0, 0x250b420, 0xc00061a940, {0x0, 0x0}})

Thanks!

@mariyamkhalid mariyamkhalid added the Bug Report a reproducible bug or regression label Aug 21, 2023
@gouguoyin
Copy link
Collaborator

Fixed in version 2.2.4

@mariyamkhalid
Copy link
Author

mariyamkhalid commented Aug 22, 2023

Thanks! I think that fixed some issues.
But I'm still getting concurrent read write panics on the same carbon instance..

import (
	"fmt"
	"time"

	"github.com/golang-module/carbon/v2"
)

func say(rawTime carbon.Carbon) {
	formatted := rawTime.ToShortMonthString()
	fmt.Println(formatted)
}

func main() {
	cDate := carbon.Parse("2022-12-01")
	for i := 0; i < 30; i++ {
		go say(cDate)
	}
	time.Sleep(100 * time.Millisecond)
}

@gouguoyin
Copy link
Collaborator

Fixed in version 2.2.5

@davidjsimpson98
Copy link

davidjsimpson98 commented Jan 18, 2024

This problem still happens. I can reproduce it with version 2.2.5 and 2.3.5, using the sample program provided by Mariyam on Aug 22.

Should I create a new issue report, or can this one be re-opened?

@gouguoyin
Copy link
Collaborator

image image

@gouguoyin gouguoyin reopened this Jan 19, 2024
@davidjsimpson98
Copy link

Run the program several times. I found that the concurrent map access error happens about half of the time. I was also running it from the command line with go run.

@davidjsimpson98
Copy link

davidjsimpson98 commented Jan 19, 2024

This is using carbon v2.3.5.

$ go run ./carbon-test.go

fatal error: concurrent map read and map write
Dec
fatal error: concurrent map read and map write
fatal error: concurrent map read and map write

goroutine 34 [running]:
github.com/golang-module/carbon/v2.Carbon.ToShortMonthString({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}}, ...)
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/outputer.go:69 +0x149
main.say({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}})
	/Users/david/testing/carbon-test.go:11 +0x3f
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 1 [sleep]:
time.Sleep(0x5f5e100)
	/Users/david/.goenv/versions/1.21/src/runtime/time.go:195 +0x125
main.main()
	/Users/david/testing/carbon-test.go:20 +0x11c

goroutine 6 [sync.Mutex.Lock]:
sync.runtime_SemacquireMutex(0x0?, 0x0?, 0x0?)
	/Users/david/.goenv/versions/1.21/src/runtime/sema.go:77 +0x25
sync.(*Mutex).lockSlow(0xc00001a180)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:171 +0x15d
sync.(*Mutex).Lock(...)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:90
sync.(*RWMutex).Lock(0x0?)
	/Users/david/.goenv/versions/1.21/src/sync/rwmutex.go:147 +0x31
github.com/golang-module/carbon/v2.(*Language).SetLocale(0xc000024080, {0x10e11e0, 0x2})
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/language.go:56 +0x4b
github.com/golang-module/carbon/v2.Carbon.ToShortMonthString({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}}, ...)
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/outputer.go:67 +0x125
main.say({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}})
	/Users/david/testing/carbon-test.go:11 +0x3f
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 7 [runnable]:
reflect.mapassign_faststr0(0x10ca100, 0x10c5bc0?, {0xc0001800ba?, 0x110f7a0?}, 0x10c5bc0?)
	/Users/david/.goenv/versions/1.21/src/runtime/map.go:1376 +0x25
reflect.mapassign_faststr(0x10c5bc0?, 0xc000182010?, {0xc0001800ba, 0x6}, 0x19?)
	/Users/david/.goenv/versions/1.21/src/reflect/value.go:3837 +0xa9
reflect.Value.SetMapIndex({0x10ca100?, 0xc0000240a0?, 0x97?}, {0x10c5bc0, 0xc0001820e0, 0x98}, {0x10c5bc0, 0xc000182010, 0x198})
	/Users/david/.goenv/versions/1.21/src/reflect/value.go:2402 +0x225
encoding/json.(*decodeState).object(0xc000186000, {0x10c4c40?, 0xc0000240a0?, 0x1010000000010?})
	/Users/david/.goenv/versions/1.21/src/encoding/json/decode.go:797 +0x13c5
encoding/json.(*decodeState).value(0xc000186000, {0x10c4c40?, 0xc0000240a0?, 0x1216a68?})
	/Users/david/.goenv/versions/1.21/src/encoding/json/decode.go:374 +0x3e
encoding/json.(*decodeState).unmarshal(0xc000186000, {0x10c4c40?, 0xc0000240a0?})
	/Users/david/.goenv/versions/1.21/src/encoding/json/decode.go:181 +0x133
encoding/json.Unmarshal({0xc000184000, 0x2f9, 0x300}, {0x10c4c40, 0xc0000240a0})
	/Users/david/.goenv/versions/1.21/src/encoding/json/decode.go:108 +0x111
github.com/golang-module/carbon/v2.(*Language).SetLocale(0xc000024080, {0x10e11e0, 0x2})
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/language.go:69 +0x18e
github.com/golang-module/carbon/v2.Carbon.ToShortMonthString({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}}, ...)
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/outputer.go:67 +0x125
main.say({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}})
	/Users/david/testing/carbon-test.go:11 +0x3f
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 8 [sync.Mutex.Lock]:
sync.runtime_SemacquireMutex(0x0?, 0x0?, 0x0?)
	/Users/david/.goenv/versions/1.21/src/runtime/sema.go:77 +0x25
sync.(*Mutex).lockSlow(0xc00001a180)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:171 +0x15d
sync.(*Mutex).Lock(...)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:90
sync.(*RWMutex).Lock(0x0?)
	/Users/david/.goenv/versions/1.21/src/sync/rwmutex.go:147 +0x31
github.com/golang-module/carbon/v2.(*Language).SetLocale(0xc000024080, {0x10e11e0, 0x2})
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/language.go:56 +0x4b
github.com/golang-module/carbon/v2.Carbon.ToShortMonthString({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}}, ...)
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/outputer.go:67 +0x125
main.say({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}})
	/Users/david/testing/carbon-test.go:11 +0x3f
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 9 [sync.Mutex.Lock]:
sync.runtime_SemacquireMutex(0x0?, 0x0?, 0x0?)
	/Users/david/.goenv/versions/1.21/src/runtime/sema.go:77 +0x25
sync.(*Mutex).lockSlow(0xc00001a180)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:171 +0x15d
sync.(*Mutex).Lock(...)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:90
sync.(*RWMutex).Lock(0x0?)
	/Users/david/.goenv/versions/1.21/src/sync/rwmutex.go:147 +0x31
github.com/golang-module/carbon/v2.(*Language).SetLocale(0xc000024080, {0x10e11e0, 0x2})
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/language.go:56 +0x4b
github.com/golang-module/carbon/v2.Carbon.ToShortMonthString({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}}, ...)
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/outputer.go:67 +0x125
main.say({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}})
	/Users/david/testing/carbon-test.go:11 +0x3f
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 10 [sync.Mutex.Lock]:
sync.runtime_SemacquireMutex(0x0?, 0x0?, 0x0?)
	/Users/david/.goenv/versions/1.21/src/runtime/sema.go:77 +0x25
sync.(*Mutex).lockSlow(0xc00001a180)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:171 +0x15d
sync.(*Mutex).Lock(...)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:90
sync.(*RWMutex).Lock(0x0?)
	/Users/david/.goenv/versions/1.21/src/sync/rwmutex.go:147 +0x31
github.com/golang-module/carbon/v2.(*Language).SetLocale(0xc000024080, {0x10e11e0, 0x2})
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/language.go:56 +0x4b
github.com/golang-module/carbon/v2.Carbon.ToShortMonthString({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}}, ...)
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/outputer.go:67 +0x125
main.say({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}})
	/Users/david/testing/carbon-test.go:11 +0x3f
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 11 [sync.Mutex.Lock]:
sync.runtime_SemacquireMutex(0x0?, 0x0?, 0x0?)
	/Users/david/.goenv/versions/1.21/src/runtime/sema.go:77 +0x25
sync.(*Mutex).lockSlow(0xc00001a180)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:171 +0x15d
sync.(*Mutex).Lock(...)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:90
sync.(*RWMutex).Lock(0x0?)
	/Users/david/.goenv/versions/1.21/src/sync/rwmutex.go:147 +0x31
github.com/golang-module/carbon/v2.(*Language).SetLocale(0xc000024080, {0x10e11e0, 0x2})
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/language.go:56 +0x4b
github.com/golang-module/carbon/v2.Carbon.ToShortMonthString({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}}, ...)
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/outputer.go:67 +0x125
main.say({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}})
	/Users/david/testing/carbon-test.go:11 +0x3f
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 12 [sync.Mutex.Lock]:
sync.runtime_SemacquireMutex(0x0?, 0x0?, 0x0?)
	/Users/david/.goenv/versions/1.21/src/runtime/sema.go:77 +0x25
sync.(*Mutex).lockSlow(0xc00001a180)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:171 +0x15d
sync.(*Mutex).Lock(...)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:90
sync.(*RWMutex).Lock(0x0?)
	/Users/david/.goenv/versions/1.21/src/sync/rwmutex.go:147 +0x31
github.com/golang-module/carbon/v2.(*Language).SetLocale(0xc000024080, {0x10e11e0, 0x2})
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/language.go:56 +0x4b
github.com/golang-module/carbon/v2.Carbon.ToShortMonthString({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}}, ...)
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/outputer.go:67 +0x125
main.say({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}})
	/Users/david/testing/carbon-test.go:11 +0x3f
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 13 [sync.Mutex.Lock]:
sync.runtime_SemacquireMutex(0x0?, 0x0?, 0x0?)
	/Users/david/.goenv/versions/1.21/src/runtime/sema.go:77 +0x25
sync.(*Mutex).lockSlow(0xc00001a180)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:171 +0x15d
sync.(*Mutex).Lock(...)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:90
sync.(*RWMutex).Lock(0x0?)
	/Users/david/.goenv/versions/1.21/src/sync/rwmutex.go:147 +0x31
github.com/golang-module/carbon/v2.(*Language).SetLocale(0xc000024080, {0x10e11e0, 0x2})
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/language.go:56 +0x4b
github.com/golang-module/carbon/v2.Carbon.ToShortMonthString({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}}, ...)
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/outputer.go:67 +0x125
main.say({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}})
	/Users/david/testing/carbon-test.go:11 +0x3f
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 14 [sync.Mutex.Lock]:
sync.runtime_SemacquireMutex(0x0?, 0x0?, 0x0?)
	/Users/david/.goenv/versions/1.21/src/runtime/sema.go:77 +0x25
sync.(*Mutex).lockSlow(0xc00001a180)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:171 +0x15d
sync.(*Mutex).Lock(...)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:90
sync.(*RWMutex).Lock(0x0?)
	/Users/david/.goenv/versions/1.21/src/sync/rwmutex.go:147 +0x31
github.com/golang-module/carbon/v2.(*Language).SetLocale(0xc000024080, {0x10e11e0, 0x2})
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/language.go:56 +0x4b
github.com/golang-module/carbon/v2.Carbon.ToShortMonthString({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}}, ...)
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/outputer.go:67 +0x125
main.say({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}})
	/Users/david/testing/carbon-test.go:11 +0x3f
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 15 [sync.Mutex.Lock]:
sync.runtime_SemacquireMutex(0x0?, 0x0?, 0x0?)
	/Users/david/.goenv/versions/1.21/src/runtime/sema.go:77 +0x25
sync.(*Mutex).lockSlow(0xc00001a180)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:171 +0x15d
sync.(*Mutex).Lock(...)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:90
sync.(*RWMutex).Lock(0x0?)
	/Users/david/.goenv/versions/1.21/src/sync/rwmutex.go:147 +0x31
github.com/golang-module/carbon/v2.(*Language).SetLocale(0xc000024080, {0x10e11e0, 0x2})
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/language.go:56 +0x4b
github.com/golang-module/carbon/v2.Carbon.ToShortMonthString({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}}, ...)
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/outputer.go:67 +0x125
main.say({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}})
	/Users/david/testing/carbon-test.go:11 +0x3f
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 16 [sync.Mutex.Lock]:
sync.runtime_SemacquireMutex(0x0?, 0x0?, 0x0?)
	/Users/david/.goenv/versions/1.21/src/runtime/sema.go:77 +0x25
sync.(*Mutex).lockSlow(0xc00001a180)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:171 +0x15d
sync.(*Mutex).Lock(...)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:90
sync.(*RWMutex).Lock(0x0?)
	/Users/david/.goenv/versions/1.21/src/sync/rwmutex.go:147 +0x31
github.com/golang-module/carbon/v2.(*Language).SetLocale(0xc000024080, {0x10e11e0, 0x2})
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/language.go:56 +0x4b
github.com/golang-module/carbon/v2.Carbon.ToShortMonthString({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}}, ...)
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/outputer.go:67 +0x125
main.say({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}})
	/Users/david/testing/carbon-test.go:11 +0x3f
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 17 [running]:
	goroutine running on other thread; stack unavailable
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 18 [runnable]:
main.main.func1()
	/Users/david/testing/carbon-test.go:18
runtime.goexit()
	/Users/david/.goenv/versions/1.21/src/runtime/asm_amd64.s:1650 +0x1
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 19 [runnable]:
main.main.func1()
	/Users/david/testing/carbon-test.go:18
runtime.goexit()
	/Users/david/.goenv/versions/1.21/src/runtime/asm_amd64.s:1650 +0x1
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 20 [sync.Mutex.Lock]:
sync.runtime_SemacquireMutex(0x0?, 0x0?, 0x0?)
	/Users/david/.goenv/versions/1.21/src/runtime/sema.go:77 +0x25
sync.(*Mutex).lockSlow(0xc00001a180)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:171 +0x15d
sync.(*Mutex).Lock(...)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:90
sync.(*RWMutex).Lock(0x0?)
	/Users/david/.goenv/versions/1.21/src/sync/rwmutex.go:147 +0x31
github.com/golang-module/carbon/v2.(*Language).SetLocale(0xc000024080, {0x10e11e0, 0x2})
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/language.go:56 +0x4b
github.com/golang-module/carbon/v2.Carbon.ToShortMonthString({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}}, ...)
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/outputer.go:67 +0x125
main.say({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}})
	/Users/david/testing/carbon-test.go:11 +0x3f
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 22 [runnable]:
main.main.func1()
	/Users/david/testing/carbon-test.go:18
runtime.goexit()
	/Users/david/.goenv/versions/1.21/src/runtime/asm_amd64.s:1650 +0x1
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 23 [runnable]:
main.main.func1()
	/Users/david/testing/carbon-test.go:18
runtime.goexit()
	/Users/david/.goenv/versions/1.21/src/runtime/asm_amd64.s:1650 +0x1
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 24 [sync.Mutex.Lock]:
sync.runtime_SemacquireMutex(0x0?, 0x0?, 0x0?)
	/Users/david/.goenv/versions/1.21/src/runtime/sema.go:77 +0x25
sync.(*Mutex).lockSlow(0xc00001a180)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:171 +0x15d
sync.(*Mutex).Lock(...)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:90
sync.(*RWMutex).Lock(0x0?)
	/Users/david/.goenv/versions/1.21/src/sync/rwmutex.go:147 +0x31
github.com/golang-module/carbon/v2.(*Language).SetLocale(0xc000024080, {0x10e11e0, 0x2})
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/language.go:56 +0x4b
github.com/golang-module/carbon/v2.Carbon.ToShortMonthString({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}}, ...)
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/outputer.go:67 +0x125
main.say({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}})
	/Users/david/testing/carbon-test.go:11 +0x3f
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 25 [runnable]:
main.main.func1()
	/Users/david/testing/carbon-test.go:18
runtime.goexit()
	/Users/david/.goenv/versions/1.21/src/runtime/asm_amd64.s:1650 +0x1
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 26 [running]:
	goroutine running on other thread; stack unavailable
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 27 [runnable]:
main.main.func1()
	/Users/david/testing/carbon-test.go:18
runtime.goexit()
	/Users/david/.goenv/versions/1.21/src/runtime/asm_amd64.s:1650 +0x1
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 28 [runnable]:
main.main.func1()
	/Users/david/testing/carbon-test.go:18
runtime.goexit()
	/Users/david/.goenv/versions/1.21/src/runtime/asm_amd64.s:1650 +0x1
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 29 [runnable]:
fmt.(*buffer).writeString(...)
	/Users/david/.goenv/versions/1.21/src/fmt/print.go:108
fmt.(*fmt).padString(0x11d0468?, {0xc00018e02c, 0x3})
	/Users/david/.goenv/versions/1.21/src/fmt/format.go:110 +0x217
fmt.(*fmt).fmtS(0x100b8fe?, {0xc00018e02c?, 0x0?})
	/Users/david/.goenv/versions/1.21/src/fmt/format.go:359 +0x39
fmt.(*pp).fmtString(0xc000290000?, {0xc00018e02c?, 0xd0?}, 0x10d8100?)
	/Users/david/.goenv/versions/1.21/src/fmt/print.go:494 +0x85
fmt.(*pp).printArg(0xc000290000, {0x10c5bc0?, 0xc00028e000}, 0x76)
	/Users/david/.goenv/versions/1.21/src/fmt/print.go:741 +0x1bb
fmt.(*pp).doPrintln(0xc000290000, {0xc00020ef60?, 0x1, 0xc00011c6e8?})
	/Users/david/.goenv/versions/1.21/src/fmt/print.go:1223 +0x38
fmt.Fprintln({0x110e2c8, 0xc00004a010}, {0xc00011c760, 0x1, 0x1})
	/Users/david/.goenv/versions/1.21/src/fmt/print.go:304 +0x49
fmt.Println(...)
	/Users/david/.goenv/versions/1.21/src/fmt/print.go:314
main.say({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}})
	/Users/david/testing/carbon-test.go:12 +0x7b
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 30 [sync.Mutex.Lock]:
sync.runtime_SemacquireMutex(0x0?, 0x0?, 0x0?)
	/Users/david/.goenv/versions/1.21/src/runtime/sema.go:77 +0x25
sync.(*Mutex).lockSlow(0xc00001a180)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:171 +0x15d
sync.(*Mutex).Lock(...)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:90
sync.(*RWMutex).Lock(0x0?)
	/Users/david/.goenv/versions/1.21/src/sync/rwmutex.go:147 +0x31
github.com/golang-module/carbon/v2.(*Language).SetLocale(0xc000024080, {0x10e11e0, 0x2})
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/language.go:56 +0x4b
github.com/golang-module/carbon/v2.Carbon.ToShortMonthString({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}}, ...)
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/outputer.go:67 +0x125
main.say({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}})
	/Users/david/testing/carbon-test.go:11 +0x3f
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 31 [sync.Mutex.Lock]:
sync.runtime_SemacquireMutex(0x0?, 0x0?, 0x0?)
	/Users/david/.goenv/versions/1.21/src/runtime/sema.go:77 +0x25
sync.(*Mutex).lockSlow(0xc00001a180)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:171 +0x15d
sync.(*Mutex).Lock(...)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:90
sync.(*RWMutex).Lock(0x0?)
	/Users/david/.goenv/versions/1.21/src/sync/rwmutex.go:147 +0x31
github.com/golang-module/carbon/v2.(*Language).SetLocale(0xc000024080, {0x10e11e0, 0x2})
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/language.go:56 +0x4b
github.com/golang-module/carbon/v2.Carbon.ToShortMonthString({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}}, ...)
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/outputer.go:67 +0x125
main.say({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}})
	/Users/david/testing/carbon-test.go:11 +0x3f
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 32 [sync.Mutex.Lock]:
sync.runtime_SemacquireMutex(0x0?, 0x0?, 0x0?)
	/Users/david/.goenv/versions/1.21/src/runtime/sema.go:77 +0x25
sync.(*Mutex).lockSlow(0xc00001a180)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:171 +0x15d
sync.(*Mutex).Lock(...)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:90
sync.(*RWMutex).Lock(0x0?)
	/Users/david/.goenv/versions/1.21/src/sync/rwmutex.go:147 +0x31
github.com/golang-module/carbon/v2.(*Language).SetLocale(0xc000024080, {0x10e11e0, 0x2})
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/language.go:56 +0x4b
github.com/golang-module/carbon/v2.Carbon.ToShortMonthString({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}}, ...)
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/outputer.go:67 +0x125
main.say({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}})
	/Users/david/testing/carbon-test.go:11 +0x3f
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 35 [sync.Mutex.Lock]:
sync.runtime_SemacquireMutex(0x0?, 0x0?, 0x0?)
	/Users/david/.goenv/versions/1.21/src/runtime/sema.go:77 +0x25
sync.(*Mutex).lockSlow(0xc00001a180)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:171 +0x15d
sync.(*Mutex).Lock(...)
	/Users/david/.goenv/versions/1.21/src/sync/mutex.go:90
sync.(*RWMutex).Lock(0x0?)
	/Users/david/.goenv/versions/1.21/src/sync/rwmutex.go:147 +0x31
github.com/golang-module/carbon/v2.(*Language).SetLocale(0xc000024080, {0x10e11e0, 0x2})
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/language.go:56 +0x4b
github.com/golang-module/carbon/v2.Carbon.ToShortMonthString({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}}, ...)
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/outputer.go:67 +0x125
main.say({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}})
	/Users/david/testing/carbon-test.go:11 +0x3f
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 26 [running]:
github.com/golang-module/carbon/v2.Carbon.ToShortMonthString({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}}, ...)
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/outputer.go:69 +0x149
main.say({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}})
	/Users/david/testing/carbon-test.go:11 +0x3f
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78

goroutine 17 [running]:
github.com/golang-module/carbon/v2.Carbon.ToShortMonthString({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}}, ...)
	/Users/david/testing/vendor/github.com/golang-module/carbon/v2/outputer.go:69 +0x149
main.say({{0x0, 0xedb1a5600, 0x11a7c80}, 0x0, 0x0, 0x0, 0x11a7c80, 0xc000024080, {0x0, 0x0}})
	/Users/david/testing/carbon-test.go:11 +0x3f
created by main.main in goroutine 1
	/Users/david/testing/carbon-test.go:18 +0x78
exit status 2

gouguoyin added a commit that referenced this issue Jan 22, 2024
gouguoyin added a commit that referenced this issue Jan 22, 2024
@gouguoyin
Copy link
Collaborator

gouguoyin commented Jan 22, 2024

Fixed in v2.3.6, you can test in ToMonthString, ToShortMonthString, ToWeekString, ToShortWeekString, Season, Constellation methods

@gouguoyin
Copy link
Collaborator

Have you tested it and there are still any issues?

@davidjsimpson98
Copy link

I cannot reproduce the problem with v2.3.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Report a reproducible bug or regression
Projects
None yet
Development

No branches or pull requests

3 participants