emersion / emersion/go-imap

No timeout while waiting for a response

Open
#762 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
2.3k
Forks
360
Avg merge
1d 16h
Merged PRs (30d)
1

Description

After sending a message to the server, the client waits for a response indefinitely. The read timeout is only set after the first byte of the response is received, but if not bytes are received, then it is never set.

There's a scenario where this has a horrible impact:

  • client goes to sleep
  • RST/timeout is blackholed during this period.
  • client wakes up, sends NOOP
  • NOOP its in outbound kernel buffer
  • keepalive is suspended and retransmission takes over
  • retransmission keeps retrying for up to 18m

I'm sending a NOOP every three minutes precisely to detect timeouts, but Noop().Wait() simply hangs indefinitely.

Naïvely, I'd set the read timeout as soon as I'm done writing a request, but this would break IDLE, and I'm not sure if it would break anything else.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Trace the client request/response path from the request write through Noop().Wait(), focusing on where the read timeout is currently applied. Compare this behavior with IDLE, then inspect or add coverage for a request that receives no response. Done means the client reports a timeout without disrupting IDLE behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.