cloudflare / cloudflare/workerd
Internal Errors of Type Invalid Arguments/Out of Bound Array Access
- Dominant language
- C++
- Stars
- 8.7k
- Forks
- 739
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 174
Description
Recently, I encountered an intensive error rate (~30%) of type `internal errors` in my deployed worker and had no idea of the origin of these errors. After working on the issue for a couple of days and getting help from the CF team, I found that the `internal errors` were being thrown because of `Invalid Arguments/Out Of Bound Array Access` (90% accurate conclusion). I had a `DataView` for which I was passing incorrect arguments, new `DataView(mBuffer, count * 2, 2)`. The `count * 2` was bigger than the length of `mBuffer`, causing the `DataView` to encounter an `Out of Bound Array Access`. The variable `count` would increase over time, and when the worker was running for a long period, `count` would exceed the size of `mBuffer`, resulting in `internal errors` being thrown.
As the CF team suggested, I opened this issue to be sorted for future developments to add an informative `js` exception for such conditions.
Contributor guide
Assessment
This issue has not been assessed yet.