clojure-dev

Issues: https://clojure.atlassian.net/browse/CLJ | Guide: https://insideclojure.org/2015/05/01/contributing-clojure/
rutledgepaulv 2020-03-19T18:26:48.134800Z

Hi all, I’ve been debugging a memory leak in my application and have traced it back to agent executor threads still referring to the state I’m maintaining in agents. I noticed that clojure.core/send-via uses clojure.core/binding-conveyer-fn which sets the thread local bindings but never pops them. Can someone help me understand why bound-fn* isn’t used instead so that any thread locals on agent executor threads are cleared when the agent is done processing the message? Related: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L2103-L2111 https://clojure.atlassian.net/browse/CLJ-1125 https://groups.google.com/forum/#!topic/clojure-dev/3CXDe8_9G58/discussion

rutledgepaulv 2020-03-19T18:54:17.137200Z

hmm, I see now that Toby hinted at the difficulty being that if the function that was sent to the agent throws an exception, the bindings are still expected to be set when caught by the error handler. if the sent function popped them then they wouldn’t be available anymore to the error handler