Concurrency issues in Dumper

This issue has been created since 2022-07-04.

System (please complete the following information):

  • OS: linux, macOS
  • GO Version: 1.18
  • Pkg Version: 0.5.5

Describe the bug

&fatal error: concurrent map read and map write


To see all goroutines, visit https://github.com/maruel/panicparse#gotraceback

1: running
    runtime :0 throw()
runtime.throw({0x10490cd05, 0x21})
        /usr/local/go/src/runtime/panic.go:1198 +0x54 fp=0x140003dfa70 sp=0x140003dfa40 pc=0x1046d9c34
runtime.mapaccess2(0x104997d80, 0x1400044c3f0, 0x140003dfaf0)
        /usr/local/go/src/runtime/map.go:469 +0x228 fp=0x140003dfab0 sp=0x140003dfa70 pc=0x1046b31f8
github.com/gookit/goutil/dump.(*Dumper).checkCyclicRef(0x14000146180, {0x1049f0bd0, 0x1049d2980}, {0x1049d2980, 0x14000384420, 0x199})
        /{$GOPATH}/pkg/mod/github.com/gookit/goutil@v0.5.5/dump/dumper.go:403 +0x6c fp=0x140003dfb30 sp=0x140003dfab0 pc=0x1047c8bcc
github.com/gookit/goutil/dump.(*Dumper).printRValue(0x14000146180, {0x1049f0bd0, 0x10497f860}, {0x10497f860, 0x14000384420, 0x16})
        /{$GOPATH}/pkg/mod/github.com/gookit/goutil@v0.5.5/dump/dumper.go:309 +0x121c fp=0x140003dfeb0 sp=0x140003dfb30 pc=0x1047c799c
github.com/gookit/goutil/dump.(*Dumper).printOne(0x14000146180, {0x10497f860, 0x14000384420})
        /{$GOPATH}/pkg/mod/github.com/gookit/goutil@v0.5.5/dump/dumper.go:229 +0x118 fp=0x140003dff30 sp=0x140003dfeb0 pc=0x1047c6718
github.com/gookit/goutil/dump.(*Dumper).dump(0x14000146180, {0x140003dffa8, 0x1, 0x1})
        /{$GOPATH}/pkg/mod/github.com/gookit/goutil@v0.5.5/dump/dumper.go:171 +0x120 fp=0x140003dff80 sp=0x140003dff30 pc=0x1047c5e20
github.com/gookit/goutil/dump.(*Dumper).Println(...)
        /{$GOPATH}/pkg/mod/github.com/gookit/goutil@v0.5.5/dump/dumper.go:136
github.com/gookit/goutil/dump.Println(...)
        /{$GOPATH}/pkg/mod/github.com/gookit/goutil@v0.5.5/dump/dump.go:96
main.(*SimpleTradeSpi).OnRtnTrade(0x104bdd850, 0x14000384420)
        /{$GOPATH}/sample/main.go:274 +0x5c fp=0x140003dffc0 sp=0x140003dff80 pc=0x10490021c
runtime.goexit()
        /usr/local/go/src/runtime/asm_arm64.s:1133 +Failed: failed to parse int on line: "runtime.throw({0x10490cd05, 0x21})"

出错位置:

func (d *Dumper) checkCyclicRef(t reflect.Type, v reflect.Value) (goon bool) {
	addr := v.UnsafeAddr()
	vis := visit{addr, t}

	if vd, ok := d.visited[vis]; ok && vd < d.MaxDepth { <------- here
		d.indentPrint(t.String(), "{(!CYCLIC REFERENCE!)}\n")
		return false // don't print v again
	}

	// record
	d.visited[vis] = d.curDepth
	return true
}
pseudocodes wrote this answer on 2022-07-09

why not use sync.Map

inhere wrote this answer on 2022-07-09

sync.Map is too heavy

inhere wrote this answer on 2022-09-03

fixed on v0.5.6+

More Details About Repo
Owner Name gookit
Repo Name goutil
Full Name gookit/goutil
Language Go
Created Date 2018-07-03
Updated Date 2023-03-22
Star Count 1263
Watcher Count 29
Fork Count 142
Issue Count 3

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
[Feature]: Set a "global" timeout for the entire workflow 3 2023-01-14 2023-02-15
Suggestion: Battering ram addition 0 2021-12-02 2023-03-17
Confirming that the client is open source? 2 2022-01-05 2023-02-13
Internal cache duplicates existing jest caching logic 0 2021-11-10 2023-03-23
Derive Y-STRs from Big Y data 0 2017-11-19 2023-02-28
Track and use discrepant SNPs to improve quality of data 2 2017-11-19 2023-02-10
getting android id fails 5 2021-11-26 2023-02-26
ffmpegを入れたdckerfileの扱い 24 2021-09-23 2023-03-03
README is wrong 1 2021-01-18 2022-01-12
slide movement question 2 2020-07-31 2023-03-07
False alarm about old rez file 0 2021-10-19 2023-02-16
SslSocket->next_layer().close(); close() function makes the programm crashed, try ...catch.. does not catch it. 0 2022-06-22 2022-11-14
ANYPROXY莫名其妙的掉 1 2021-10-07 2022-01-12
Testing spark-excel again coming spark 3.2 release 3 2021-10-03 2023-03-14
hidalgo: interfaces changed a bit in newer versions 1 2022-03-21 2023-03-13
BUR model doesn't validate tags 1 2022-02-16 2023-03-21
linkfinder module does not return any result. 2 2021-09-27 2023-03-23
setup a separate repo (e.g. `darts-datasets`) to host the datasets 0 2022-10-30 2023-02-21
AddFlat on struct with null embedded pointer panics 1 2022-06-30 2023-03-02
How does tailwind support ionic+angular projects? 5 2021-01-26 2023-03-09
Provide a positive list of requirements 1 2020-10-22 2023-03-09
Preview button only shows the released version, not the currently editing version 0 2022-02-17 2023-02-12
Tenant connection is set to null after tenant model is updated in the database 8 2021-11-10 2023-03-13
exchange 2019 prereq article - iis rewrite module step needs needs to go after step 3 3 2022-04-07 2022-08-07
Reading emails via pop3 or imap from localhost crashes node-red 2 2022-07-15 2023-03-14
[DECOUPLING] Add BlobSidecar container 0 2023-02-07 2023-03-06
All programs and websites should have a dark mode tbh. 4 2021-08-01 2023-03-14
[Spike] VMWare Tanzu integration - Egress Message Drop rate with 2 instances 0 2021-09-15 2023-02-06
click_initiate_payment_reject error when clicking to paypal 1 2021-04-21 2023-03-09
[3.x]: Site dropdown in Reactor's Edit Link modal not working as expected 1 2022-05-25 2022-12-22
[Package]: nmcli 6 2021-09-04 2022-01-13
--packages=external does not work in conjunction with typescript path aliases 5 2023-01-04 2023-02-07
Implement creation date filter for streams and dashboards overview. 0 2023-03-01 2023-03-21
Cannot find JAR in outputDirectory path when using spring-boot-maven-plugin 6 2021-07-26 2022-10-31
single channel expecting channel skew in configuration 2 2021-12-09 2023-03-17
[Bug] Fallback Handler can't load FirebaseCppApp when running Unity in - batchmode on Linux 3 2022-02-19 2023-03-12
Build SDK quickstart tooling 4 2021-10-05 2023-03-07
FluentMySQLDriver crashes when saving dates 4 2020-04-03 2023-03-07
Launch Blocking (and nice to have) Smoothie features 1 2021-11-12 2023-02-23
升级飞桨代码中使用Numpy 1.20 数据类型的用法 0 2023-01-19 2023-02-25
Custom Layer Performance 1 2021-12-27 2023-03-08
Docs: Feedback for Managing Map Memory 1 2021-10-25 2023-02-17
The use of ACTION_TIME_TICK 0 2017-04-08 2023-03-21
不知道支持compose嘛? 1 2021-11-18 2022-01-08
build(deps): bump hosted-git-info from 2.7.1 to 2.8.9 in /packages/chameleon-linter 0 2021-05-11 2023-02-17
[Bug] topic auto creation does not check for CREATE_TOPIC permission 1 2022-09-01 2023-02-17
'podman' is not 'delegated'. 2 2021-10-05 2023-02-21
dashboard-hook-ingressroute.yaml has hardcoded values 3 2022-05-12 2023-03-18
`kubectl diff` exits with code 0 when files don't exist 8 2021-07-26 2023-03-22
LSIF tool backward incompatibility 1 2022-08-15 2023-02-02