core-async

souenzzo 2021-01-05T00:01:50.327800Z

Hello I'm getting a wired Error handling response - class java.lang.StringIndexOutOfBoundsException: start 95, end 92, length 115 It happens SOMETIMES (~10%) when I run a deftest. Inside this deftest has a async/thread. Looking at visualVM I have a stable count of 19 threads. There is no new dead/respawn threads then it occurs (looking just at visualvm graphs) I addeded an uncaught-exceptions-handler as in https://stuartsierra.com/2015/05/27/clojure-uncaught-exceptions But looks like that it has no effect. How can I debug this?

2021-01-05T00:08:48.328400Z

@souenzzo so you aren't getting a stack trace or anything?

souenzzo 2021-01-05T00:09:12.328900Z

No, just a single-line msg in my stderr

2021-01-05T00:10:00.329900Z

my first instinct would be to wrap the body of the async/thread in (try ... (catch Exception e (println e))) - that will show the clojure print value for the exception including the stack

2021-01-05T00:21:45.330400Z

are you using http://netty-socket.io?

2021-01-05T00:25:21.331Z

this is sort of out of left field, and I only jumped on it because that vaguely reminds me of a unicode decoding bug in that

2021-01-05T00:25:34.331200Z

ah

2021-01-05T00:25:45.331500Z

actually you must be using the Xi editor

2021-01-05T00:26:23.332300Z

that error is from the editor, not from clojure, it is sending some code to clojure to run, and getting back the exception instead of what it expects

2021-01-05T00:35:15.333400Z

anyway, it looks you have two errors jammed together:

2021-01-05T00:39:03.336600Z

1. you have a client and server (client is the editor, server is the language server or repl or whatever) 2. the client is sending a command or some code to the server 3. the server is throwing an error, the string out of bounds exception 4. the server is reporting the error to the client as something like (str ex) 5. the client on getting the class java.lang.StringIndexOutOfBoundsException: start 95, end 92, length 115 is reporting the error to you

2021-01-05T00:39:57.337600Z

so "class java.lang.StringIndexOutOfBoundsException: start 95, end 92, length 11" is the error being generated on the server and "Error handling response -" is something the client is tacking on to the front of it

2021-01-05T00:40:23.337900Z

user=> (subs "" 0 1)
Execution error (StringIndexOutOfBoundsException) at java.lang.String/checkBoundsBeginEnd (String.java:3734).
begin 0, end 1, length 0
user=> (str *e)
"java.lang.StringIndexOutOfBoundsException: begin 0, end 1, length 0"
user=>

souenzzo 2021-01-05T01:24:30.340300Z

Thnk you all. I think that it's something with middlewares and somehow related to midje report. It only occur when #midje fact try to report an error !!?? I'm OK with it. I will not debug anymore. Sorry and thanks. I'm sure that I learned new things with these comments.