IndexOutOfBounds #20

Closed
johnbendi opened this Issue Mar 6, 2013 · 11 comments

Comments

Projects
None yet
5 participants

I can't get any useful information from this strace:

Although looking at utils.clj the implementation for quartile1 probably needs to be checked

java.lang.IndexOutOfBoundsException
RT.java:784 clojure.lang.RT.nthFrom
RT.java:753 clojure.lang.RT.nth
utils.clj:19 clj-stacktrace.utils/quartile1
utils.clj:36 clj-stacktrace.utils/fence
repl.clj:95 clj-stacktrace.repl/find-source-width
repl.clj:107 clj-stacktrace.repl/pst-on
repl.clj:123 clj-stacktrace.repl/pst-str
RestFn.java:408 clojure.lang.RestFn.invoke
stacktrace.clj:17 ring.middleware.stacktrace/wrap-stacktrace-log[fn]
stacktrace.clj:79 ring.middleware.stacktrace/wrap-stacktrace-web[fn]
jetty.clj:18 ring.adapter.jetty/proxy-handler[fn](Unknown Source) ring.adapter.jetty.proxy$org.eclipse.jetty.server.handler.AbstractHandler$0.handle
HandlerWrapper.java:111 org.eclipse.jetty.server.handler.HandlerWrapper.handle
Server.java:349 org.eclipse.jetty.server.Server.handle
AbstractHttpConnection.java:452 org.eclipse.jetty.server.AbstractHttpConnection.handleRequest
AbstractHttpConnection.java:884 org.eclipse.jetty.server.AbstractHttpConnection.headerComplete
AbstractHttpConnection.java:938 org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete
HttpParser.java:634 org.eclipse.jetty.http.HttpParser.parseNext
HttpParser.java:230 org.eclipse.jetty.http.HttpParser.parseAvailable
AsyncHttpConnection.java:76 org.eclipse.jetty.server.AsyncHttpConnection.handle
SelectChannelEndPoint.java:609 org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle
SelectChannelEndPoint.java:45 org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run
QueuedThreadPool.java:599 org.eclipse.jetty.util.thread.QueuedThreadPool.runJob
QueuedThreadPool.java:534 org.eclipse.jetty.util.thread.QueuedThreadPool$3.run
Thread.java:679 java.lang.Thread.run

Having observed this for a while I think what causes this is having a blank cljs file in the compilation pipeline makes the compiler go crazy and passes a crazy error along which clj-stacktrace is not able to handle properly. Try this and confirm if you can reproduce.

I ran into this today. I'm guessing that the quartile computations are off by one; the values returned should be decremented before being passed to nth. If coll only has one item, for instance, you'll get an error like the one above.

...or maybe a coll of 1 is a special case; I don't understand the intent of that code.

Contributor

jonpither commented May 31, 2013

I get this often. It's bit unfortunate there's a bug in the lib we use to print stacktraces of bugs.. :-)

Contributor

jonpither commented May 31, 2013

Am taking a look.. will report back

Contributor

jonpither commented May 31, 2013

Raised a pull-request for a defensive coding fix that makes the problem go away our end.

TBH I'm not sure why there isn't a :trace-elems in the cause, perhaps a deeper understanding of this might lead to a better fix.

Contributor

jonpither commented Jun 19, 2013

Any chance someone got to look at my pull-request? This is still an issue.

Collaborator

technomancy commented Jun 20, 2013

Yeah, sorry about the delay here. I've been ignoring clj-stacktrace in hopes that chouser's Longbottom lib is released, but it's starting to get a kind of Duke Nukem Forever vibe around it. But yeah, I can merge this and get a new version out; thanks for tracking down the problem.

Contributor

nahuel commented Aug 19, 2013

I got bitten by this using clojure.tools.trace with the latest Ring release. The following code raises a java.lang.ArithmeticException decorated with a big message that clj-stacktrace.repl/find-source-width can't handle, so an IndexOutOfBoundsException is raised. Versions used: [clj-stacktrace "0.2.5"] (included in [ring "1.2.0"]) and [org.clojure/tools.trace "0.7.5"].

(try
  (clojure.tools.trace/trace-forms
    (let [a (+ 1 1)
          b (* 2 2)
          c (* a b (/ 4 0))]
      c))
  (catch Exception e
    (clj-stacktrace.repl/pst-on *err* false e)    ;; wil throw IndexOutOfBoundsException
    ))
Contributor

nahuel commented Aug 19, 2013

This happens also with clj-stacktrace 0.2.6 after the patch from @jonpither , so I think this bug must be reopened.

Contributor

nahuel commented Aug 19, 2013

I re-opened this bug with an analysis in #26

xeqi added a commit to clojars/clojars-web that referenced this issue Aug 16, 2014

@xeqi xeqi referenced this issue in clojars/clojars-web Aug 17, 2014

Closed

clojars.org returns a blank page #235

zjhmale pushed a commit to zjhmale/clojars-web that referenced this issue Oct 3, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment