Bug 1009271 - Failed to wake up idled app via websocket request
Failed to wake up idled app via websocket request
Status: CLOSED CURRENTRELEASE
Product: OpenShift Online
Classification: Red Hat
Component: Containers (Show other bugs)
2.x
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Jhon Honce
libra bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-18 02:07 EDT by chunchen
Modified: 2016-09-29 22:15 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-10-17 09:29:35 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description chunchen 2013-09-18 02:07:30 EDT
Description of problem:
When creating an app,idle this app,then access page via websocket, it's failed to wake up this app to start and get 503 error for page.

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

How reproducible:
always

Steps to Reproduce:
1. Create a fork_ami instance
2. Log into site at https://devenv/app/console
3. Create an AeroGear app named "caerosocket"
4. SSH into this instance and idle this app
oo-admin-ctl-gears idlegear 5239165978550ce0ab000002
5. Access this app page via browser
http://caerosocket-cdm.dev.rhcloud.com:8000/simplepush/info
https://caerosocket-cdm.dev.rhcloud.com:8443/simplepush/info
6. Check the status of app
rhc app show caerosocket --state

Actual results:
at Step 5: return 503 page
at Step 6: Cartridge aerogear-aerogear-push-0.8.0, mysql-5.1 is idle

Expected results:
Idled app should be waken up via websocket request.

Additional info:
Comment 1 Jhon Honce 2013-09-20 18:52:19 EDT
Feature enabled in https://github.com/openshift/origin-server/pull/3677
Comment 2 Jhon Honce 2013-09-23 18:53:31 EDT
For testing you require a websocket enabled server and client...

    Add dependency to package.json:
    :
    .
      "dependencies": {
        "ws" : ">0.4.30"
      },
     
     
    Replace server.js to support web sockets:
     
    var host = process.env.OPENSHIFT_NODEJS_IP;
    var port = process.env.OPENSHIFT_NODEJS_PORT || 8080;
     
    var WebSocketServer = require('ws').Server,
        wss = new WebSocketServer({host: host, port: port});
        wss.on('connection', function(ws) {
          ws.on('message', function(message) {
            console.log('received: %s', message);
          });
          ws.send('something');
        });
     
     
    For a client:
    wscat -c ws://node001-honcenet.dev.rhcloud.com:8000/ -p 8

Every message you type, should be logged in /var/lib/openshift/<uuid>/nodejs/logs/node.log.
Comment 3 Jhon Honce 2013-09-23 18:58:43 EDT
Merged onto master by https://github.com/openshift/origin-server/pull/3688
Comment 5 chunchen 2013-09-24 05:19:50 EDT
It's fixed, verified on devenv_3817, please refer to the following results:

1. Create a nodejs app
rhc app create nod1 nodejs-0.6
2. Replace server.js to support web sockets:
     
    var host = process.env.OPENSHIFT_NODEJS_IP;
    var port = process.env.OPENSHIFT_NODEJS_PORT || 8080;
     
    var WebSocketServer = require('ws').Server,
        wss = new WebSocketServer({host: host, port: port});
        wss.on('connection', function(ws) {
          ws.on('message', function(message) {
            console.log('received: %s', message);
          });
          ws.send('something');
        });
3. Add dependency to package.json:
    :
    .
      "dependencies": {
        "ws" : ">0.4.30"
      },
4. Push the changes
5. SSH into instance and idle this app
oo-admin-ctl-gears idlegear 52415129b723cc8c72000039
6. Access this app via websocket
wscat -c wss://nod1-cdm.dev.rhcloud.com:8443/ -p 8
or
wscat -c ws://nod1-cdm.dev.rhcloud.com:8000/ -p 8
7. Check the state of this app
# rhc app show -a nod1 --state
Cartridge nodejs-0.6 is started

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