encoding/binary limits(or bug?)

310 views
Skip to first unread message

Sergey Vidyuk

unread,
Jul 4, 2016, 11:54:10 AM7/4/16
to golang-dev
Hi,

I am trying to do large read using binary.Read and getting following error

Error during vector conversion:read tcp 127.0.0.1:62423->127.0.0.1:1234: read: invalid argument, vector size:500000000, element: []int64

which comes from err = binary.Read(r, order, arr)

arr is 500M elements of int64(slice). Underlying reader is bufio.Reader around tcp socket. Is this expected behaviour?



go version go1.6.2 darwin/amd64


Regards,

Sergey

Matthew Dempsky

unread,
Jul 4, 2016, 5:41:39 PM7/4/16
to Sergey Vidyuk, golang-dev
If you're able to provide a minimal reproducible test case and file an issue at golang.org/issue/new, we can take a look.

I'm a bit suspicious though because "Error during vector conversion" and "vector size" aren't strings that appear anywhere in the Go source tree.  It seems likely those errors are being caused by some other library code that you're using.

--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jakob Borg

unread,
Jul 5, 2016, 3:55:16 AM7/5/16
to Sergey Vidyuk, golang-dev
2016-07-04 17:54 GMT+02:00 Sergey Vidyuk <svi...@gmail.com>:
> Hi,
>
> I am trying to do large read using binary.Read and getting following error
>
> Error during vector conversion:read tcp 127.0.0.1:62423->127.0.0.1:1234:
> read: invalid argument, vector size:500000000, element: []int64
>
> which comes from err = binary.Read(r, order, arr)
>
> arr is 500M elements of int64(slice). Underlying reader is bufio.Reader
> around tcp socket. Is this expected behaviour?

You'll get this error for int64 slices longer than 2^31/8 items, as
the read size then exceeds an int32. At least on platforms with a 32
bit size_t. Maybe binary.Read() should handle this and split the reads
up, I don't know.

//jb

Sergey Vidyuk

unread,
Jul 5, 2016, 4:01:12 AM7/5/16
to Jakob Borg, golang-dev
Thanks Jakob,
I am running OSX 10.11 which is I suspect LP64. I am trying to create small reproducer.

Sergey Vidyuk

unread,
Jul 5, 2016, 4:15:58 AM7/5/16
to Jakob Borg, golang-dev
Reply all
Reply to author
Forward
0 new messages