Re: RFR 4823133: RandomAccessFile.length() is not thread-safe

2015-12-19 Thread Dmitry Samersoff
Vyom, I did some tests and the problem mentioned below is not relevant to Java. I can't reproduce it with Java testcase. Sorry for a noise. -Dmitry On 2015-12-18 23:42, vyom wrote: > Hi Dmitry, > > thanks for the review can you please explain little bit more, as per my > testing and implementa

Re: RFR 4823133: RandomAccessFile.length() is not thread-safe

2015-12-18 Thread Martin Buchholz
On Fri, Dec 18, 2015 at 5:35 AM, Magnus Ihse Bursie wrote: > On 2015-12-15 18:25, Martin Buchholz wrote: >> >> _FILE_OFFSET_BITS is generally an all-or-nothing thing, because it >> affects interoperability between translation units. It would be good >> to convert all of the JDK build to use -D_FI

Re: RFR 4823133: RandomAccessFile.length() is not thread-safe

2015-12-18 Thread vyom
Hi Dmitry, thanks for the review can you please explain little bit more, as per my testing and implementation i did not found any differences with fix and without fix. Even i checked the java.io.File.length() and there also it looks like we are using stat64(). as per you mail i truncate the

Re: RFR 4823133: RandomAccessFile.length() is not thread-safe

2015-12-18 Thread Magnus Ihse Bursie
On 2015-12-15 18:25, Martin Buchholz wrote: _FILE_OFFSET_BITS is generally an all-or-nothing thing, because it affects interoperability between translation units. It would be good to convert all of the JDK build to use -D_FILE_OFFSET_BITS=64, but that would be a big job. So traditionally the JD

Re: RFR 4823133: RandomAccessFile.length() is not thread-safe

2015-12-18 Thread Dmitry Samersoff
Vyom, If I read the changes correctly, current code returns result of lseek() but your code returns result of fstat(). I'm not sure it's a correct replacement. dooku:test#truncate --size=102400 test.me dooku:test#./test STAT: 102400 0 Success SEEK: 2 0 Success Moreover, if you truncate a file

Re: RFR 4823133: RandomAccessFile.length() is not thread-safe

2015-12-18 Thread Daniel Fuchs
Hu Vyom, On 17/12/15 17:58, Martin Buchholz wrote: Looks good! Since you got Martin's blessing I will sponsor this and push it for you :-) best regards, -- daniel On Thu, Dec 17, 2015 at 12:14 AM, vyom wrote: Hi Martin, thanks for review, i undated the webrev(http://cr.openjdk.java.net

Re: RFR 4823133: RandomAccessFile.length() is not thread-safe

2015-12-17 Thread Martin Buchholz
Looks good! On Thu, Dec 17, 2015 at 12:14 AM, vyom wrote: > Hi Martin, > > thanks for review, i undated the > webrev(http://cr.openjdk.java.net/~vtewari/4823133/webrev0.2/ > ) as per your > comment after confirming that the corresponding "

Re: RFR 4823133: RandomAccessFile.length() is not thread-safe

2015-12-17 Thread vyom
Hi Martin, thanks for review, i undated the webrev(http://cr.openjdk.java.net/~vtewari/4823133/webrev0.2/ ) as per your comment after confirming that the corresponding "fd" if opened with "open64". Thanks, Vyom On Thursday 17 Decem

Re: RFR 4823133: RandomAccessFile.length() is not thread-safe

2015-12-16 Thread Martin Buchholz
Calling naked fstat without _FILE_OFFSET_BITS=64 is a bug. Don't you need to call fstat64 if it's available? +jlong +handleGetLength(FD fd) +{ +struct stat sb; +if (fstat(fd, &sb) == 0) { +return sb.st_size; +} else { +return -1; +} +} On Wed, Dec 16, 2015 at 5:02

Re: RFR 4823133: RandomAccessFile.length() is not thread-safe

2015-12-16 Thread vyom
Hi, Updated the webrev(http://cr.openjdk.java.net/~vtewari/4823133/webrev0.1/ ) as per Martin review comment removed the _FILE_OFFSET_BITS from source. Thanks, Vyom On Tuesday 15 December 2015 10:55 PM, Martin Buchholz wrote: _FILE

Re: RFR 4823133: RandomAccessFile.length() is not thread-safe

2015-12-16 Thread vyom
Hi All, Please find the updated webrev(http://cr.openjdk.java.net/~vtewari/4823133/webrev0.1/ ). I incorporated the review comments by Roger Riggs. Thanks, Vyom On Tuesday 15 December 2015 10:01 PM, Roger Riggs wrote: Hi Yvom, Min

Re: RFR 4823133: RandomAccessFile.length() is not thread-safe

2015-12-15 Thread Martin Buchholz
_FILE_OFFSET_BITS is generally an all-or-nothing thing, because it affects interoperability between translation units. It would be good to convert all of the JDK build to use -D_FILE_OFFSET_BITS=64, but that would be a big job. So traditionally the JDK has instead used the functions made availabl

Re: RFR 4823133: RandomAccessFile.length() is not thread-safe

2015-12-15 Thread Roger Riggs
Hi Yvom, Minor comments: src/java.base/share/native/libjava/RandomAccessFile.c: - "length fail" might be clearer as "GetLength failed" src/java.base/unix/native/libjava/io_util_md.c: - Please add a comment before the define of FILE_OFFSET_BITS to indicate where it is used and why it is ther

Re: RFR 4823133: RandomAccessFile.length() is not thread-safe

2015-12-10 Thread Vyom Tewari
+nio-dev On 12/10/2015 5:54 PM, David Holmes wrote: Hi Vyom, Should this be reviewed by the NIO folk? It isn't obvious whether this change impacts the interaction with the associated FileChannel - see also https://bugs.openjdk.java.net/browse/JDK-6371642 Thanks, David On 10/12/2015 8:52 PM

Re: RFR 4823133: RandomAccessFile.length() is not thread-safe

2015-12-10 Thread David Holmes
Hi Vyom, Should this be reviewed by the NIO folk? It isn't obvious whether this change impacts the interaction with the associated FileChannel - see also https://bugs.openjdk.java.net/browse/JDK-6371642 Thanks, David On 10/12/2015 8:52 PM, vyom wrote: Hi All, Please review my changes for b

RFR 4823133: RandomAccessFile.length() is not thread-safe

2015-12-10 Thread vyom
Hi All, Please review my changes for below bug. Bug: JDK-4823133 : RandomAccessFile.length() is not thread-safe Webrev:http://cr.openjdk.java.net/~vtewari/4823133/webrev0.0/ This change ensure that length() does not temporarily chan