# Strange Errno::EOVERFLOW error with IO#read and IO#sysread

**URL:** <https://www.ruby-forum.com/t/strange-errno-eoverflow-error-with-io-read-and-io-sysread/148431>\
**Category:** Ruby\
**Created:** [September 12, 2008, 7:34pm UTC](https://www.ruby-forum.com/t/strange-errno-eoverflow-error-with-io-read-and-io-sysread/148431 "2008-09-12T19:34:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [September 12, 2008, 7:34pm UTC](https://www.ruby-forum.com/t/strange-errno-eoverflow-error-with-io-read-and-io-sysread/148431/1 "2008-09-12T19:34:14Z")

</div>

Hi all,

Ruby 1.8.6 p114 (32-bit)  
Solaris 10

I’m reading binary data out of the /proc//as file on Solaris, and  
I’m hitting a curious overflow error on one process in particular:

# With IO#sysread

irb(main):010:0\> File.open("/proc/383/as"){ |fh| fh.sysread(4) }  
Errno::EOVERFLOW: Value too large for defined data type - /proc/383/as  
from (irb):10:in `sysread' from (irb):10 from (irb):10:in`open’  
from (irb):10

# With IO#read

rb(main):010:0\> File.open("/proc/383/as"){ |fh| fh.read(4) }  
Errno::EOVERFLOW: Value too large for defined data type - /proc/383/as  
from (irb):10:in `read' from (irb):10 from (irb):10:in`open’  
from (irb):10

Where pid 383 is:

UID PID PPID C STIME TTY TIME CMD  
root 383 1 0 07:14:42 ? 0:01 /usr/sfw/sbin/snmpd

This is the only pid in particular where this error occurs (out of  
about 80).

Any idea what’s happening here?

Thanks,

Dan

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [September 12, 2008, 7:48pm UTC](https://www.ruby-forum.com/t/strange-errno-eoverflow-error-with-io-read-and-io-sysread/148431/2 "2008-09-12T19:48:02Z")

</div>

On Sep 12, 2008, at 10:48 AM, Daniel B. wrote:

> Errno::EOVERFLOW: Value too large for defined data type - /proc/383/as  
> from (irb):10:in `open’  
> Any idea what’s happening here?
> 
> Thanks,
> 
> Dan

your programs are so powerful daniel - they’re overwhelming the  
system! maybe if you re-write in perl the system will be able to  
handle them.

😉

a @ [http://codeforpeople.com/](http://codeforpeople.com/)

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [September 12, 2008, 9:15pm UTC](https://www.ruby-forum.com/t/strange-errno-eoverflow-error-with-io-read-and-io-sysread/148431/3 "2008-09-12T21:15:33Z")

</div>

On Sep 12, 2008, at 11:28 AM, Daniel B. wrote:

> Regards,
> 
> Dan

/me kids

/dan needs more coffee 😉

a @ [http://codeforpeople.com/](http://codeforpeople.com/)

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [September 12, 2008, 9:15pm UTC](https://www.ruby-forum.com/t/strange-errno-eoverflow-error-with-io-read-and-io-sysread/148431/4 "2008-09-12T21:15:33Z")

</div>

On Sep 12, 11:11 am, “ara.t.howard” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > I’m hitting a curious overflow error on one process in particular:  
> > rb(main):010:0\> File.open(“/proc/383/as”){ |fh| fh.read(4) }
> 
> system! maybe if you re-write in perl the system will be able to  
> handle them.

Nope:

use strict;  
use warnings;

my $file = “/proc/383/as”;

open(FH, $file) or die $!;

my $buf = “”;

# Dies here with: Value too large for defined data type

read(FH, $buf, 4, 0) or die $!;

close(FH);

Regards,

Dan

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [September 12, 2008, 9:20pm UTC](https://www.ruby-forum.com/t/strange-errno-eoverflow-error-with-io-read-and-io-sysread/148431/5 "2008-09-12T21:20:53Z")

</div>

On Sep 12, 12:36 pm, “ara.t.howard” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > Nope:
> > 
> > # Dies here with: Value too large for defined data type
> 
> /dan needs more coffee 😉  
> As far as I can gather it’s a 32-bit largefile issue. The short  
> version is that a 32-bit Ruby (or Perl, or Python) will simply not be  
> able to read that file. The same code using a 64-bit Ruby works fine.

Well, except the part where my io-extra library segfaults on IO.pread  
in 64-bit mode, but nevermind that.

Regards,

Dan
