Java Virtal Machine.net

[ News ] rss

March 20, 2010

Day 1 - Ruby Conf India 2010. Content available at: http://blogs.sun.com/arungupta/entry/day_1_ruby_conf_india

More »

March 20, 2010

Do you execute ops in bulks or one by one?. Last bunch of the entries have been all about the code. Today let's try something different. Partly because at the time of writing I'm just 34 thousand feet above Atlantic and really don't feel like coding anything, but partly also bec...

More »

March/2010
SunMonTueWedThuFriSat
 1 2 3 4 56
7 8 9 10 11 12 13
1415 16 17 18 19 20
21 222324252627
28293031   

[ Archives News
for 'Java Technology' ]

home > news > java technology > when long is not long enough

When long is not long enough

Yesterday, a Hudson committer Alan Harder discovered an EOFException in Hudson, which only happens on 64bit JVM on Solaris. This was happening in the part of Hudson (or more precisely, in a separate library called Akuma) where we look at the memory space of the process to figure out the command line arguments of the current process (the /proc/ID/as file — an equivalent of /proc/ID/mem in Linux) It turns out that the problem was because this sparse file is 264 bytes long on 64bit systems. So for Hudson to look at arbitrary positions in the process memory space, it needs be able to seek beyond Long.MAX_VALUE (263-1.) Java's RandomAccessFile has the seek(long) method, but it uses long as a signed value (as it should), so this won't do it. Alan suggested that we first seek to 263-1 and then call skipBytes repeatedly till we get to where we want. This won't do it either, unfortunately, because skipBytes takes int. I'd have to call this method for close to 232 times in the worst case! (And it turns out that internally RandomAccessFile keeps the file offset in a single long field, so it just can't address anything above 263-1 anyway.) So to do this, I had to go back to libc, namely fseek. It still uses a signed long, but with fseek, one could say "move ahead by 263-1 from the current position", so in the worst case, it takes up to 3 seeks to get to where I want, but I was finally able to fix the problem tha...


Date: September, 17 2009
Url: http://www.java.net/blog/kohsuke/archive/2009/09/17/when-long-not-long-enough


Others News

1 Comments to "When long is not long enough" »

I think, this is absolutely true. When the long is not long enough, it's means still so much distance have remained as vacant to drive.
Comment by yohimbe — December 11, 2009

Leave a Reply

Name (required)
Mail (will not be published) (required)
Website
You don't see letters?

Enter the code shown above (required)


Related

  • LongLongHoneymoon.com | Get hitched. On our Long Long Honeymoon, we’ve enjoyed our share of rustic camping locations. Places like Yellowstone, the Grand Canyon, and Glacier National Park come to mind.
©2002-2008Java-Virtual-Machine.net