Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mint.TransportError - socket closed #312

Open
sergiotapia opened this issue Feb 24, 2024 · 5 comments
Open

Mint.TransportError - socket closed #312

sergiotapia opened this issue Feb 24, 2024 · 5 comments

Comments

@sergiotapia
Copy link

(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.

@jozuas
Copy link
Contributor

jozuas commented Mar 8, 2024

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.

@wojtekmach
Copy link
Owner

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}

@sergiotapia
Copy link
Author

This is still happening very frequently. I'm calling Req.post from Oban jobs and it happens quite a lot.

Req.post(@base_url,
  headers: headers,
  json: body
)

"** (Req.TransportError) socket closed
    (req 0.5.6) lib/req.ex:1092: Req.request!/2

@mrkaspa
Copy link

mrkaspa commented Oct 23, 2024

I have the same issue, I have a lot of logs with this error message:

** (Mint.TransportError) socket closed

Req.retry/3: Got exception. Will retry in 0ms, 1 attempt left

does that mean that the request failed and it is going to retry it? or that it failed completely?

@wojtekmach
Copy link
Owner

It means the the request will be retried.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants