microsoft / microsoft/dev-tunnels

`RefreshPorts` code path doesn't really make sense

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

Nobody has claimed this yet.

Dominant language
C#
Stars
508
Forks
52
Avg merge
20h 6m
Merged PRs (30d)
7

Description

Description

Someone shared this error log for gh cs ssh (used to connect to GitHub codespaces over ssh):

kex_exchange_identification: read: Connection reset by peer
Connection reset by 127.0.0.1 port 65225
tunnel closed: error forwarding port: refresh ports failed: failed to refresh ports: %!w(<nil>)

Looking at the code where this error is returned, there doesn't appear to be any case in which the error will be non-nil:

https://github.com/microsoft/dev-tunnels/blob/845d75c554514d34c6cd80de23ec6d616a674d47/go/tunnels/client.go#L210-L219

I have no opinion on what the message should say. Happy to open a PR with your recommendation.


Separately, as a minor nit reading this code, it seems like it would be better for the final return on this method to be return nil, since again, no other value is possible.

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

Read go/tunnels/client.go around lines 210-219 and trace the RefreshPorts return path that produces the reported gh cs ssh error. Check how the error is wrapped and what the final return should represent; done means the nil-error case no longer formats as an error and the method's return behavior matches the reachable code paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.