httpoison icon indicating copy to clipboard operation
httpoison copied to clipboard

{:error, %HTTPoison.Error{id: nil, reason: "closed"}}

Open lypborges opened this issue 6 years ago • 14 comments

I’m getting a strange error in HTTPoison. When I do two request to a server “A” in the second I get connection close.

HTTPoison.get("http:/urla.com", [], [ ssl: [{:versions, [:'tlsv1.2']}] ,  hackney: [pool: :mypool],  max_connections: 1000])

When I do this with other server it works.

HTTPoison.get("http:/google.com", [], [ ssl: [{:versions, [:'tlsv1.2']}] ,  hackney: [pool: :mypool],  max_connections: 1000])

So I think it was a error on the server “A” , so a did a manual call with curl 20 times and all work perfect in the server “A” and “B”.

curl http://urla.com\?\[1-20\]

I tried with another lib and the server respond with no error.

HTTPotion.get("http:/urla.com")

I also tried with the default options and with the options above [ ssl: [{:versions, [:'tlsv1.2']}] , hackney: [pool: :mypool], max_connections: 1000]. But I get the same error. Any tip what could be the error?

lypborges avatar Apr 22 '18 23:04 lypborges

I had a similar error, looks like is this hackney issue: #475

Updating hackney with mix deps.update hackney worked for me.

atelles avatar May 04 '18 20:05 atelles

I'm having the same issue and deps.update hackney didn't help. It isn't https url.

dlameri avatar Jun 22 '18 17:06 dlameri

@lypborges have you found a solution?

kaminooni avatar Aug 16 '18 14:08 kaminooni

I have the same issue elixir 1.7.1 OTP 21 erts 10.0. None of the workarounds are working for me.

willfore avatar Aug 16 '18 17:08 willfore

@kaminooni no. Not yet. I had to change the lib. ;(

lypborges avatar Aug 18 '18 00:08 lypborges

Having the same issues with non-tls URLs (locally over to couchdb), elixir 1.6.5 with OTP 20 and elixir 1.7.3 with OTP 21.

HTTPoison v1.3.0 & hackney v1.14.0

alappe avatar Sep 14 '18 15:09 alappe

Does anyone have any new information on this?

jpiepkow avatar Oct 10 '18 23:10 jpiepkow

Tried the README suggestion to update HTTPoison calls with:

HTTPoison.get!(url, headers, [ ssl: [{:versions, [:'tlsv1.2']}] ])

No luck. Throwing a parsing error in production.

jakecurreri avatar Oct 14 '18 01:10 jakecurreri

^FYI I added that line and updated :httpoison mix deps.update httpoison. Worked perfectly in production afterward.

jakecurreri avatar Oct 19 '18 15:10 jakecurreri

Similar issue for me, that's easy to recreate on:

  • Erlang/OTP 21 [erts-10.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]
  • Elixir 1.7.4 (compiled with Erlang/OTP 20)
  • {:httpoison, "1.5.0"}

The first request to {:ok, %HTTPoison.Response{body: body}} = HTTPoison.get("https://www.mundartpodcast.at/feed/mp3/") always ends up with an empty body, the second one with a truncated (incomplete) body, interestingly enough at's always truncated at the same character.

Setting tlsv to 1.2 does not change anything. requests via wget on the same machine are always successful.

haslinger avatar Dec 20 '18 06:12 haslinger

Any update on this issue? I am facing the same?

utf4 avatar Jun 05 '19 19:06 utf4

still facing the same issue.

ijunaid8989 avatar Jun 12 '20 05:06 ijunaid8989

even with the update of hackney, the issue is the same.

ijunaid8989 avatar Oct 28 '20 19:10 ijunaid8989

I had the same issue, what happened is that there was an \r\n in the middle of the URL, removing it resolved my problem.

thiagopromano avatar Nov 16 '20 19:11 thiagopromano