6tail / lunar-go

日历、公历(阳历)、农历(阴历、老黄历)、道历、佛历,支持节假日、星座、儒略日、干支、生肖、节气、节日、彭祖百忌、每日宜忌、吉神宜趋凶煞宜忌、吉神(喜神/福神/财神/阳贵神/阴贵神)方位、胎神方位、冲煞、纳音、星宿、八字、五行、十神、建除十二值星、青龙名堂等十二神、黄道黑道日及吉凶等。lunar is a calendar library for Solar and Chinese Lunar.
https://6tail.cn/calendar/api.html
MIT License
215 stars 57 forks source link

[BUG] calendar.NewLunarYear 并发写LEAP以及CACHE #9

Open Durden-T opened 1 year ago

Durden-T commented 1 year ago

fatal error: concurrent map writes

goroutine 83169046 [running]: runtime.throw(0x23499751, 0x15) /usr/local/go/src/runtime/panic.go:1117 +0x72 fp=0xc049027458 sp=0xc049027428 pc=0x9b894b2 runtime.mapassign_fast64(0x21ae1ac0, 0xc00eab86c0, 0x7f2, 0x337c7f00) /usr/local/go/src/runtime/map_fast64.go:101 +0x33e fp=0xc049027498 sp=0xc049027458 pc=0x9b63bde github.com/6tail/lunar-go/calendar.NewLunarYear(0x7f2, 0xeeff37e80) /opt/compile_path/pkg/mod/github.com/6tail/lunar-go@v1.2.21/calendar/LunarYear.go:58 +0x27e fp=0xc0490274f0 sp=0xc049027498 pc=0x20a5417e github.com/6tail/lunar-go/calendar.NewLunarFromDate(0x0, 0xeeff37e80, 0x33765e40, 0x0) /opt/compile_path/pkg/mod/github.com/6tail/lunar-go@v1.2.21/calendar/Lunar.go:93 +0xa5 fp=0xc0490275a0 sp=0xc0490274f0 pc=0x20a3e225 github.com/6tail/lunar-go/calendar.(*Solar).GetLunar(...) /opt/compile_path/pkg/mod/github.com/6tail/lunar-go@v1.2.21/calendar/Solar.go:355

image

6tail commented 1 year ago

v1.3.0理论上已修复。