BUG Report / RFE

22 views
Skip to first unread message

frank....@gmail.com

unread,
Oct 4, 2019, 2:13:25 PM10/4/19
to JaCoCo and EclEmma Users
I tried submitting a bug report to https://github.com/jacoco/jacoco but I get the following message "An owner of this repository has limited the ability to open an issue from new users." so I will try here. If there is a better place to submit this bug let me know.

Bug / RFE

When running jacoco on an SMB file share I get the following message:

java.io.IOException: Operation not supported

at sun.nio.ch.FileDispatcherImpl.lock0(Native Method)

at sun.nio.ch.FileDispatcherImpl.lock(FileDispatcherImpl.java:94)

at sun.nio.ch.FileChannelImpl.lock(FileChannelImpl.java:1078)

at java.nio.channels.FileChannel.lock(FileChannel.java:1053)

at org.jacoco.agent.rt.internal_035b120.output.FileOutput.openFile(FileOutput.java:69)

...


This seems to be cause by defect JDK-8167023 (lock not supported) and likely fails for most network shares using AFP  / SMB from macOS. Note the JDK issue has been open over 3 years now and is unlikely to be fixed anytime soon.

I would like to suggest foregoing the lock when an IOException is detected instead of failing completely. Below is the code that is failing (yellow) with suggested changes (green).

public class FileOutput implements IAgentOutput {
...
private OutputStream openFile() throws IOException {
final FileOutputStream file = new FileOutputStream(destFile, append);
// Avoid concurrent writes from different agents running in parallel:
try {
file.getChannel().lock();
} catch(IOException e) {/* Proceed without lock */}
return file;
}

...

}

Evgeny Mandrikov

unread,
Oct 7, 2019, 1:45:28 PM10/7/19
to JaCoCo and EclEmma Users
Hi,


On Friday, October 4, 2019 at 8:13:25 PM UTC+2, frank....@gmail.com wrote:
I tried submitting a bug report to https://github.com/jacoco/jacoco but I get the following message "An owner of this repository has limited the ability to open an issue from new users." so I will try here. If there is a better place to submit this bug let me know.


Yes - we restrict interactions with GitHub repository for new accounts, because otherwise instead of sending questions to mailing list, many people use our bug tracker.

So thank you for message here.

 

Bug / RFE

When running jacoco on an SMB file share I get the following message:

java.io.IOException: Operation not supported

at sun.nio.ch.FileDispatcherImpl.lock0(Native Method)

at sun.nio.ch.FileDispatcherImpl.lock(FileDispatcherImpl.java:94)

at sun.nio.ch.FileChannelImpl.lock(FileChannelImpl.java:1078)

at java.nio.channels.FileChannel.lock(FileChannel.java:1053)

at org.jacoco.agent.rt.internal_035b120.output.FileOutput.openFile(FileOutput.java:69)

...


This seems to be cause by defect JDK-8167023 (lock not supported) and likely fails for most network shares using AFP  / SMB from macOS. Note the JDK issue has been open over 3 years now and is unlikely to be fixed anytime soon.

I would like to suggest foregoing the lock when an IOException is detected instead of failing completely. Below is the code that is failing (yellow) with suggested changes (green).

public class FileOutput implements IAgentOutput {
...
private OutputStream openFile() throws IOException {
final FileOutputStream file = new FileOutputStream(destFile, append);
// Avoid concurrent writes from different agents running in parallel:
try {
file.getChannel().lock();
} catch(IOException e) {/* Proceed without lock */}
return file;
}

...

}



However I seriously doubt that we can sacrifice correctness of concurrent access to file on support of network disks.
And ignoring of exceptions is not what we prefer, because this complicates diagnosis of problems for users and for us in case of questions from users.
So IMO the best what we can do - is to document this limitation and  advise you to not place file on a network device.

Marc, WDYT?



Regards,
Evgeny

Marc Hoffmann

unread,
Oct 7, 2019, 1:54:20 PM10/7/19
to jac...@googlegroups.com
Hi,

I agree with Evgeny here. We introduced file locking because we had many reports with broken exec files from concurrent access. I really don’t want to debug these issues again.

So for me this is a acceptable limitation. We can e.g. add it to the FAQ.

Regards,
-marc


-- 
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/2940e5b6-bf10-4e58-9a68-79d066e74d43%40googlegroups.com.

Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages