Fork me on GitHub
#sci
<
2020-08-22
>
Kevin16:08:44

Interesting find on Edamame: I copied Clojure's core.clj (about 8k LOC) and commented most of it out. When I tried (e/parse-string-all (slurp "core.clj") {:all true :auto-resolve '{:current clojure.core}}) I got the following error: Execution error (StackOverflowError) at clojure.tools.reader.reader_types.StringReader/read_char (reader_types.clj:51).

Kevin16:08:32

It's not a problem for me, I'll just remove what I commented out. But should I open an issue for this anyway?

borkdude17:08:57

@kevin.van.rooijen That's weird, since parsing clojure.core is part of the unit tests

Kevin17:08:27

It only happens when I comment (most) of the code

borkdude17:08:57

comment = ;; ?

borkdude17:08:14

So less code and then a stackoverflow happens?

borkdude17:08:17

That's even more weird

borkdude17:08:15

If you can make the smallest repro possible we could take a look

Kevin17:08:32

I'll take a look

Kevin17:08:14

It happens at about 3k lines of comments

Kevin17:08:24

Not sure if it's memory bound or something

borkdude17:08:17

aha, so maybe there's something with the comment parsing

Kevin17:08:26

I think so yes

Kevin17:08:36

Probably if there's x amount of comments in a row

Kevin17:08:54

If I uncomment everything, it works as expected

Kevin17:08:15

It's a real edge case though. Having 3k lines of comments doesn't happen very often

borkdude17:08:29

ok cool. that's sufficient as a repro then, just post an issue and I'll take a look. what happens if you put one form in between?

Kevin17:08:32

Also I just checked, it has to be 3k in a row

Kevin17:08:42

If I put any expression in between it works as expected

borkdude17:08:48

That's probably hitting at stack depth limit of 3k then

borkdude18:08:47

You can try upping the stack limit to see if that helps: clojure -J-Xss4m

Kevin18:08:50

I'll create an issue on GH. No rush from me whatsoever though

Kevin18:08:55

Yeah, now it does work

borkdude18:08:16

Can you try with be8fc889656668ffba61547ff58009ee090cb51b and the original stack depth?

Kevin18:08:49

Let me try

Kevin18:08:25

That seems to fix it

Kevin18:08:20

I wrote it as fast as I could, in the fear of you writing the test before me