Xh4H / Discord.jl

The Julia Discord API Wrapper
MIT License
151 stars 23 forks source link

MbedTLS compatibility #9

Closed christopher-dG closed 6 years ago

christopher-dG commented 6 years ago

TLDR: HTTP requests don't work properly on MbedTLS 0.6.3, and the gateway connection doesn't work properly on newer versions.

With code like this:

julia> c = Client("token"); ch = retrieve(DiscordChannel, c, 1234567890);
julia> fs = map(i -> create(Message, c, ch; content=i), 1:50);

It's somewhat common to see a deadlock where one request grabs the rate limiter bucket lock and makes the request, then hangs, which holds up all the other requests. I've seen the requests go though after a few minutes of waiting which is weird (and I've confirmed that Discord's rate limiting has nothing to do with it). The really weird bit is that the request actually does reach Discord, i.e. a message is created, but the request still doesn't return. So I'm inclined to think that this could be a bug with HTTP.jl.

Xh4H commented 6 years ago

Should probably open an issue in HTTP.jl to make sure it's not a problem from our side.

christopher-dG commented 6 years ago

👍 I just want to get rid of any possibility that it's my own bug in the synchronization first.

christopher-dG commented 6 years ago

Okay so we have a bit of a dilemma: The problem here is caused by MbedTLS at 0.6.3. The latest version is 0.6.5, and the requests return consistently on that version. But the reason we're at 0.6.3 is that newer versions have an issue with the gateway that basically causes events to constantly lag behind by one. For example, if I start typing in a channel, you don't receive a TypingStart until I send the message. Then when I start typing again, you get the MessageCreate that you should have gotten before, and so on. I'll try to put together a bug report for MbedTLS, and keep trying different versions in the meantime.

christopher-dG commented 6 years ago

Filed https://github.com/JuliaWeb/MbedTLS.jl/issues/186