|
I can confirm this bug.
I use Derby 10.3.2.1. and Hibernate 3.2.5ga. My page size was 30. I was only able to display 10 pages (so records 1-300). Everything beyond that resulted in empty list. Table which was queried contains more than 50000 records. I used EmbeddedDriver. After switching to ClientDriver the pagination works perfectly. I was also using the EmbeddedDriver when I encountered this problem. Sorry that I haven't had a chance to put together a simple reproduction case.
Martin, are you able to provide any answer to the questions I raised before?
Can you reliably reproduced this error? If so, would you be able to do the tracing I suggested? It would be very helpful in trying to reproduce this so we can fix it! Thanks, Dag Interesting that it works correctly with the client driver, thanks.
Michael Lossos made changes - 16/Apr/08 04:37 PM
I've created a reproduction case for this bug. To answer the earlier questions:
a) Is the scrollable result set also updatable? -- I don't think so but I'm not sure. b) Do you use the Derby network client driver or do you run embedded Derby? -- Embedded. c) Do the rows in OURTABLE contain any LOB objects (LOBS, CLOBS)? -- No LOBs. I noticed while creating the reproduction case that Derby's scrollable results work when using the Hibernate connection pool but fail with the c3p0 connection pool. This makes the bug look suspiciously like a bug in c3p0 and not in Derby. However, when I use c3p0 with hsqldb (in memory), I do not see the scrollable result set problem. Furthermore, c3p0 works fine with Derby 10.2.2.0 but fails with Derby 10.3.2.1. (You can see this by dropping in the different derby jars and running the repro case again.)
Dag, I appreciate you looking into this. Great, thanks for the repro, Michael! I downloaded Hibernate today and starting fiddling
with an example to try to approximate your use case, but the repro will save me from guesswork! This thread mentions a bug seen when running with c3p0:
http://www.nabble.com/ERROR-08000:-Connection-closed-by-unknown-interrupt-td16060173.html It may possibly be related. Micael, can you have a look at derby.log and see if there any stack traces similar that in the thread? Meanwhile I am working on getting the repro to run. I'm not seeing any errors in my derby log when:
derby.language.logStatementText=true derby.stream.error.logSeverityLevel=0 Though connections being closed and not being re-opened seems a likely culprit. As I said initially, you can hold all other things constant and only change Derby from 10.2.2.0 to 10.3.2.1 to get this error. I am now able to reproduce the error using the provided repro, using Derby head of trunk and Hibernate 3.2.6
I also see it working with 10.2.1.6. Thanks Michael! The patch the changes the behavior of Derby such that it starts to fail on this test (not saying that there is a Derby errror yet), is svn revision 540921 (
across Activation executions). Earlier it works and later it fails consistently. I won't be able to work on this issue for about two weeks. If someone else wants to pick it up, feel free
This one-liner patch seems to fix the problem.
When reuse of sets was introduced in ScrollInsensitiveResultSets, the openCore method has to correctly reinitialize the result set object, but ScrollInsensitiveResultSet#maxRows must have fallen through the cracks. It does not get reset, so it will effectively inherit the value first usage. In the app, the first time a scroll insensitive result set is used, the max is 200 (the second "page" uses absolute positioning to pos 100). Then, when the third page reuses the rs, the activation has a maxRows value of 300, but the rs does not pick this up and the error ensues, since next will not return more rows beyond 200. I have not run regression tests.
Dag H. Wanvik made changes - 20/Apr/08 05:07 PM
Dag H. Wanvik made changes - 20/Apr/08 05:08 PM
Thanks for the patch! Is more work needed to incorporate this into the next Derby release?
I'm running the existing regression tests, and I also want to try writing a new simple regression test for the problem.
All tests ran without failures (revision 650042M).
derbyall: 269 Tests Run 100% Pass (269 tests passed) 0% Fail (0 tests failed) 0 Suites skipped suites.All: OK (9864 tests) FYI I wrote the repro case in a way that should be fairly easy to adapt into a unit test (though I'm not familiar with the Derby test setup). Might be worth adding so any breakages in the scrollable result sets can be caught in the future.
'derby-3397-2a-junit_reg_test.diff' adds two simple JUnit regression tests that fail without the patch and succeeds with it.
Please review, I plan to commit the patch and the tests shortly.
Kristian Waagan made changes - 22/Apr/08 09:22 AM
Updated affects versions.
The fix should probably go into trunk, then be backported to 10.4 and 10.3. Downgraded priority to major, as the problem is now well understood, there is at least one workaround (causing performance degradation though) and it mostly affects environments doing pagination.
Kristian Waagan made changes - 22/Apr/08 09:33 AM
The fix looks correct, and I have verified that the tests expose the bug. +1 to commit.
Thanks for the help, Kristian, I was travelling the last two days! Test looks good, too.
+1 to commit. +1 to backport to 10.3 and 10.4 as well. Thank you all for fixing this.
+1 for backport
Committed 'derby-3397.diff' to trunk with revision 650783 and 'derby-3397-2a-junit_reg_test.diff' to trunk with revision 650786.
Thanks to all who contributed on this issue, especially the users following up :) The revisions merge cleanly to 10.3 and 10.4, but I will wait some days before I backport them.
Kristian Waagan made changes - 23/Apr/08 08:48 AM
Will these changes be backported to 10.3 and 10.4? We're waiting on our Derby upgrade until a release comes out with this fix. Cheers!
I'm re-running the tests, but the regression test didn't build on 10.3. I'm not sure if I have the time to look at that right now, but I plan to backport the fix to both 10.3 and 10.4, and the test to 10.4 in a few hours.
Hopefully it will make it into the upcoming 10.3 update release.
Backported the fix and test to 10.4 with revision 652656 and the fix only to 10.3 with revision 652657. I did not backport the test to 10.3 because some code related to the JUnit test framework did not compile. Should be easy to correct, but I want the fix in before the imminent 10.3 update release is produced.
All regression tests ran cleanly for both 10.3 and 10.4. Resolving issue, leaving it up to the reporter to close when the fix has been confirmed.
Kristian Waagan made changes - 01/May/08 08:54 PM
Thanks very much! I will close this out after I've verified it in the next 10.3 release.
Rick Hillegas made changes - 04/Aug/08 08:24 PM
Myrna van Lunteren made changes - 04/May/09 06:22 PM
Dag H. Wanvik made changes - 30/Jun/09 03:55 PM
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
using Hibernate) it would help a lot!
I am not familiar with the Hibernate mapping, so it would be nice if you could trace
the relevant SQL being executed here (server traceing):
by setting derby.language.logStatementText=true
and derby.stream.error.logSeverityLevel=0
The trace output can be found in derby.log; it would be helpful if you could attach that trace to this issue.
a) Is the scrollable result set also updatable?
b) Do you use the Derby network client driver or do you run embedded Derby?
If you use the client driver, you could trace there also, see
http://db.apache.org/derby/docs/10.3/adminguide/cadminappsclienttracing.html
c) Do the rows in OURTABLE contain any LOB objects (LOBS, CLOBS)?