Monday, August 26, 2019

Getting a stack overflow running datomic Ion cast in cider

I was getting a StackOverflowError running this in CIDER while developing with Datomic Ions


(ns bug-demo
(:require [datomic.ion.cast :as cast]
[clojure.java.io :refer [output-stream]]))
(cast/initialize-redirect :stdout)
(cast/event {:msg "ShouldNotCauseAStackOverflowErrorInCider"})
view raw bug_demo.clj hosted with ❤ by GitHub
For some reason the output stream created ends up being referential with the nrepl PrintStream implementation. Changing it from :stdout to :stderr seems to solve the problem:
(ns bug-demo
(:require [datomic.ion.cast :as cast]
[clojure.java.io :refer [output-stream]]))
(cast/initialize-redirect :stderr) ; instead of :stdout
(cast/event {:msg "ShouldNotCauseAStackOverflowErrorInCider"})
view raw bug_fix.clj hosted with ❤ by GitHub

No comments: