Search code examples
node.jsredissocket.ioopenshiftopenshift-cartridge

Openshift redis cartridge with strange exceptions ETIMEDOUT on socket.io script


I have a socket.io node script running that acts as a chat server. I had it running on a local server ok, and have since tried moving it over to openshift.

I used the following cartridge to get it working - https://github.com/smarterclayton/openshift-redis-cart/issues

While running the local version of the server, while connecting to the openshift redis, I get strange timeouts exactly 127 seconds after I run the script.

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: Redis connection to <server> failed - connect ETIMEDOUT
    at RedisClient.on_error (/path/node_modules/redis/index.js:196:24)
    at Socket.<anonymous> (/path/node_modules/redis/index.js:106:14)
    at Socket.emit (events.js:95:17)
    at net.js:441:14
    at process._tickCallback (node.js:442:13)

I have seen the events.js:72 one before, but its usually when I try to run a node script with something already running on that port.

Pretty sure the script itself is fine, as when I swap out the redis server for my local one, it will sit there for days and work fine.

So my question: why is my socket.io script killing itself after exactly 127 seconds when redis is hosted on openshift?


Solution

  • Are you using the rhc port-forward command so that you can connect to redis on OpenShift? Otherwise that port is not publicly available.