tcp check passed but got connection reset by peer

Here’s fly.toml, dockerfile, and part of my go code.

  PORT = "54321"

  dockerfile = "Dockerfile"
    PORT = "54321"

  protocol = "tcp"
  internal_port = 54321
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 0

    grace_period = "1s"
    interval = "15s"
    timeout = "2s"

    port = 443
    handlers = []
    # handlers = ["tls"]
    # [services.ports.tls_options]
    #   alpn = ["h2"]
FROM golang:1.20.5-alpine as builder
WORKDIR /build
COPY go.mod .
COPY go.sum .
RUN go mod download

COPY . .
RUN go build -o main ./cmd/test_manager

FROM alpine:latest as certs
RUN apk --no-cache add ca-certificates

FROM scratch

COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /build/main ./main
CMD ["./main"]
	grpcListener, err := net.Listen("tcp", ":"+env.Get(env.PORT))
	if err != nil {
	log.Println("server is running on port " + env.Get(env.PORT))

	baseServer := grpc.NewServer()
	pb.RegisterTestManagementServiceServer(baseServer, testManageServer)
const URL = "<"

func main() {
	conn, err := grpc.Dial(URL, grpc.WithTransportCredentials(insecure.NewCredentials()))
    // ...

Even if I see Health check on port 54321 is now passing., I got connection reset by peer. I tried removing tls handler but still same.

Hey there,

Do you mind sharing the logs that you are receiving back from this app?

2023-06-27T06:05:26.851 app[9080e444f30d87] nrt [info] INFO Starting init (commit: 0b28cec)...
2023-06-27T06:05:26.868 app[9080e444f30d87] nrt [info] INFO Preparing to run: `./main` as root
2023-06-27T06:05:26.870 app[9080e444f30d87] nrt [info] INFO [fly api proxy] listening at /.fly/api
2023-06-27T06:05:26.873 app[9080e444f30d87] nrt [info] 2023/06/27 06:05:26 listening on [fdaa:1:bff3:a7b:17b:3fce:1d3b:2]:22 (DNS: [fdaa::3]:53)
2023-06-27T06:05:27.262 app[9080e444f30d87] nrt [info] 2023/06/27 06:05:27 server is running on port 54321
2023-06-27T06:05:28.552 health[9080e444f30d87] nrt [info] Health check on port 54321 is now passing.
2023-06-27T06:11:04.379 proxy [9080e444f30d87] nrt [info] Downscaling app thinker-manager in region nrt. Automatically stopping machine 9080e444f30d87. 2 instances are running, 0 are at soft limit, we only need 1 running
2023-06-27T06:11:04.384 app[9080e444f30d87] nrt [info] INFO Sending signal SIGINT to main child process w/ PID 231
2023-06-27T06:11:05.255 app[9080e444f30d87] nrt [info] INFO Main child exited with signal (with signal 'SIGINT', core dumped? false)
2023-06-27T06:11:05.256 app[9080e444f30d87] nrt [info] INFO Starting clean up.
2023-06-27T06:11:05.258 app[9080e444f30d87] nrt [info] WARN hallpass exited, pid: 232, status: signal: 15 (SIGTERM)
2023-06-27T06:11:05.261 app[9080e444f30d87] nrt [info] 2023/06/27 06:11:05 listening on [fdaa:1:bff3:a7b:17b:3fce:1d3b:2]:22 (DNS: [fdaa::3]:53)
2023-06-27T06:11:06.257 app[9080e444f30d87] nrt [info] [ 339.509329] reboot: Restarting system

Do you know if you app is in a crash loop by any chance? I would try running fly status --all and fly vm status <id> to see what could be going on.

I would also look into restarting your app (if you haven’t yet) with fly machine restart and pass in your machine id. Heres the doc for reference- Restart an App or a Machine · Fly Docs

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.