cch1 / http.async.client

Async Http Client - Clojure
http://cch1.github.com/http.async.client
267 stars 40 forks source link

Empty response body cannot be dereferenced in :completed handler #69

Closed pbostrom closed 8 years ago

pbostrom commented 8 years ago

For example, the following async request will return an empty response body, which will cause the specified :completed handler to hang forever:

(execute-request client (prepare-request :get "http://localhost:8123/empty")
                 :completed (fn [response] @(:body response)))

Under the netty async http provider, this has the additional effect of tying up the run() loop in AbstractNioSelector: https://github.com/netty/netty/blob/netty-3.10.4.Final/src/main/java/org/jboss/netty/channel/socket/nio/AbstractNioSelector.java#L207 which will ultimately cause any calls to close the async client to hang forever.

cch1 commented 8 years ago

Looking forward to a PR that will deliver an empty body before the completed callback is invoked.

pbostrom commented 8 years ago

Fixed in 5f8768a

cch1 commented 8 years ago

Thanks Paul!