Hide Forgot
Description of problem: The app is auto idled even if having websocket access during auto idle interval time. Version-Release number of selected component (if applicable): devenv_3817 How reproducible: always Steps to Reproduce: 1. Create a nodejs app rhc app create cndjs nodejs-0.6 2. Replace server.js to support web sockets as belows: 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 UUID 6. Access this app via websocket and type words like "hello" wscat -c wss://cndjs-cdm.dev.rhcloud.com:8443/ -p 8 or wscat -c ws://cndjs-cdm.dev.rhcloud.com:8000/ -p 8 (maybe need execute it on instance) 7. Check the state of this app rhc app show -a cndjs --state 8. Wait some minutes and within 1 hour, then repeat Step 5-6 9. Do auto idle when time is more than 1 hour from Step 6 and less than 1 hour from Step 8 oo-auto-idler idle --interval 1 10. Show the app status rhc app show -a cndjs --state Actual results: at step 8: Cartridge nodejs-0.6 is started at step 10: Cartridge nodejs-0.6 is idle Expected results: The app should not be auto idled when having websocket access during auto idle interval time Additional info:
Note: if wscat is run from the same machine as oo-last-access, the gear will not remain unidled. The Idler code special cases access from the local machine. Fixed in https://github.com/openshift/origin-server/pull/3695
Commit pushed to master at https://github.com/openshift/origin-server https://github.com/openshift/origin-server/commit/d057f48981710863635ffb6064dc17643d8d0394 Bug 1011459 - oo-last-access does not process node-web-proxy/websockets.log * Use access.log format for websockets.log * Add websockets.log processing to oo-last-access
It is reproduced, checked this issue on devenv_3824. I found the /var/lib/openshift/.last_access/<UUID> does not be updated the time record after run oo-last-access, but the access records via websocket can be recorded in /var/log/node-web-proxy/websockets.log.
Verified it works as I expect in devenv_3826. Please include your steps to reproduce. I remind you wscat cannot be run on the same machine as the node as oo-last-access ignores the localhost.
It's fixed, verified on devenv_3829, please refer to the following results: 1. Create a nodejs app rhc app create cndjs nodejs-0.6 2. Replace server.js to support web sockets as belows: 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 UUID 6. Access this app via websocket and type words like "hello" wscat -c wss://cndjs-cdm.dev.rhcloud.com:8443/ -p 8 (on my work PC) 7. SSH into this instance and gather the accessing record oo-last-access 8. Check the state of this app rhc app show -a cndjs --state 9. Do auto idle when time is less than 1 hour from Step 6 oo-auto-idler idle --interval 1 10. Show the app status rhc app show -a cndjs --state at step 9: Gears idle for 1 hours at step 10: Cartridge nodejs-0.6 is started