Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

websocket: Unable to hijack the connection #1315

Closed
yuriy-zhilovets2 opened this issue Mar 19, 2017 · 12 comments
Closed

websocket: Unable to hijack the connection #1315

yuriy-zhilovets2 opened this issue Mar 19, 2017 · 12 comments
Milestone

Comments

@yuriy-zhilovets2
Copy link

yuriy-zhilovets2 commented Mar 19, 2017

v1.2.0-rc2
v1.2.0

etcd backend on Debian box

Configuration (read from etcd):

etcdctl get /traefik/backends/r-announcer/servers/server41/url
ws://172.25.255.41:2010

etcdctl get /traefik/frontends/r-announcer/passHostHeader
false

etcdctl get /traefik/frontends/r-announcer/backend
r-announcer

etcdctl get /traefik/frontends/r-announcer/entrypoints
https

etcdctl get /traefik/frontends/r-announcer/routes/host/rule
Host:announcer.mol.net.ua

etcdctl get /traefik/entrypoints/https/address
:443

etcdctl get /traefik/entrypoints/https/compress
false

tls settngs skipped because they work with https wihout any problems

time="2017-03-22T21:05:47+03:00" level=debug msg="Creating frontend r-announcer" 
time="2017-03-22T21:05:47+03:00" level=debug msg="Wiring frontend r-announcer to entryPoint http" 
time="2017-03-22T21:05:47+03:00" level=debug msg="Creating route host Host:announcer.mol.net.ua" 
time="2017-03-22T21:05:47+03:00" level=debug msg="Wiring frontend r-announcer to entryPoint https" 
time="2017-03-22T21:05:47+03:00" level=debug msg="Creating route host Host:announcer.mol.net.ua" 
time="2017-03-22T21:05:47+03:00" level=debug msg="Creating backend r-announcer" 
time="2017-03-22T21:05:47+03:00" level=debug msg="Creating load-balancer wrr" 
time="2017-03-22T21:05:47+03:00" level=debug msg="Creating server server41 at ws://172.25.255.41:2010 with weight 0"

The settings for proxiyng web sockets are fairly standard. I have studied thoroughly #452, so there are no:

ddr balancer (on this backend)
circuitbreaker (on this backend)
retry (globally)
compress (on entrypoint https)

But all log is filled with:

Unable to hijack the connection: *negroni.responseWriter the ResponseWriter doesn't support the Hijacker interface

and all connections to frontend URL immediately return 500 without any attempts to call backend.

@thomasf
Copy link

thomasf commented Mar 22, 2017

I see this problem as well after upgrading to 1.2 from 1.1.2

@emilevauge
Copy link
Member

Could give a try without retry and then without circuit breaker ?

@thomasf
Copy link

thomasf commented Mar 23, 2017

I have none of those enabled if I understand things correctly..

I just have a single back end (the latest offifical pre build mattermost prod docker images) configured via docker compose.

Retry or Compress are not mentioned in my traefik toml config file.

The status page says: 'Load Balancer: wrr'

The labels inside my docker-compose-file:

 labels:
      traefik.backend: mattermost
      traefik.port: "80"
      traefik.frontend.rule: Host:somehost.com
      traefik.docker.network: traefik
      traefik.enable: "true"

@yuriy-zhilovets2
Copy link
Author

yuriy-zhilovets2 commented Mar 23, 2017

That's my results without any circuitbreaker and retry is not mentioned in my config.

@Vincoll
Copy link

Vincoll commented Apr 4, 2017

I also encounter this error systematically, causing a 500 error on websockets.
If necessary I can provide details logs and informations for the bug fix.

What version of Traefik are you using?

Version:      v1.2.1
Codename:     morbier
Go version:   go1.7.5
Built:        2017-03-27_03:19:40PM
OS/Arch:      linux/amd64

What is your environment & configuration (arguments, toml...)?

{
 "GraceTimeOut": 10,
 "Debug": false,
 "CheckNewVersion": true,
 "AccessLogsFile": "",
 "TraefikLogsFile": "",
 "LogLevel": "ERROR",
 "EntryPoints": {
  "http": {
   "Network": "",
   "Address": ":80",
   "TLS": null,
   "Redirect": {
    "EntryPoint": "https",
    "Regex": "",
    "Replacement": ""
   },
   "Auth": null,
   "Compress": false
  },
  "https": {
   "Network": "",
   "Address": ":443",
   "TLS": {
    "MinVersion": "",
    "CipherSuites": null,
    "Certificates": [
     {
      "CertFile": "-----BEGIN CERTIFICATE-----[...]-----END CERTIFICATE-----",
      "KeyFile": "-----BEGIN PRIVATE KEY-----[...]-----END PRIVATE KEY-----"
     }
    ],
    "ClientCAFiles": null
   },
   "Redirect": null,
   "Auth": null,
   "Compress": false
  }
 },
 "Cluster": null,
 "Constraints": [],
 "ACME": null,
 "DefaultEntryPoints": [
  "http",
  "https"
 ],
 "ProvidersThrottleDuration": 2000000000,
 "MaxIdleConnsPerHost": 200,
 "InsecureSkipVerify": false,
 "Retry": null,
 "Docker": null,
 "File": null,
 "Web": {
  "Address": ":8080",
  "CertFile": "",
  "KeyFile": "",
  "ReadOnly": false,
  "Statistics": {
   "RecentErrors": 50
  },
  "Metrics": null,
  "Auth": {
   "Basic": {
    "Users": [
     "[...]:[...]"
    ]
   },
   "Digest": null,
   "HeaderField": ""
  }
 },
 "Marathon": null,
 "Consul": null,
 "ConsulCatalog": null,
 "Etcd": null,
 "Zookeeper": null,
 "Boltdb": null,
 "Kubernetes": null,
 "Mesos": null,
 "Eureka": null,
 "ECS": null,
 "Rancher": {
  "Watch": true,
  "Filename": "",
  "Constraints": null,
  "Endpoint": "",
  "AccessKey": "",
  "SecretKey": "",
  "ExposedByDefault": false,
  "Domain": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
 },
 "ConfigFile": "/etc/traefik/traefik.toml"
}

@krohrsb
Copy link

krohrsb commented Apr 9, 2017

Similar problem.

time="2017-04-09T00:37:07Z" level=info msg="Traefik version v1.2.1 built on 2017-03-27_03:19:40PM"

Using docker.

I've got a container specifying a label traefik.frontend.entryPoints=https,wss

https works fine, just the trouble with websockets.

@Ranger-X
Copy link

Try to turn off detailed statistics (subsection [web.statistics] in [web]). Unexpected, but it helped me.

@yuriy-zhilovets2
Copy link
Author

Unbelievable but true. Turning off the statistics fixes the error. Thank you, Ranger-X.

@Vincoll
Copy link

Vincoll commented Apr 14, 2017

I confirm too. WS are OK now.
Thank you !

@emilevauge
Copy link
Member

emilevauge commented Apr 14, 2017

Hum, thanks for this investigation @Ranger-X.
We need to add this to StatsRecorder:

var (
	_ http.ResponseWriter = &StatsRecorder{}
	_ http.Hijacker       = &StatsRecorder{}
	_ http.Flusher        = &StatsRecorder{}
	_ http.CloseNotifier  = &StatsRecorder{}
)

@emilevauge emilevauge added bug priority/P1 need to be fixed in next release labels Apr 14, 2017
@ldez ldez added area/websocket kind/bug/confirmed a confirmed bug (reproducible). and removed bug labels Apr 23, 2017
@phoenix741
Copy link

phoenix741 commented May 12, 2017

I have the same problem, if i comment this two line like this :

#  [web.statistics]
#  RecentErrors = 10

The problem is resolved too.

@emilevauge emilevauge added priority/P0 needs hot fix and removed priority/P1 need to be fixed in next release labels May 13, 2017
@ldez
Copy link
Member

ldez commented May 15, 2017

Closed by #1598

@ldez ldez closed this as completed May 15, 2017
@ldez ldez added this to the 1.3 milestone May 16, 2017
@traefik traefik locked and limited conversation to collaborators Sep 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants