wojtekmach/req

Mint.TransportError - socket closed

Opened this issue · 2 comments

(Mint.TransportError) socket closed\\n (req 0.4.8) lib/req.ex:1029: Req.request!/

It's quite hard to find a repro for this bug it's frequent enough that it shows up regularly on my Oban jobs and even when running code in iex -S mix phx.server. To fix I just need to re-run it, or let the Oban job retry.

image

Any ideas why this would happen so frequently? Again, I appreciate it's hard to debug without more repro steps but happy to figure out how to find that repro case!

Urls where this happens:

OpenAI's API, HowLongtoBeat's API, Target's RedSky API.

I can quite easily replicate this issue. Just reload the module that makes a Req request in an iex session. For me, after the code reload, I get socket closed.

For anyone running into this issue, please see sneako/finch#273 (comment), you can test it by setting Finch dependency to:

{:finch, github: "keathley/finch", branch: "handle-idle-connections", override: true}