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

huangapple go评论106阅读模式
英文:

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

问题

在执行docker-compose up -d --build之后,服务器服务处于运行状态,但出现了上述错误。我尝试在容器内构建和运行代码,结果如预期。但是,如果我使用docker-compose up启动,就会出现上述错误。

Dockerfile 部分

FROM dev as debug

# 安装调试工具
RUN go get github.com/go-delve/delve/cmd/dlv
RUN go get github.com/cespare/reflex

# 安装项目依赖
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
英文:

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

得分: 2

首先,当您尝试意外关闭dlv调试器时,它会抛出此错误,并且这不是与网络相关的问题。
这是在reflex命令中的一个问题。您可能忘记添加来自工作区的任何文件,这些文件在不断变化,比如日志文件。请确保使用-R标志将其添加进去。

英文:

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.

huangapple
  • 本文由 发表于 2021年7月28日 12:24:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/68554384.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定