IndexOutOfBounds #20

johnbendi opened this Issue Mar 6, 2013 · 11 comments


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 clojure.lang.RT.nthFrom 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 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 org.eclipse.jetty.server.handler.HandlerWrapper.handle org.eclipse.jetty.server.Server.handle org.eclipse.jetty.server.AbstractHttpConnection.handleRequest org.eclipse.jetty.server.AbstractHttpConnection.headerComplete org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete org.eclipse.jetty.http.HttpParser.parseNext org.eclipse.jetty.http.HttpParser.parseAvailable org.eclipse.jetty.server.AsyncHttpConnection.handle$ org.eclipse.jetty.util.thread.QueuedThreadPool.runJob org.eclipse.jetty.util.thread.QueuedThreadPool$

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.


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.. :-)


jonpither commented May 31, 2013

Am taking a look.. will report back


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.


jonpither commented Jun 19, 2013

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


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.


nahuel commented Aug 19, 2013

I got bitten by this using 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"].

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

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.


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 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