[ruby-list:50665] Re: OSXのNet::HTTPResponse の bodyについて

From: Nobuyoshi Nakada <nobu@...>
Date: 2018-05-15 12:53:35 UTC
List: ruby-list #50665
On 2018/05/15 20:56, Kazuhiro NISHIYAMA wrote:
> write で 2GiB以上だと EINVAL になっているだけのようなので、
> res.body 自体は正常なのではないでしょうか。

write(2) のERRORSを見ると、OSの制限のようです。

https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man2/write.2.html
>      In addition, writev() may return one of the following errors:
>      [EINVAL]           The sum of the iov_len values in the iov array overflows a 32-bit integer.

> Ubuntu 16.04 だと 2GiB の String を作ろうとした時点で NoMemoryError に
> なるようなので、別の話のようです。

NoMemoryErrorはリソースの問題なのでどうしようもないですが、Linuxでも
上限があるらしいことが write(2) のNOTESに書いてあります。

http://man7.org/linux/man-pages/man2/write.2.html#NOTES
>        On Linux, write() (and similar system calls) will transfer at most
>        0x7ffff000 (2,147,479,552) bytes, returning the number of bytes
>        actually transferred.  (This is true on both 32-bit and 64-bit
>        systems.)

-- 
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
    中田 伸悦

In This Thread