You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Tim Ellison <t....@gmail.com> on 2007/10/23 12:09:02 UTC

[classlib][nio] FileChannel.tryLock() does not work on Linux

I'm bringing the conversation in HARMONY-4989 [1] over to the dev list,
go read that JIRA for the background...

The FileLock spec in Java 5 [2] is full of caveats about how the
underlying OS behavior comes through into Java.  There is a whole
section on platform dependencies.

The test case fails on Linux with Harmony, Sun 1.5, and IBM 1.5 (thanks
to Mark for checking these); but passes on Sun 1.6.  So in the first
instance it seems we are behaving like other 1.5 implementations.

The test itself breaks a warning in the spec, that "It is strongly
recommended that, within a program, a unique channel be used to acquire
all locks on any given file." presumably due to these this platform
behavior differences again.

My inclination at the moment is to mark this as won't fix.  But I'm
interested to hear alternative arguments.

[1] https://issues.apache.org/jira/browse/HARMONY-4989
[2] http://java.sun.com/j2se/1.5.0/docs/api/java/nio/channels/FileLock.html

Regards,
Tim

Re: [classlib][nio] FileChannel.tryLock() does not work on Linux

Posted by Tim Ellison <t....@gmail.com>.
Sian January wrote:
> No, sorry - I don't think there's a spec change, I was just thinking if the
> spec isn't clear then we should follow the RI.  But if you think we can take
> "using a unique channel is strongly recommended" to mean "using multiple
> channels is unsupported/undefined" then it probably is clear enough.

Not sure I'd describe it as 'clear' :-)  In this case, the RI behavior
changed between major releases without (AFAIK) the spec for that
behavior changing.  Maybe they introduced a bug rather than fixed one?!

Regards,
Tim

Re: [classlib][nio] FileChannel.tryLock() does not work on Linux

Posted by Sian January <si...@googlemail.com>.
No, sorry - I don't think there's a spec change, I was just thinking if the
spec isn't clear then we should follow the RI.  But if you think we can take
"using a unique channel is strongly recommended" to mean "using multiple
channels is unsupported/undefined" then it probably is clear enough.

Thanks,

Sian


On 23/10/2007, Tim Ellison <t....@gmail.com> wrote:
>
> Sian January wrote:
> > Are you suggesting not fixing this for 1.5, or not fixing at all?  I
> would
> > have thought we would want to fix it in 1.6 as Sun have fixed it there,
> but
> > I don't think not doing it in 1.5 would be a major problem.
>
> Well I don't see any relevant spec changes going from 1.5 to 1.6 in this
> area, so I'm unsure what Sun have 'fixed'.  If anyone can see a spec
> update that I'm missing then please point it out.
>
> i.e.  not sure yet how to proceed.
>
> Regards,
> Tim
>
>


-- 
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU

Re: [classlib][nio] FileChannel.tryLock() does not work on Linux

Posted by Tim Ellison <t....@gmail.com>.
Sian January wrote:
> Are you suggesting not fixing this for 1.5, or not fixing at all?  I would
> have thought we would want to fix it in 1.6 as Sun have fixed it there, but
> I don't think not doing it in 1.5 would be a major problem.

Well I don't see any relevant spec changes going from 1.5 to 1.6 in this
area, so I'm unsure what Sun have 'fixed'.  If anyone can see a spec
update that I'm missing then please point it out.

i.e.  not sure yet how to proceed.

Regards,
Tim


Re: [classlib][nio] FileChannel.tryLock() does not work on Linux

Posted by Sian January <si...@googlemail.com>.
Hi Tim,

Are you suggesting not fixing this for 1.5, or not fixing at all?  I would
have thought we would want to fix it in 1.6 as Sun have fixed it there, but
I don't think not doing it in 1.5 would be a major problem.

Thanks,

Sian


On 23/10/2007, Tim Ellison <t....@gmail.com> wrote:
>
> I'm bringing the conversation in HARMONY-4989 [1] over to the dev list,
> go read that JIRA for the background...
>
> The FileLock spec in Java 5 [2] is full of caveats about how the
> underlying OS behavior comes through into Java.  There is a whole
> section on platform dependencies.
>
> The test case fails on Linux with Harmony, Sun 1.5, and IBM 1.5 (thanks
> to Mark for checking these); but passes on Sun 1.6.  So in the first
> instance it seems we are behaving like other 1.5 implementations.
>
> The test itself breaks a warning in the spec, that "It is strongly
> recommended that, within a program, a unique channel be used to acquire
> all locks on any given file." presumably due to these this platform
> behavior differences again.
>
> My inclination at the moment is to mark this as won't fix.  But I'm
> interested to hear alternative arguments.
>
> [1] https://issues.apache.org/jira/browse/HARMONY-4989
> [2]
> http://java.sun.com/j2se/1.5.0/docs/api/java/nio/channels/FileLock.html
>
> Regards,
> Tim
>



-- 
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU