# Error: use of closed network connection

**URL:** <https://community.traefik.io/t/error-use-of-closed-network-connection/12750>\
**Category:** Traefik v2\
**Tags:** docker\
**Created:** [December 17, 2021, 6:43am UTC](https://community.traefik.io/t/error-use-of-closed-network-connection/12750 "2021-12-17T06:43:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cthulhu](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/cthulhu/32/7396_2.png) [@cthulhu](https://community.traefik.io/u/cthulhu)\
**Post date:** [December 17, 2021, 6:43am UTC](https://community.traefik.io/t/error-use-of-closed-network-connection/12750/1 "2021-12-17T06:43:25Z")

</div>

Hello,

i run traefik (2.5.5) in a portainer stack (docker compose).  
If I start the container manually, everything is allright.  
Because I made bad experience with `restart:always` i use the `on-failure:5` policy.  
When traefik tries to start after a reboot, it throws 5 errors and does not get up.  
I dont know, why these errors appear.

I only use the file-provider.  
Someone can tell me whats wrong here?

Errors:

```auto
time="2021-12-17T06:26:47Z" level=error msg="Error while starting server: accept tcp [::]:80: use of closed network connection" entryPointName=web
time="2021-12-17T06:26:47Z" level=error msg="accept tcp [::]:80: use of closed network connection" entryPointName=web
time="2021-12-17T06:26:47Z" level=error msg="Error while starting server: accept tcp [::]:443: use of closed network connection" entryPointName=websecure
time="2021-12-17T06:26:47Z" level=error msg="accept tcp [::]:443: use of closed network connection" entryPointName=websecure
time="2021-12-17T06:25:30Z" level=info msg="Configuration loaded from file: /config/traefik.yml"

```

Here are my config files (replaced my domain)

traefik.yml (redirection commented for test use:

```auto
api:
  dashboard: true
  
entryPoints:
  web:
    address: ":80"
# http:
# redirections:
# entryPoint:
# to: websecure
# scheme: https
  websecure:
    address: ":443"

providers:
  file:
    directory: /config
    watch: true

serversTransport:
  insecureSkipVerify: true

```

api.yml:

```auto
http:
  routers:
    api:
      entryPoints:
        - "web"      
      rule: Host(`traefik.tld`)
      service: api@internal

```

portainer.yml:

```auto
http:
  routers:
    portainer:
      entryPoints:
        - "web"
      rule: Host(`portainer.tld`)
      service: portainer-web
      

  services:
    portainer-web:
      loadBalancer:
        servers:
          - url: "http://portainer:9000/"

```

---

<div class="post-metadata">

**Author:** ![cthulhu](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/cthulhu/32/7396_2.png) [@cthulhu](https://community.traefik.io/u/cthulhu)\
**Post date:** [December 17, 2021, 4:26pm UTC](https://community.traefik.io/t/error-use-of-closed-network-connection/12750/2 "2021-12-17T16:26:45Z")

</div>

I just changed the loglevel to debug and now i get the following:  
(removed all dynamic configs before)

```auto
time="2021-12-17T16:17:49Z" level=info msg="Configuration loaded from file: /config/traefik.yml"
time="2021-12-17T16:17:49Z" level=info msg="Traefik version 2.5.5 built on 2021-12-10T17:00:35Z"
time="2021-12-17T16:17:49Z" level=debug msg="Static configuration loaded {\"global\":{\"checkNewVersion\":true},\"serversTransport\":{\"maxIdleConnsPerHost\":200},\"entryPoints\":{\"web\":{\"address\":\":80\",\"transport\":{\"lifeCycle\":{\"graceTimeOut\":\"10s\"},\"respondingTimeouts\":{\"idleTimeout\":\"3m0s\"}},\"forwardedHeaders\":{},\"http\":{},\"udp\":{\"timeout\":\"3s\"}}},\"providers\":{\"providersThrottleDuration\":\"2s\",\"file\":{\"directory\":\"/config\",\"watch\":true}},\"log\":{\"level\":\"DEBUG\",\"format\":\"common\"},\"pilot\":{\"dashboard\":true}}"
time="2021-12-17T16:17:49Z" level=info msg="\nStats collection is disabled.\nHelp us improve Traefik by turning this feature on :)\nMore details on: https://doc.traefik.io/traefik/contributing/data-collection/\n"
time="2021-12-17T16:17:49Z" level=info msg="Starting provider aggregator.ProviderAggregator {}"
time="2021-12-17T16:17:49Z" level=debug msg="Start TCP Server" entryPointName=web
time="2021-12-17T16:17:49Z" level=info msg="Starting provider *file.Provider {\"directory\":\"/config\",\"watch\":true}"
time="2021-12-17T16:17:49Z" level=info msg="Starting provider *traefik.Provider {}"
time="2021-12-17T16:17:49Z" level=info msg="Starting provider *acme.ChallengeTLSALPN {\"Timeout\":4000000000}"
time="2021-12-17T16:17:49Z" level=debug msg="Configuration received from provider file: {\"http\":{},\"tcp\":{},\"udp\":{},\"tls\":{}}" providerName=file
time="2021-12-17T16:17:49Z" level=debug msg="Configuration received from provider internal: {\"http\":{\"services\":{\"noop\":{}},\"serversTransports\":{\"default\":{\"maxIdleConnsPerHost\":200}}},\"tcp\":{},\"tls\":{}}" providerName=internal
time="2021-12-17T16:17:49Z" level=debug msg="No default certificate, generating one" tlsStoreName=default
time="2021-12-17T16:18:30Z" level=info msg="I have to go..."
time="2021-12-17T16:18:30Z" level=info msg="Stopping server gracefully"
time="2021-12-17T16:18:30Z" level=debug msg="Waiting 10s seconds before killing connections." entryPointName=web
time="2021-12-17T16:18:30Z" level=error msg="accept tcp [::]:80: use of closed network connection" entryPointName=web
time="2021-12-17T16:18:30Z" level=error msg="Error while starting server: accept tcp [::]:80: use of closed network connection" entryPointName=web
time="2021-12-17T16:18:31Z" level=debug msg="Entry point web closed" entryPointName=web
time="2021-12-17T16:18:31Z" level=info msg="Server stopped"
time="2021-12-17T16:18:31Z" level=info msg="Shutting down"

```

Traefik is exiting with Code 0 so the on-failure policy does not work and traefik is down.  
Why it says "I have to go" !?

---

<div class="post-metadata">

**Author:** ![jiangxiaoqiang](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/jiangxiaoqiang/32/4314_2.png) [@jiangxiaoqiang](https://community.traefik.io/u/jiangxiaoqiang)\
**Post date:** [September 20, 2023, 12:39pm UTC](https://community.traefik.io/t/error-use-of-closed-network-connection/12750/3 "2023-09-20T12:39:31Z")

</div>

did you fixed this issue? I am facing the same issue.
