Git Product home page Git Product logo

Comments (5)

JohnLCaron avatar JohnLCaron commented on May 23, 2024

My apologies, I obviously didnt get that refactor right. Its intermittent because it deals with the case of producing an uncompressed file, which it then leaves in place.

The logic is rather fiendish, probably we should roll the PR back until I can fix. Umm, how do you do that?

from netcdf-java.

lesserwhirls avatar lesserwhirls commented on May 23, 2024

No need to apologize! That's why we have tests :-) I can roll back just the nexrad changes, but I think I found the underlying problem. As part of your PR, you moved to using try-with-resource here:

try (RandomAccessFile outputRaf = new RandomAccessFile(ufilename, "rw")) {

Good stuff. Within that try-with-resource block, we acquire a lock. Cool. The whole try-with-resource block concludes with a finally:

} finally {
if (lock != null) {
lock.release();
}
} // try-with-resource
}

but by that point, we're out of the try block and the source has been closed, so the channel is closed and sad times ensue. The lock isn't valid anymore (lock.isValid() = false) by the time we do the null check, as it appears to get released when we move out of the try block, so maybe we don't need a finally block anymore? Or maybe add a log message in case we get there and the lock is still valid somehow?

} finally { 
  if (lock != null && lock.isValid()) { 
      log.error("Uncompresed file is closed but the lock is still valid. Why is you the way you is, file lock?");
  } 
} // try-with-resource 

from netcdf-java.

JohnLCaron avatar JohnLCaron commented on May 23, 2024

I dont understand then why it wouldnt fail every time?

from netcdf-java.

lesserwhirls avatar lesserwhirls commented on May 23, 2024

I think it's because the lock is only obtained when decompressing, otherwise lock=null. The test bombs out on the first file it encounters that needs to be decompressed.

from netcdf-java.

JohnLCaron avatar JohnLCaron commented on May 23, 2024

Ok, I have it in the debugger and I agree with your analysis. I think we could just ditch the finally block all together.

from netcdf-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.