haskell-distributed / haskell-distributed/distributed-process

Connection failure with localhost

Open
#431 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

network-transport-tcp
Dominant language
Haskell
Stars
751
Forks
99
Avg merge
45m
Merged PRs (30d)
2

Description

I'm observing failures when trying to connect and send messages to localhost:

TransportError ConnectFailed "Network.Socket.recvBuf: resource vanished (Connection reset by peer)"

I did not construct a minimal example, but I've traced the issue to the following commit to network-transport-tcp. In particular the original failure occurs in this line. The issue is that at this point sockAddr has the value ::1 but decodeSockAddr only supports IPv4 addresses. Adding a dummy case that handles IPv6 and always returns 127.0.0.1:<port> fixes the connection failures in my case.
The IPv6 address originates from this call to N.getAddrInfo when host="localhost".
A work-around is to always use 127.0.0.1 instead of localhost.
This depends on system configuration, as the issue was only observed on some machines.

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

Inspect commit 21cd334ef3aa78e2039eff3874fc2d63ea3cd6af, starting at the N.getAddrInfo call and decodeSockAddr around the linked failure line. Reproduce a connection using localhost on a system that resolves it to ::1, then verify that localhost connections no longer fail while IPv4 behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
distributed-systems, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.