I use listenHTTPProxy()
to set a layout of one front server and many back servers. After deployment, the site works fine when I visit it first time. But when I visit it again, there is a big change (yes, not always) to appear the page
502 - Bad Gateway
Connection to upstream server failed: Connection closed while writing data.
When I refresh the page, it returns normal again. The annoying 502 page always appears, and back to normal after F5.
I tried to set keepAliveTimeout
larger than 10s for back servers. I also tried to set HTTPServerOption.reusePort
for both front and back servers. All these guesses do not solve the problem. And sometimes I can not terminate a back server with SIGINT, SIGQUIT, SIGTERM immediately.
My front server listens port 80, my four back servers listen port 8080, 8181, 8282, 9090 respectively of 127.0.0.1. All servers reside in one droplet with Ubuntu 16.04.6 LTS.
I've no ideas what's going on. I see the message "Connection closed while writing data." is quite new, because it's in vibe-core-1.9.0 but not in vibe-core-1.8.1. Is there anyone has some ideas?