socketio / socket.io

Realtime application framework (Node.JS server)
https://socket.io
MIT License
60.79k stars 10.09k forks source link

“transport disconnect close” when use socketio&socketio-redisadapter,nginx ingress in k3s #4219

Open HOLYYUN opened 2 years ago

HOLYYUN commented 2 years ago

this is error report image this is my ingress config

apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: CI_PROJECT_NAME annotations: kubernetes.io/ingress.class: "nginx"

nginx.ingress.kubernetes.io/ssl-redirect: "true"

nginx.ingress.kubernetes.io/force-ssl-redirect: "true"

nginx.ingress.kubernetes.io/use-regex: "true"

nginx.ingress.kubernetes.io/proxy-body-size: 100m

ip hash

nginx.ingress.kubernetes.io/upstream-hash-by: "$http_x_forwarded_for" spec: tls:

  • hosts:
  • HOST_URL secretName: cluster-holyyun-tls rules:
  • host: HOST_URL http: paths:
  • path: / pathType: Prefix backend: service: name: CI_PROJECT_NAME port: number: 3000

It`s worked sometimes,but when the client connected a span,this error happen。 this is my client&server config

socket = io(socketUrl + data.data.namespace, { query: { token: data.data.token, userId: userId }, transports: ["polling", "websocket"] })

io.adapter(createAdapter(pubClient, subClient));

darrachequesne commented 2 years ago

It looks like you are not able to reach the Socket.IO server. Were you eventually able to find a solution?

HOLYYUN commented 2 years ago

It looks like you are not able to reach the Socket.IO server. Were you eventually able to find a solution?

but sometimes it worked in the same ingress config,when i restart the cluster of socket.io,it will lose connection and can't connected again,the problem happend. sometimes the client connected too long,the problem would happen also, there's no solution or example for cluster of ingress.

darrachequesne commented 2 years ago

That sounds weird. I'll try to add an example with a k3s cluster.