-
1. Re: [JCR Query] java.lang.IllegalArgumentException: The optimizationNanos argument value may not be negative
rhauch Jun 22, 2012 1:04 PM (in response to badr)1 of 1 people found this helpfulThat's an interesting problem! Our code is apparently so fast that the query optimization takes negative time!
Seriously, please log a bug in JIRA and we'll get it fixed right away. Those checks shouldn't be there, and we should be taking the absolute value of the difference. This likely varies by platform and is somewhat random because we're relying upon System.nanoTime() the elapsed time (e.g., before and after) operations that don't take much time, plus the way nanoTime works (the results are relative to some reference point in time, which may be in the future).
-
2. Re: [JCR Query] java.lang.IllegalArgumentException: The optimizationNanos argument value may not be negative
badr Jun 22, 2012 1:41 PM (in response to rhauch)1 of 1 people found this helpfulThanks Randall for the quick answer,
Yes your explanation really make sens and I've created a JIRA bug as you suggested to me : https://issues.jboss.org/browse/MODE-1536
Hope we will get fix soon in upcomming version.
-
3. Re: [JCR Query] java.lang.IllegalArgumentException: The optimizationNanos argument value may not be negative
badr Jun 22, 2012 1:50 PM (in response to badr)This is very nice to see the fix planned in 3.0.0.Beta1
Thanks a lot for this and please keep the hard work you are doing
-
4. Re: [JCR Query] java.lang.IllegalArgumentException: The optimizationNanos argument value may not be negative
rhauch Jun 22, 2012 1:58 PM (in response to badr)Thanks for logging that. I'm almost ready to merge a fix into the 'master' branch that should eliminate for all platforms the exception described, including potential exceptions at other points in the code where we were measuring duration using a similar technique.
-
5. Re: [JCR Query] java.lang.IllegalArgumentException: The optimizationNanos argument value may not be negative
badr Jun 22, 2012 2:04 PM (in response to rhauch)Great!
And do you know why the Thread keep the execution even if we do session.logout();? I should kill the process manually?
-
6. Re: [JCR Query] java.lang.IllegalArgumentException: The optimizationNanos argument value may not be negative
rhauch Jun 22, 2012 2:13 PM (in response to badr)And do you know why the Thread keep the execution even if we do session.logout();? I should kill the process manually?
IIUC, you call "session.logout()" on the session while the "query.execute()" is running? Generally, that's not a safe thing to do - although ModeShape is threadsafe, the JCR API does not require a session and the objects it returns to be threadsafe, and few (if any) other implementations are threadsafe.
However, the JCR API doesn't have a way to cancel execution, other than to perhaps interrupt the thread. However, that's something that we can probably add somewhat easily, with a "cancel()" method on the "org.modeshape.jcr.api.query.Query" interface. Note that since the calling thread is blocked, you'd have to call the "cancel()" method from another thread. If that's useful to you, please log an feature enhancement request for this feature.
-
7. Re: [JCR Query] java.lang.IllegalArgumentException: The optimizationNanos argument value may not be negative
rhauch Jun 25, 2012 12:08 PM (in response to rhauch)I logged the "cancel query" feature as MODE-1538, and justed committed the feature and resolved the issue. Look for it in the next release!
-
8. Re: [JCR Query] java.lang.IllegalArgumentException: The optimizationNanos argument value may not be negative
badr Jun 25, 2012 12:11 PM (in response to rhauch)Impressive ! you guys Rocks!
-
9. Re: [JCR Query] java.lang.IllegalArgumentException: The optimizationNanos argument value may not be negative
rhauch Jun 26, 2012 11:40 PM (in response to badr)This is now available in Alpha6: see the Query.cancel() method.
-
10. Re: [JCR Query] java.lang.IllegalArgumentException: The optimizationNanos argument value may not be negative
badr Jun 27, 2012 1:57 PM (in response to rhauch)Hi Randall,
We just tried with the Alpha 6 and after more than 20 successive attempts we get the same exception (in Windows XP)
I just reopen the issue with the same comment.
B.Regards
-
11. Re: [JCR Query] java.lang.IllegalArgumentException: The optimizationNanos argument value may not be negative
rhauch Jun 27, 2012 2:24 PM (in response to badr)Can you please paste the new stack trace? Perhaps we missed something and you're running into a different problem; the codepath in your original stack trace cannot possibly happen anymore, since we're passing the absolute value of the duration into the "withOptimizationTime()" method (see the code).
If you are getting a similar stack trace, please double check that you're using Alpha6.
-
12. Re: [JCR Query] java.lang.IllegalArgumentException: The optimizationNanos argument value may not be negative
badr Jun 28, 2012 3:31 AM (in response to rhauch)Hi Randall,
You were right, the exception is different and it's about
resultFormulationNanos argument value, may not be negative
instead of
The optimizationNanos argument value, -110669015, may not be negative
Here is the full stack trace showing the use of Alpha6 version also:
08:17:24,960 INFO Initializing ModeShape version 3.0.0.Alpha6
08:17:25,069 INFO ModeShape is using the following directory for transient storage of binary values: C:\DOCUME~1\G508652\LOCALS~1\Temp
08:17:25,382 INFO ISPN000128: Infinispan version: Infinispan 'Brahma' 5.1.2.FINAL
08:17:25,444 WARN ISPN000104: Falling back to DummyTransactionManager from Infinispan
08:17:26,178 INFO HSEARCH000034: Hibernate Search 4.1.1.Final
08:17:26,194 INFO HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
08:17:26,397 INFO HSEARCH000079: Serialization protocol version 1.0
- java.lang.IllegalArgumentException: The resultFormulationNanos argument value, -79658059, may not be negative
at org.modeshape.common.util.CheckArg.isNonNegative(CheckArg.java:225)
at org.modeshape.jcr.query.QueryResults$Statistics.withResultsFormulationTime(QueryResults.java:510)
at org.modeshape.jcr.query.process.QueryProcessor.execute(QueryProcessor.java:90)
at org.modeshape.jcr.query.process.QueryEngine.execute(QueryEngine.java:140)
at org.modeshape.jcr.query.lucene.LuceneQueryEngine$1.getResults(LuceneQueryEngine.java:149)
at org.modeshape.jcr.query.JcrQuery.execute(JcrQuery.java:119)
at org.modeshape.example.sequencing.TestQueryLanguageJcrSql2.main(TestQueryLanguageJcrSql2.java:109)
Thanks
-
13. Re: [JCR Query] java.lang.IllegalArgumentException: The optimizationNanos argument value may not be negative
rhauch Jun 28, 2012 9:25 AM (in response to badr)You're right ... looks like we missed at least one case. Thanks again.
-
14. Re: [JCR Query] java.lang.IllegalArgumentException: The optimizationNanos argument value may not be negative
badr Jun 28, 2012 9:30 AM (in response to rhauch)Great the stack trace heloped you to identify quickly the problem. But it's really after more than 20 successive attempts if this information will help also