Openshift haproxy error with 'express' has no server available
Asked Answered
S

2

10

I created a basic Nodejs app from Openshift and randomly, the service terminate itself few times in few days. No error message from my Nodejs module but only in haproxy that automatically installed with.

Messages from haproxy.log are:

[WARNING] 184/001333 (193501) : Server express/local-gear is DOWN for maintenance.
[WARNING] 184/010106 (483047) : config : log format ignored for proxy 'stats' since it has no log address.
[WARNING] 184/010106 (483047) : config : log format ignored for proxy 'express' since it has no log address.
[WARNING] 184/010106 (483047) : Server express/local-gear is DOWN, reason: Layer4 connection problem, info: "Connection refused", check duration: 0ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
[ALERT] 184/010106 (483047) : proxy 'express' has no server available!
[WARNING] 184/010110 (483047) : Server express/local-gear is DOWN for maintenance.
[WARNING] 184/010115 (483047) : Server express/local-gear is UP (leaving maintenance).
[WARNING] 184/010116 (483047) : Server express/local-gear is DOWN, reason: Layer7 wrong status, code: 500, info: "Internal Server Error", check duration: 43ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
[ALERT] 184/010116 (483047) : proxy 'express' has no server available! 

haproxy_ctld.log

E, [2014-07-03T12:12:59.557445 #97055] ERROR -- : Could not connect to the application.  Check if the application is stopped.
E, [2014-07-03T12:13:04.557968 #97055] ERROR -- : Could not connect to the application.  Check if the application is stopped.
E, [2014-07-03T12:13:09.558480 #97055] ERROR -- : Could not connect to the application.  Check if the application is stopped.
Satin answered 4/7, 2014 at 8:36 Comment(0)
B
3

Check this: Openshift Layer4 connection, App Won't Start

The problem might be that you're not serving anything at the root of your express app, so you need to modify haproxy configuration file, find the file that mentions express and httpchk and change from / to something that responds to request.

Alternatively, just serve something up on / so HAProxy doesn't keep restarting your service.

Brotherly answered 25/9, 2014 at 10:16 Comment(1)
it solved my problem perfectly. added a phony index.html and then everything started to work.Alphaalphabet
M
0

Are you sure the traffic is keeping your app up? If there are no requests, it should "deflate" the gear. Any subsequent request should "inflate" it back, but nevertheless it may end up as "service unavailable".

Re @Dids answer, although correct, RedHat recommends not changing the HaProxy keepalive URL for the future updates of Openshift may overwrite the config. Myself, I modified the app to serve a simple Hello at root.

Malignant answered 3/12, 2014 at 12:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.