error layer=rpc writing response:write tcp 127.0.0.1:40000->127.0.0.1:41558: use of closed network connection

Viewed 1823

After docker-compose up -d --build, the server service is in a running state but getting the above error. I tried to build and run the code inside the container, it is running as expected. But If I start using docker-compose up, getting the above error.

Dockerfile stage

FROM dev as debug

# install debugging tools
RUN go get github.com/go-delve/delve/cmd/dlv
RUN go get github.com/cespare/reflex

# install any project dependencies
RUN go get -d -v ./...

CMD reflex -R "__debug_bin" -s -- sh -c "dlv debug --headless --continue --accept-multiclient --listen :40000 --api-version=2 --log ./src/"

docker-compose.yml

version: "3.8"

services:
  server:
    image: sample-service:debug
    build:
      context: .
      dockerfile: src/Dockerfile
      target: debug
      args:
        NETRC_LOCAL: ${NETRC_LOCAL}
    security_opt:
      - seccomp:unconfined
    ports:
      - 8080:8080
      - 40000:40000
    env_file: .env
    volumes:
      - .:/test
    depends_on:
      - cassandra
      - kafka
1 Answers

First of all, When you try to close dlv debugger unexpectedly, it will throw this error and also it's not a networking-related issue. This is an issue in reflex command. You probably forget to add any file from your workspace that is changing constantly like a log. Please ensure to add it with the -R flag.

Related