-
Notifications
You must be signed in to change notification settings - Fork 2
Description
at the start of execution, the server autotest code hits the /exchange/asset_list endpoint one time (only) in order to extract an array of available symbols for subsequent use in the query parameters of other endpoints, e.g. /exchange/ticker.
this endpoint responds normally – it returns status 200 and an array of symbols is extracted from its response body.
after this the code enters a loop where it hits random endpoints using random (but valid) query parameter values (for those endpoints that have query parameters).
at variable times after the start of this loop (usually a few seconds) and after a variable number of endpoints have been hit (usually 2-10) the node server crashes with the error message below.
independent of which particular endpoint is being hit at the time, the server always crashes at line 167 of the exchange.controller.js file which is inside the function handling the /exchange/asset_list endpoint (note that this endpoint already successfully responded at the very beginning of the run).
the error is always “cannot set headers after they are sent to the client”.
it appears there is some asynchronous activity happening here.
events.js:291
throw er; // Unhandled 'error' event
^
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
at ServerResponse.setHeader (_http_outgoing.js:543:11)
at ServerResponse.header (/home/jmills/portal/code/CryptoMarketAPI/node_modules/express/lib/response.js:776:10)
at ServerResponse.send (/home/jmills/portal/code/CryptoMarketAPI/node_modules/express/lib/response.js:170:12)
at ServerResponse.json (/home/jmills/portal/code/CryptoMarketAPI/node_modules/express/lib/response.js:267:15)
at /home/jmills/portal/code/CryptoMarketAPI/controllers/exchange.controller.js:167:37
at /home/jmills/portal/code/CryptoMarketAPI/node_modules/mongoose/lib/model.js:5004:18
at processTicksAndRejections (internal/process/task_queues.js:75:11)
Emitted 'error' event on Function instance at:
at /home/jmills/portal/code/CryptoMarketAPI/node_modules/mongoose/lib/model.js:5006:15
at processTicksAndRejections (internal/process/task_queues.js:75:11) {
code: 'ERR_HTTP_HEADERS_SENT'
}