IUSCA / bioloop

Scientific data management portal and pipeline application template
Other
5 stars 2 forks source link

UI Heisenbug - 502 Bad Gateway #181

Closed deepakduggirala closed 9 months ago

deepakduggirala commented 9 months ago

Observed in xenium

Error: Server Error 
Object { stack: "Bt@https://xenium.sca.iu.edu/assets/index-c0ad7be5.js:33:31354\nb0e@https://xenium.sca.iu.edu/assets/index-c0ad7be5.js:35:1052\nm@https://xenium.sca.iu.edu/assets/index-c0ad7be5.js:35:4262\n", message: "Request failed with status code 502", name: "AxiosError", code: "ERR_BAD_RESPONSE", config: {…}, request: XMLHttpRequest, response: {…} }

code: "ERR_BAD_RESPONSE"

config: Object { timeout: 0, xsrfCookieName: "XSRF-TOKEN", xsrfHeaderName: "X-XSRF-TOKEN", … }

message: "Request failed with status code 502"

name: "AxiosError"

request: XMLHttpRequest { readyState: 4, timeout: 0, withCredentials: false, … }

response: Object { data: "<html>\r\n<head><title>502 Bad Gateway</title></head>\r\n<body>\r\n<center><h1>502 Bad Gateway</h1></center>\r\n<hr><center>nginx/1.25.2</center>\r\n</body>\r\n</html>\r\n", status: 502, statusText: "", … }

stack: "Bt@https://xenium.sca.iu.edu/assets/index-c0ad7be5.js:33:31354\nb0e@https://xenium.sca.iu.edu/assets/index-c0ad7be5.js:35:1052\nm@https://xenium.sca.iu.edu/assets/index-c0ad7be5.js:35:4262\n"

<prototype>: Object { constructor: Bt(e, t, n, o, r), toJSON: toJSON(), stack: "", … }
index-c0ad7be5.js:37:22388

This error is an unintended side effect of API's pm2 file-watch feature (run inside API docker container). When workers upload a report html to the API server, it gets stored in one of the sub-directories under /api and this triggers the pm2 to auto-restart the api server. Nginx could not forward the requests from UI while the server restarts and these are reported as 502 - Bad Gateway. (edited)