jenkinsci / lib-file-leak-detector

Java agent that detects file handle leak
http://file-leak-detector.kohsuke.org/
MIT License
241 stars 112 forks source link

Pipes are not detected correctly on Windows #36

Open dwnusbaum opened 6 years ago

dwnusbaum commented 6 years ago

While integrating version 1.11 into the Jenkins File Leak Detector Plugin, I found that pipes are not detected correctly on Windows. See https://github.com/jenkinsci/file-leak-detector-plugin/pull/3.

Test failure when running mvn integration-test on Windows 10 (all other tests pass):

testPipe(org.kohsuke.file_leak_detector.instrumented.PipeDemo)  Time elapsed: 0.004 sec  <<< FAILURE!
java.lang.AssertionError: No source channel record found
    at org.junit.Assert.fail(Assert.java:93)
    at org.junit.Assert.assertTrue(Assert.java:43)
    at org.junit.Assert.assertNotNull(Assert.java:526)
    at org.kohsuke.file_leak_detector.instrumented.PipeDemo.testPipe(PipeDemo.java:43)

It isn't immediately obvious to me why the AbstractSelectableChannel transformer isn't working. I traced the call chain for opening a Pipe on Windows but it looks like it should call the AbstractSelectableChannel constructor so maybe something else is going on.

I don't think this ever worked, so I guess it makes sense to treat it as a new feature.