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

Bug: reflect: slice index out of range #38

Open
BenB196 opened this issue Oct 7, 2019 · 15 comments
Open

Bug: reflect: slice index out of range #38

BenB196 opened this issue Oct 7, 2019 · 15 comments

Comments

@BenB196
Copy link
Owner

BenB196 commented Oct 7, 2019

Following error can be thrown

panic: reflect: slice index out of range [recovered]
        panic: reflect: slice index out of range

goroutine 82 [running]:
encoding/json.(*encodeState).marshal.func1(0xc0049ef9e8)
        /usr/local/go/src/encoding/json/encode.go:305 +0x9a
panic(0x9c2ca0, 0xb7ee60)
        /usr/local/go/src/runtime/panic.go:679 +0x1b2
reflect.Value.Index(0x9b4b60, 0xc00000c080, 0x197, 0x27, 0xa20100, 0xc00025c720, 0x199)
        /usr/local/go/src/reflect/value.go:949 +0x1fe
encoding/json.arrayEncoder.encode(0xc000b9be60, 0xc0000ea070, 0x9b4b60, 0xc00000c080, 0x197, 0xc0049e0100)
        /usr/local/go/src/encoding/json/encode.go:791 +0x8d
encoding/json.sliceEncoder.encode(0xc0002e7710, 0xc0000ea070, 0x9b4b60, 0xc00000c080, 0x197, 0x4f0100)
        /usr/local/go/src/encoding/json/encode.go:765 +0x8f
encoding/json.ptrEncoder.encode(0xc0002e77a0, 0xc0000ea070, 0x99cd00, 0xc00000c080, 0x16, 0x990100)
        /usr/local/go/src/encoding/json/encode.go:810 +0xb1
encoding/json.(*encodeState).reflectValue(0xc0000ea070, 0x99cd00, 0xc00000c080, 0x16, 0x100)
        /usr/local/go/src/encoding/json/encode.go:337 +0x82
encoding/json.(*encodeState).marshal(0xc0000ea070, 0x99cd00, 0xc00000c080, 0x100, 0x0, 0x0)
        /usr/local/go/src/encoding/json/encode.go:309 +0x10b
encoding/json.Marshal(0x99cd00, 0xc00000c080, 0x1000, 0xc0013d0000, 0xc000532030, 0x0, 0x0)
        /usr/local/go/src/encoding/json/encode.go:161 +0x52
github.com/BenB196/crashplan-ffs-puller/eventOutput.WriteInProgressQueries(0xc00011cef0, 0xe, 0xc00011e5e0, 0x17, 0xc00011cf00, 0xf, 0xc00011cefe, 0x2, 0xc00011cf10, 0x3, ...)
        /app/eventOutput/fileHandler.go:279 +0x2fe
github.com/BenB196/crashplan-ffs-puller/ffsEvent.FFSQuery.func2(0xc00000c080, 0xc0004282d0, 0xc00000a1e0, 0xc000212780)
        /app/ffsEvent/ffsEvent.go:99 +0x23c
created by github.com/BenB196/crashplan-ffs-puller/ffsEvent.FFSQuery
        /app/ffsEvent/ffsEvent.go:91 +0x67d
@BenB196
Copy link
Owner Author

BenB196 commented Oct 10, 2019

Not sure how to properly handle this.

BenB196 added a commit that referenced this issue Oct 19, 2019
…are writen to disk

Resovles issue #59
And hopefully fixes issue #38
@BenB196
Copy link
Owner Author

BenB196 commented Oct 19, 2019

Hopefully fixed in release v0.1.9.

@BenB196 BenB196 closed this as completed Oct 19, 2019
@BenB196
Copy link
Owner Author

BenB196 commented Oct 21, 2019

Bug still not fixed

@BenB196 BenB196 reopened this Oct 21, 2019
@BenB196
Copy link
Owner Author

BenB196 commented Dec 11, 2019

Hopefully fixed in release v0.2.2

@lucbarr
Copy link

lucbarr commented Apr 29, 2021

What was the root cause ?

@BenB196
Copy link
Owner Author

BenB196 commented Apr 29, 2021

@lucbarr I was never able to track this fully down, however, I haven't seen it since upgrading to the newer versions of Go, so I'm guessing it was an issue it.

@didopimentel
Copy link

@BenB196 I think there are some race conditions bugs with the json.Marshal. Upgrading the Go version did not fix for me, but actually creating a mutex lock inside the MarshalJSON() method worked.

@didopimentel
Copy link

Did the same as this guy here

@BenB196
Copy link
Owner Author

BenB196 commented Apr 29, 2021

Hmm, interesting, yeah, unfortunately this issue was opened a while ago, and since then, and the project has had some major changes to its logic. So I'm not sure what really fixed it for this project. Though, the mutex thing does make sense, if you are using json marshaling with a pointer as in theory the value could change midway through.

@TUTUBIG
Copy link

TUTUBIG commented Sep 23, 2021

i got this error too

@TUTUBIG
Copy link

TUTUBIG commented Sep 23, 2021

should not be a issue about data race. for i got this in a serialization process
image
panic here

@didopimentel
Copy link

@TUTUBIG where does this storageChan slice come from? I can't see the declaration inside the function. But I don't understand why your code settles that this shouldn't be a race condition issue.

@Ilak-0
Copy link

Ilak-0 commented May 19, 2023

the same to my code,when using json marshal change struck to json. error msg is panic: runtime error: index out of range [16] with length 16 [recovered]

@MaShantao
Copy link

hello?? anyone has solve this issue??

@wqedggc
Copy link

wqedggc commented Oct 26, 2023

i got this one......... why happened

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants