Skip to content

Commit 400a09a

Browse files
committed
Reverting lsof changes on this branch; moved them to fulghum/lsof-output branch
1 parent 785c074 commit 400a09a

File tree

1 file changed

+0
-33
lines changed

1 file changed

+0
-33
lines changed

server/listener.go

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,11 @@ import (
1818
"errors"
1919
"fmt"
2020
"net"
21-
"os/exec"
2221
"runtime"
23-
"strings"
2422
"sync"
2523
"syscall"
2624

2725
"golang.org/x/sync/errgroup"
28-
29-
"github.com/sirupsen/logrus"
3026
)
3127

3228
var UnixSocketInUseError = errors.New("bind address at given unix socket path is already in use")
@@ -59,35 +55,6 @@ type Listener struct {
5955
func NewListener(protocol, address string, unixSocketPath string) (*Listener, error) {
6056
netl, err := newNetListener(protocol, address)
6157
if err != nil {
62-
// TODO: We're still seeing errors about address already in use, e.g:
63-
// https://github.com/dolthub/dolt/actions/runs/5395898150/jobs/9798898619?pr=6245#step:18:2240
64-
// More examples:
65-
// https://github.com/dolthub/dolt/actions/runs/5395439523/jobs/9797921148#step:18:2249
66-
// https://github.com/dolthub/dolt/actions/runs/5404900318/jobs/9819723916?pr=6245#step:18:2216
67-
// https://github.com/dolthub/dolt/actions/runs/5406531989/jobs/9823511686?pr=6245#step:18:2216
68-
if err != nil {
69-
if strings.Contains(strings.ToLower(err.Error()), "address already in use") {
70-
split := strings.Split(address, ":")
71-
if len(split) == 2 {
72-
port := split[1]
73-
// if we're on unix, we should attempt to run lsof to see what is using the port and how
74-
// and output that information in the error to the user:
75-
// lsof -i:<port>
76-
if runtime.GOOS != "windows" {
77-
cmd := exec.Command("lsof", fmt.Sprintf("-i:%s", port))
78-
output, err := cmd.CombinedOutput()
79-
if err != nil {
80-
logrus.StandardLogger().Warnf("Unable to run lsof to detect what is using port %s: %s", port, err.Error())
81-
} else {
82-
logrus.StandardLogger().Warnf("lsof output: %s", string(output))
83-
}
84-
}
85-
} else {
86-
logrus.StandardLogger().Warnf("Unable to parse address into `host:port`: %s", address)
87-
}
88-
}
89-
}
90-
9158
return nil, err
9259
}
9360

0 commit comments

Comments
 (0)