Bug 1031986

Summary: openshift-node-web-proxy doesn't pass protocol specified by client on websockets requests
Product: OpenShift Online Reporter: Johnny Liu <jialiu>
Component: ContainersAssignee: Mrunal Patel <mpatel>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 2.xCC: chunchen, mpatel
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1034134 (view as bug list) Environment:
Last Closed: 2014-01-24 03:33:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1034134    
Attachments:
Description Flags
server.js
none
client.js none

Description Johnny Liu 2013-11-19 10:14:45 UTC
Description of problem:
Fail to access websocket of app, but could access it by internal IP. Seem like openshift-node-web-proxy doesn't pass protocol specified by client to app's node process.

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

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.


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 app's log, get the following error:
<--snip-->
! requestedProtocols should be 'echo-protocol'
! requestedProtocols is: 
Failed to accept connection: Error: Specified protocol was not requested by the client.
<--snip-->

Seem like openshift-node-web-proxy doesn't pass protocol specified by client to app's node process.


Expected results:
Websocket should be accessed successfully.

Additional info:
Succeed to access app's websokect via internal IP directly.

# node client.js ws://127.1.244.1:8080/

Comment 1 Johnny Liu 2013-11-19 11:41:16 UTC
Looks like this is a regression bug, because BZ#1002070 is using the same test stips and it is fixed in devenv-stage_471

Comment 2 Johnny Liu 2013-11-20 06:13:44 UTC
Created attachment 826443 [details]
server.js

Comment 3 Johnny Liu 2013-11-20 06:14:19 UTC
Created attachment 826444 [details]
client.js

Comment 4 Mrunal Patel 2013-11-21 18:04:45 UTC
We need to port our patches to nodejs-ws to nodejs010-nodejs-ws.

Comment 5 Mrunal Patel 2013-11-22 00:54:12 UTC
Waiting for nodejs010-nodejs-ws-0.4.25-8.el6oso to be available in devenv/stg.

Comment 7 chunchen 2013-11-25 02:57:35 UTC
It's reproduced, checked on devenv_4067, the nodejs010-nodejs-ws version is 0.4.25-8.el6oso.x86_64. Please refer to the following results:

1.Create nodejs-0.10 app
rhc app create cndjs10 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 cndjs10
cd ~/app-root/runtime/repo

\> node client.js ws://cndjs10-cdm.dev.rhcloud.com:8000/
Connecting to ws://cndjs10-cdm.dev.rhcloud.com:8000/
WebSocket client connected
echo-protocol Connection Closed

Comment 8 Johnny Liu 2013-11-25 08:47:17 UTC
Verified this bug against devenv_4067, and PASS.

# rpm -qa|grep nodejs010-nodejs-ws
nodejs010-nodejs-ws-0.4.25-8.el6oso.x86_64

[jialiu@jialiu-pc1 nodejs010app]$ node client.js ws://nodejs010app-jialiu.dev.rhcloud.com:8000/
Connecting to ws://nodejs010app-jialiu.dev.rhcloud.com:8000/
WebSocket client connected
Received: '8833312'
Received: '13763515'
Received: '14992830'
Received: '6033139'
Received: '14016768'
Received: '6773515'
Received: '1969944'

App log:
Mon Nov 25 2013 03:10:49 GMT-0500 (EST) Server is listening on port 8080
! requestedProtocols should be 'echo-protocol'
! requestedProtocols is: echo-protocol
Mon Nov 25 2013 03:11:16 GMT-0500 (EST) Connection accepted.
Received Message: 10356115
Received Message: 16628742
Received Message: 1098512
Received Message: 13707152
Received Message: 521087
Received Message: 795350
Mon Nov 25 2013 03:11:22 GMT-0500 (EST) Peer 127.1.244.1 disconnected.


About the failure in comment 7, actually it is another issue, file BZ#1034077 for more details.