Bug 1034135 - websocket can not be reconnected.
Summary: websocket can not be reconnected.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Containers
Version: 2.0.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: ---
Assignee: Jason DeTiberus
QA Contact: libra bugs
URL:
Whiteboard:
Depends On: 1034077
Blocks: 1030648
TreeView+ depends on / blocked
 
Reported: 2013-11-25 10:20 UTC by Johnny Liu
Modified: 2017-03-08 17:35 UTC (History)
3 users (show)

Fixed In Version: openshift-origin-node-proxy-1.16.4-2.el6op
Doc Type: Bug Fix
Doc Text:
Clone Of: 1034077
Environment:
Last Closed: 2013-12-16 09:11:12 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Johnny Liu 2013-11-25 10:20:13 UTC
+++ This bug was initially created as a clone of Bug #1034077 +++

Description of problem:
User connect websocket successfully, then user terminate it by CTL+C or create one more app, then try to reconnect previous websocket, failed.

Version-Release number of selected component (if applicable):
devenv_4067

How reproducible:
Always

Steps to Reproduce:
1.Create nodejs-0.10 app.
2.Use attachment to replace server.js
3.Add "websocket" to package.json
  "dependencies": {
    "websocket": ">= 1.0.7"
  },
4. Then git push
5. On client, access websocket of your app successfully, then terminate it by CTL+C.
# node client.js ws://nodejs010app-jialiu.dev.rhcloud.com:8000/
Connecting to ws://nodejs010app-jialiu.dev.rhcloud.com:8000/
WebSocket client connected
Received: '5967747'
Received: '7177040'
Received: '8560003'
Received: '8063458'
^C

6. Try to reconnect it, if it is reconnected successfully, pls create one more app that would make node-web-proxy service reload, and try to reconnect.

Actual results:
# node client.js ws://nodejs010app-jialiu.dev.rhcloud.com:8000/
Connecting to ws://nodejs010app-jialiu.dev.rhcloud.com:8000/
WebSocket client connected
echo-protocol Connection Closed

Seen from /var/log/node-web-proxy/supervisor.log:

/opt/rh/nodejs010/root/usr/lib/node_modules/ws/lib/WebSocket.js:175
    else throw new Error('not opened');
               ^
Error: not opened
    at WebSocket.send (/opt/rh/nodejs010/root/usr/lib/node_modules/ws/lib/WebSocket.js:175:16)
    at WebSocket.<anonymous> (/opt/rh/nodejs010/root/usr/lib/node_modules/openshift-node-web-proxy/lib/proxy/ProxyServer.js:510:14)
    at WebSocket.EventEmitter.emit (events.js:98:17)
    at Receiver.self._receiver.ontext (/opt/rh/nodejs010/root/usr/lib/node_modules/ws/lib/WebSocket.js:555:10)
    at Receiver.opcodes.1.finish (/opt/rh/nodejs010/root/usr/lib/node_modules/ws/lib/Receiver.js:397:14)
    at Receiver.expectHandler (/opt/rh/nodejs010/root/usr/lib/node_modules/ws/lib/Receiver.js:378:33)
    at Receiver.add (/opt/rh/nodejs010/root/usr/lib/node_modules/ws/lib/Receiver.js:93:24)
    at Socket.firstHandler (/opt/rh/nodejs010/root/usr/lib/node_modules/ws/lib/WebSocket.js:535:22)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Socket.<anonymous> (_stream_readable.js:720:14)
DEBUG: Program node /opt/rh/nodejs010/root/usr/lib/node_modules/openshift-node-web-proxy/bin/web-proxy.js --config /etc/openshift/web-proxy-config.json exited with code 8

DEBUG: Starting child process with 'node /opt/rh/nodejs010/root/usr/lib/node_modules/openshift-node-web-proxy/bin/web-proxy.js --config /etc/openshift/web-proxy-config.json'
1385365045358:INFO:[25/Nov/2013:02:37:25 -0500] - ProxyServer using config '/etc/openshift/web-proxy-config.json'
1385365045367:INFO:[25/Nov/2013:02:37:25 -0500] - Initializing ProxyServer ... 
1385365045370:INFO:[25/Nov/2013:02:37:25 -0500] - Stopping protocol servers for: 
1385365045396:INFO:[25/Nov/2013:02:37:25 -0500] - Creating protocol server for nonsecure_http_proxy
1385365045397:INFO:[25/Nov/2013:02:37:25 -0500] - Creating websocket server for nonsecure_http_proxy
1385365045403:INFO:[25/Nov/2013:02:37:25 -0500] - Creating protocol server for secure_http_proxy
1385365045409:INFO:[25/Nov/2013:02:37:25 -0500] - Creating websocket server for secure_http_proxy
1385365045411:INFO:[25/Nov/2013:02:37:25 -0500] - Initialized ProxyServer
1385365045411:INFO:[25/Nov/2013:02:37:25 -0500] - Starting protocol servers for: nonsecure_http_proxy,secure_http_proxy
1385365045411:INFO:[25/Nov/2013:02:37:25 -0500] - Starting protocol handler for nonsecure_http_proxy ...
1385365045414:INFO:[25/Nov/2013:02:37:25 -0500] - Starting protocol handler for secure_http_proxy ...
1385365045415:INFO:[25/Nov/2013:02:37:25 -0500] - secure_http_proxy listening on undefined:8000
1385365045415:INFO:[25/Nov/2013:02:37:25 -0500] - secure_http_proxy listening on undefined:8443

Expected results:
Should reconnect websocket successfully.

Additional info:
1. Restart openshift-node-web-proxy service, reconnect websocket successfully.
2. If user connect websoket using internal IP directly, reconnect websocket always succeed.

Comment 2 Jason DeTiberus 2013-11-26 14:32:51 UTC
https://github.com/openshift/enterprise-server/pull/157

Comment 4 Nan Wei 2013-11-27 06:00:29 UTC
OpenShift Enterprise puddle: 2013-11-26.1

1.Create nodejs-0.10 app
rhc app create njs nodejs-0.10
2.Use the attachment to replace server.js and add client.js
3.Add "websocket" to package.json
  "dependencies": {
    "websocket": ">= 1.0.7"
  },
4. Push the changes
git add .; git commit -amp; git push
5. SSH into this app and access websocket
rhc ssh njs
cd ~/app-root/runtime/repo

[njs-newcowei.ose-1115.com.cn repo]\> node client.js ws://njs-newcowei.ose-1115.com.cn:8000/
Connecting to ws://njs-newcowei.ose-1115.com.cn:8000/
WebSocket client connected
Received: '12562275'
Received: '16203435'
Received: '7004978'
^C
6. Try to reconnect it,it is reconnected successfully.
7. cat /var/log/node-web-proxy/supervisor.log | grep  -i error.
No error message, and routing information was reloaded.


Note You need to log in before you can comment on or make changes to this bug.