New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.16.0 Pre-Release issues and discussion #197
Comments
One issue with rc1 is casting decimal header values to integers, which was possible in prior versions but throws a |
After a fair bit of struggle with github Actions, and getting it to use GPG without obscure errors, automated signed releases (SNAPSHOT and staged) seem to be working... One step closer to the official release of 1.16.0... |
I haven't so far managed to look at the 1.16.0 RC in detail, but the introduction of the new method |
@mbtaylor, that's exactly the sort of thing I was hoping to find out before the official release. :-) As for finding a resolution, the release is baselined for Java 8, which does not yet support default methods -- and at this point I'd be reluctant to bump it further up. But, I could work around it either by making it a static method or else by putting in somewhere where it is FITS-specific (since, really it's only an issue with Fits files...). I'll come up with something and release an rc3 next Monday... If you find more trip-ups in the meantime, let me know... |
OK, I think if I make it a static method |
Thank you, I haven't really grasped so far how But for the record I believe that java 8 (which I agree should be the target platform for this release) does support default methods; the following code compiles under java 8 for me:
|
You are right. For some reason I remembered default methods as having been introduced in Java 9 only... ;-). |
@mbtaylor, BTW, your change of adding |
Good point, thanks. |
Hello all, rc3 is now released for testing. Provided it fares well, let's aim for a 1.16.0 release in two weeks. If you want to run your own tests, but you will not be able to do it in the proposed time-frame, please communicate it here what (reasonable) timeline you require, and we'll adjust the plans accordingly. If new avoidable regressions are found, we'll keep making release candidates as long as needed, and push back the final release accordingly... |
One behaviour change has provoked a new failure in my unit tests: attempting to create a |
I still have some other unit test failures using 1.16.0-rc3, but I've run out of time to track them down. It's possible the problems result from bugs in my code. |
I agree that |
Hi @mbtaylor, I was wondering if you made progress on getting your code work with 1.16, or if you found any other avoidable regressions? Let me know if you need more time to sort things out, beyond next week... |
There is an error in my tests that I've tried hard to track down, but I've not been able to get to the bottom of it. I tried setting FitsFactory.setLongStringsEnabled(false) and the other backward compatibility settings discussed in #161, but that didn't fix it. A bisect identified the commit which introduced this failure as d29355e, which is the big one rewriting the I/O stream classes. It appears to be the case that following that commit some calls to BufferedDataInputStream.readByte() are throwing an EOFException when there should be still bytes in the stream; at least the same code path using versions prior to that commit finds bytes there. But whether it's the readByte call at fault or some earlier behaviour that's exhausting the stream, I can't be certain. It might be something else going wrong, or even workarounds for incorrect behaviour by the earlier implementation now doing the wrong thing. This behaviour is buried deep in unit tests that use other parts of my code, so it's not easy to extract a standalone example. Sorry not to be able to come up with something more transparent, but I really don't have time to look at this much more. |
Thanks Mark! I very much appreciate your efforts, and I think you may have given enough details for me to track it down. My guess is that it may be a mishandling of an underlying read() returning 0 in the new implementation. If so, that should be easy to track down and fix. I'll let you know when I have found the likely culprit, and we'll move on to an rc4 with it then. |
OK, I did find two instances where if a I also recall that the old versions of In any case, I'll prepare an rc4 with the fixes for the above mentioned read handling. I'll release it by Monday (or perhaps a bit before on Sunday). In the meantime, you can also check it out from my 1.16.0-rc4 branch if you want to take a quick look before then... |
Hi Mark! I think I can reproduce the error, but will spend some more time to understand it better... But, basically, it is public void testCloggedInputStream() throws Exception {
final Random random = new Random();
InputStream is = new InputStream() {
@Override
public int read() throws IOException {
throw UnsupportedOperationException("not implemented");
}
@Override
public int read(byte[] b, int from, int length) throws IOException {
int i = random.nextBoolean() ? 1 : 0;
System.out.print(i);
return i;
}
};
BufferedInputStream bis = new BufferedInputStream(is);
for(int i=0; i<10; i++) System.out.println(" -> " + bis.read());
in.close();
} The underlying |
As for your test code, I think you might be reading from a stream before something provides data into it, expecting the read to block. One way to work around would be that if you know more data is on the way, is to either catch the In general I think that best practice is avoid blocking reads in the library, since it can result in a program hang without giving the user a chance to do something about it. In that regard, throwing the exception is not a bad thing as it gives the control back to the user, who can then keep trying to read again, or else move on... Nevertheless, for backward compatibility I'll see if I can reinstate the blocking read with |
I think I found a workable solution, by delegating reads to the underlying input stream whenever the read of I think this should resolve your issue hopefully. If so, I'll aim for the 1.16 release on or around Dec 13, after giving rc4 a bit of time to discover any other lingering issues... |
@attipaci, thanks for your efforts so far. I haven't tried your solution yet, but I'm not sure I agree with your analysis. First, your test code violates the InputStream contract. From the
So you're not allowed to return a 0 from that method (unless len==0); the fact that you do may be the reason that BufferedInputStream is displaying unexpected behaviour. My code is reading from a stream that may not be ready; it's supplied from another thread which is decoding an input base64-encoded stream, so the data should be along eventually, but depending on thread scheduling it may or may not be ready when the read is initiated. I'm using |
Hi Mark! I don't disagree with you. But the fact is that Java's own |
The test code demonstrates |
Good point! I did not read the |
I undid the changes to |
Mark, Here is the old @Override
public int read(byte[] obuf, int offset, int length) throws IOException {
int total = 0;
int remainingToRead = length;
int currentOffset = offset;
while (remainingToRead > 0) {
// Use just the buffered I/O to get needed info.
int xlen = super.read(obuf, currentOffset, remainingToRead);
if (xlen <= 0) {
if (total == 0) {
throw new EOFException();
} else {
return total;
}
} else {
remainingToRead -= xlen;
total += xlen;
currentOffset += xlen;
}
}
return total;
} As you can see, it threw an @Override
public byte readByte() throws IOException {
return (byte) read();
} Which means, that if you have overwritten either of the |
I added a last-minute refactoring of the new (in 1.16) classes of |
rc4 is now out, pushing the final 1.16.0 release to December 13 or later (depending on how things go from here...) |
@attipaci sorry, but the behaviour in my tests has not changed much. I still see
when I believe there are bytes remaining (though not yet |
Hi Mark! I'm not too surprised. It would be good to track down where this comes from. As I mentioned, at this point I'm pretty sure the library does not throw an So, you could either try to diagnose why this happens in your code -- perhaps by a deriving a new We should try to conclude it either way this week (or maybe next). I'm not in a rush to release 1.16, but I also don't want to delay it unnecessarily... -- A. |
I just noticed that your exception originates from your own implementation of |
Ooops, I did find an issue with the |
Yes I can pull from your fork. |
Well, it's not as simple as I first thought... What caught my eye is that it is normal for |
Mark, in the meantime maybe you want to look at |
So, the best I could find so far is that the new if (got != toSkip) {
throw new EOFException("Reached end-of-stream after skipping " + got + " of " + toSkip);
} which would not handle negative arguments to |
No, I'm not calling |
Well, you could replace your |
Both of those signal end of file, so I suspect that something has gone wrong with earlier operations on the stream, but I can't work out what. It's possible that the older behaviour was wrong or that somehow or other there's something wrong in my code provoking the change of behaviour. I've tried hard to track down what's wrong and failed but I really can't spend more time on this. I don't want to hold up your release any longer. |
Hi Mark! That's my feeling about it too -- that the old version mishandled the EOF, and hid an underlying problem for you. But, I wanted to be sure (and in the meantime, I still found a few things that needed a bit of tweaking :-). The Thanks again for your efforts :-). I really appreciate your feedback and catching some of the problems I created... After the release, I'll be taking a break from nom-tam-fits lib for a while, but I'll be back for the next update or release (maybe I will try to adhere to a 6-month release cycle...). I hope you'll be back for more too! |
OK, I'll mention one other item. Since some of the method signatures have changed at this release, 1.16.0 does not function as a "drop-in" runtime replacement for 1.15.2. For instance, the following code will compile against either 1.15.2 or 1.16.0:
However if I compile it against 1.15.2 and then run it against 1.16.0-rc4, it fails with:
since the method signature that source call resolves to is different in the two versions ( |
True, and I have not thought much about drop-in replacements before. I'll be sure to comment on that in the release description. I'm not too worried about it though. Downstream software is either build from source(s), like in the case of Debian packages, or else the requisite jars are bundled with the app, to ensure that the versions are compatible. Drop-in replacements of shared libraries rarely work, as anyone who has ever tried drop-in replacing .so libs on Linux knows :-) |
Please feel free to use this ticket to note any issues you might encounter with any of the 1.16.0 release candidates, between now and the finalized 1.16.0 release (anticipated in a month or two perhaps).
The text was updated successfully, but these errors were encountered: