Skip to content

Instantly share code, notes, and snippets.

@benmoss
Last active August 29, 2015 14:15
Show Gist options
  • Save benmoss/79acf300d8d2ba573648 to your computer and use it in GitHub Desktop.
Save benmoss/79acf300d8d2ba573648 to your computer and use it in GitHub Desktop.
aleph/manifold resource leak
[aleph "0.4.0-beta2"]
[byte-streams "0.2.0-alpha8"]
[clj-tuple "0.1.7"]
[primitive-math "0.1.4"]
[io.aleph/dirigiste "0.1.0-alpha6"]
[io.netty/netty-all "4.0.25.Final"]
[manifold "0.1.0-beta9"]
[riddley "0.1.7"]
[org.clojure/tools.logging "0.3.1"]
[potemkin "0.3.11"]
[org.clojure/tools.trace "0.7.8" :scope "test"]
(ns weirdness
(:require [aleph.http :as http]
[byte-streams :as bs]
[clojure.tools.trace :as t]
[manifold.deferred :as d])
(:import (java.util.concurrent TimeoutException)))
(t/trace-vars aleph.http/create-connection)
(defn lookup [url]
(-> (d/timeout! (http/get url) 500)
(d/chain :body
bs/to-string
#(hash-map :body %))
(d/catch TimeoutException
(fn [e] {:error e :url url}))))
(comment
(lookup "http://foo.unreachable")
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment