Crash from log?

Hello,
I have a program and this program stops. I don’t understand this crash. Here is the error message:

goroutine 90 [running]:
runtime.throw(0xdf7680, 0x21)
/root/go/src/runtime/panic.go:547 +0x90 fp=0xc8216195a8 sp=0xc821619590
runtime.mapaccess2(0xb30b40, 0xc8202f8ab0, 0xc820d24318, 0x1, 0x1)
/root/go/src/runtime/hashmap.go:343 +0x5a fp=0xc8216195f0 sp=0xc8216195a8
reflect.mapaccess(0xb30b40, 0xc8202f8ab0, 0xc820d24318, 0xc8202f8ab0)
/root/go/src/runtime/hashmap.go:993 +0x35 fp=0xc821619620 sp=0xc8216195f0
reflect.Value.MapIndex(0xb30b40, 0xc8202f4cd8, 0x1b5, 0xb2fc40, 0xc820d24318, 0xa6, 0x0, 0x0, 0x0)
/root/go/src/reflect/value.go:1041 +0x14a fp=0xc8216196a8 sp=0xc821619620
fmt.(*pp).printReflectValue(0xc821caf5f0, 0xb30b40, 0xc8202f4cd8, 0x1b5, 0xc800000076, 0x2, 0x0)
/root/go/src/fmt/print.go:904 +0x2887 fp=0xc821619e60 sp=0xc8216196a8
fmt.(*pp).printValue(0xc821caf5f0, 0xb30b40, 0xc8202f4cd8, 0x1b5, 0x76, 0x2, 0x1b5)
/root/go/src/fmt/print.go:848 +0x440 fp=0xc821619f50 sp=0xc821619e60
fmt.(*pp).printReflectValue(0xc821caf5f0, 0xcce0a0, 0xc8202f4cd0, 0x199, 0xc800000076, 0x1, 0x0)
/root/go/src/fmt/print.go:932 +0x3b79 fp=0xc82161a708 sp=0xc821619f50
fmt.(*pp).printValue(0xc821caf5f0, 0xcce0a0, 0xc8202f4cd0, 0x199, 0xc800000076, 0x1, 0x0)
/root/go/src/fmt/print.go:848 +0x440 fp=0xc82161a7f8 sp=0xc82161a708
fmt.(*pp).printReflectValue(0xc821caf5f0, 0xced300, 0xc8202f4cd0, 0x16, 0x76, 0x0, 0x2e05c59cf6c70800)
/root/go/src/fmt/print.go:1009 +0x351e fp=0xc82161afb0 sp=0xc82161a7f8
fmt.(*pp).printArg(0xc821caf5f0, 0xced300, 0xc8202f4cd0, 0x76, 0x0, 0xc81ff96d00)
/root/go/src/fmt/print.go:810 +0x540 fp=0xc82161b138 sp=0xc82161afb0
fmt.(*pp).doPrint(0xc821caf5f0, 0xc82161bad0, 0x3, 0x3, 0x101)
/root/go/src/fmt/print.go:1273 +0x24d fp=0xc82161b238 sp=0xc82161b138
fmt.Sprintln(0xc82161bad0, 0x3, 0x3, 0x0, 0x0)
/root/go/src/fmt/print.go:271 +0x62 fp=0xc82161b288 sp=0xc82161b238
log.Println(0xc82161bad0, 0x3, 0x3)
/root/go/src/log/log.go:295 +0x35 fp=0xc82161b2d0 sp=0xc82161b288
main.(*EnvoieMsg).TraiteEnvoieMsg(0xc820100000, 0xc8203bf080)
/root/workspace/go/src/client/envoieMsg.go:781 +0x48aa fp=0xc82161bf70 sp=0xc82161b2d0
runtime.goexit()
/root/go/src/runtime/asm_amd64.s:1998 +0x1 fp=0xc82161bf78 sp=0xc82161bf70
created by main.(*EnvoieMsg).EnvoieMsg
/root/workspace/go/src/client/envoieMsg.go:406 +0x46b

goroutine 1 [chan receive, 909 minutes]:
main.main()
/root/workspace/go/src/client/client.go:512 +0x4898

goroutine 17 [syscall, 909 minutes, locked to thread]:
runtime.goexit()
/root/go/src/runtime/asm_amd64.s:1998 +0x1

goroutine 5 [syscall, 909 minutes]:
os/signal.signal_recv(0x0)
/root/go/src/runtime/sigqueue.go:116 +0x132

Line blocking:
log.Println(“EnvoieMsg: Fin de envoieMsg==>”,this.variable, typeMsg)

The function is a goroutine and can call many time and this.variable is variable use on readonly in all goroutine.

It is a problem this.variable ?
I have to put a mutex to use the log.Println ?

thanks for response :slight_smile:

Hello,
I can corrected my message :
502 Bad Gateway

The forum don"t work ???

What are the types of this.variable and of typeMsg? (Especially, is one of them a complex data structure, like a struct with slices, arrays, or pointers?)

And have you already run the race detector? You say that all goroutines access the variables only for reading, but still…

Yes this.variable is a pointeur of structure.
I make just log.println. I think that the println print all variables on structure and this variable can change.
I wanted a confirmation that it is.
I delete this.variable form log.println() because I do not need it and I’m retesting.

Thanks you, I knew all along.

Good approach. If log.Println then does not error out anymore then Println seems to have some problem while trying to examine the structure of this.variable.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.