-
Notifications
You must be signed in to change notification settings - Fork 18k
encoding/json: unexpected fault address 0x26000000c6 #42795
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
Comments
Thank you for raising this issue. Your sample code looks incomplete as the stack trace you included mentioned goroutine 93 whereas the code fragment you provided did not use goroutines. Can you please
|
@davecheney |
Line 1004 in question is Without a reproducer or more details, there's not much we can do here. |
hi, @nzlov I met the same issuse. |
@xtutu please log a new issue and be sure to complete the entire template. You must provide a way for someone else to reproduce the problem you are seeing. |
@davecheney , i found what happy in my code . it solved. import (
"encoding/json"
"fmt"
"testing"
"time"
)
func TestABC(t *testing.T) {
type FF struct {
EE map[string][]string
}
a := make(map[string][]string)
for i := 0; i < 10000; i++ {
list := make([]string, 0)
for j := 0; j < (i % 10) + 1; j++ {
list = append(list, "1")
}
a[fmt.Sprintf("%d", i)] = list
}
// wrong code!
// this will failed
for _, valueList := range a {
go func() {
ff := &FF{EE: make(map[string][]string)}
ff.EE["x"] = valueList
_, _ = json.Marshal(ff)
}()
}
// right code!
// this is ok
// for _, valueList := range a {
// tmpValueList := valueList
// go func() {
// ff := &FF{EE: make(map[string][]string)}
// ff.EE["x"] = tmpValueList
// _, _ = json.Marshal(ff)
// }()
// }
time.Sleep(time.Second * 20)
} |
Thank you. I am closing and resolving this issue. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, but 1.14.2 is work.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Compile docker for linux on macos and run it on k8s
What did you expect to see?
Parse data to map
What did you see instead?
The text was updated successfully, but these errors were encountered: