bhauman / rebel-readline

Terminal readline library for Clojure dialects
Eclipse Public License 1.0
680 stars 37 forks source link

StackOverflowError when output a big string #161

Closed razum2um closed 6 years ago

razum2um commented 6 years ago

example steps to reproduce:

clojure -Sdeps "{:deps {com.bhauman/rebel-readline {:mvn/version \"0.1.3\"}}}" -m rebel-readline.main
user=> (->> (iterate inc 0) (take 10000) (clojure.string/join "\n"))
StackOverflowError   java.util.regex.Pattern$GroupTail.match (Pattern.java:4836)

The max length may vary. I hit this when reading a big line from file.

clojure.main prints line ok, so it's regexp-based (highlighting?) to blame (e.g. https://stackoverflow.com/questions/7509905/java-lang-stackoverflowerror-while-using-a-regex-to-parse-big-strings)

bhauman commented 6 years ago

Yeah should be able to fix this by detecting string size before highlighting

On Tue, Jun 12, 2018 at 12:59 PM, Vlad Bokov notifications@github.com wrote:

example steps to reproduce:

clojure -Sdeps "{:deps {com.bhauman/rebel-readline {:mvn/version \"0.1.3\"}}}" -m rebel-readline.main

user=> (->> (iterate inc 0) (take 10000) (clojure.string/join "\n")) StackOverflowError java.util.regex.Pattern$GroupTail.match (Pattern.java:4836)

The max length may vary. I hit this when reading a big line from file.

clojure.main prints line ok, so it's regexp-based (highlighting?) to blame (e.g. https://stackoverflow.com/questions/7509905/java-lang- stackoverflowerror-while-using-a-regex-to-parse-big-strings)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bhauman/rebel-readline/issues/161, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAKQEiQlkAiOYy4YoSOI1BGF5jA9I1Jks5t8B24gaJpZM4UlD53 .

bhauman commented 6 years ago

Actually this is not really a fix, but it falls back to regular printing when it hits the overflow condition.