mamantoha / crest

HTTP and REST client for Crystal
https://mamantoha.github.io/crest/
MIT License
235 stars 14 forks source link

Crest v0.10.0 is buggy (?) #86

Closed mamantoha closed 2 years ago

mamantoha commented 6 years ago

shards-info with crest v0.10.1 randomly crash on Heroku about 1-2 times per hour :shit:

mamantoha commented 6 years ago

https://github.com/mamantoha/crest/commit/dc846c37a671f0f409cc95429e57362dfd7cb8d6?diff=unified#diff-3994e7f5f940813c595702c024b0e5f7R49

mamantoha commented 6 years ago

Crystal code to reproduce the issue:

require "http/client"
require "uri"

url = "https://api.github.com"
uri = URI.parse(url)
path = "/repos/crystal-lang/crystal"

headers = HTTP::Headers.new
headers.add("Accept", "application/vnd.github.mercy-preview+json")

client = HTTP::Client.new(uri)

resp = client.exec("GET", path, headers: headers)
puts resp.body

puts "Wait 2 minutes..."
sleep 2.minutes

resp = client.exec("GET", path, headers: headers)
puts resp.body
mamantoha commented 6 years ago

Adding this line fixes this issue:

client.compress = false

:tada:

mamantoha commented 6 years ago

Still exists in Crystal 0.25 :crying_cat_face:

mamantoha commented 6 years ago

Still exists in Crystal 0.26 :crying_cat_face:

mamantoha commented 5 years ago

Still exists in Crystal 0.29 :crying_cat_face:

jkthorne commented 5 years ago

should this issue be upstreamed to the crystal project?

mamantoha commented 3 years ago

Still exists in Crystal 1.1.0 :crying_cat_face:

cyangle commented 2 years ago

It seems like this has been fixed with the docker nightly build.

mamantoha commented 2 years ago

@cyangle still exists

crystal -v                
Crystal 1.3.0-dev [6ce66047c] (2021-12-07)

LLVM: 10.0.0
Default target: x86_64-unknown-linux-gnu
cyangle commented 2 years ago

@mamantoha Could you try it out with latest crystallang/crystal:nightly-alpine? It works for me.

# crystal -v
Crystal 1.3.0-dev [0f0852f33] (2021-12-08)

LLVM: 10.0.0
Default target: x86_64-unknown-linux-musl
cyangle commented 2 years ago

This bug seems to be fixed by https://github.com/crystal-lang/crystal/pull/12536

mamantoha commented 2 years ago

Fixed in Crystal 1.6.0 😸 🎉