Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • N node-http-proxy
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 482
    • Issues 482
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 102
    • Merge requests 102
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • http ... PARTY!
  • node-http-proxy
  • Issues
  • #559
Closed
Open
Issue created Jan 22, 2014 by Administrator@rootContributor

No way to close proxy/server websocket on client/server error

Created by: glasser

The ws pass does not have any logic to say "if an error occurs on socket, clean up proxySocket somehow". And there's no way for you to add that at the application level, because proxySocket is never passed to application code. This means that in practice, our proxies leak proxySockets.

Yes, if socket is cleanly closed, the pipe will close proxySocket as well. But that doesn't occur if socket errors; for example, if the client disappears from the network (without closing its TCP sockets), socket will emit error, and proxySocket will never be cleaned up.

See https://github.com/glasser/proxy-error-handling for a reproduction of this issue; it is trivially reproduced if you have a second machine (such as a recent Android/iPhone) that can load a web page served from your workstation and then disconnect itself from the network.

I've found a hacky way to close proxySocket: calling socket.unshift(null) causes socket to emit end, which triggers proxySocket.end() through the pipe. But this is an undocumented use of unshift. Surprisingly, socket.destroy() does not seem to cause socket to emit end and has no effect on proxySocket.

Node 0.10.22, but I don't believe there are any net or streams changes in 0.10.23 or 0.10.24.

See also meteor/meteor#1769.

Assignee
Assign to
Time tracking