balena-os / leviathan-worker

The worker layer for Leviathan including worker plugins QemuKit & AutoKit
Apache License 2.0
6 stars 4 forks source link

Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client #14

Open klutchell opened 2 years ago

klutchell commented 2 years ago

https://jenkins.product-os.io/job/leviathan-v2-template/1867

leviathan-v2-template-client-1  | [2022-06-14T16:45:34.850Z][worker-os]             # Finished calculating reference hash
leviathan-v2-template-client-1  | [2022-06-14T16:45:34.851Z][worker-os]             # Starting capture
leviathan-v2-template-client-1  | [2022-06-14T16:45:34.858Z][worker-os] Rebooting the DUT
leviathan-v2-template-worker-1  | dnsmasq-dhcp: DHCPREQUEST(brjvplsdiq) 10.10.10.76 52:54:00:12:34:56 
leviathan-v2-template-worker-1  | dnsmasq-dhcp: DHCPACK(brjvplsdiq) 10.10.10.76 52:54:00:12:34:56 830c5ac
leviathan-v2-template-client-1  | [2022-06-14T16:45:55.589Z][worker-os] DUT has rebooted & is back online
leviathan-v2-template-client-1  | [2022-06-14T16:45:55.590Z][worker-os]             # Stopping capture...
leviathan-v2-template-worker-1  | Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
leviathan-v2-template-worker-1  |     at ServerResponse.setHeader (_http_outgoing.js:530:11)
leviathan-v2-template-worker-1  |     at ServerResponse.header (/usr/app/node_modules/express/lib/response.js:776:10)
leviathan-v2-template-worker-1  |     at ServerResponse.contentType (/usr/app/node_modules/express/lib/response.js:604:15)
leviathan-v2-template-worker-1  |     at ServerResponse.send (/usr/app/node_modules/express/lib/response.js:145:14)
leviathan-v2-template-worker-1  |     at /usr/app/build/lib/index.js:241:25
leviathan-v2-template-worker-1  |     at Layer.handle_error (/usr/app/node_modules/express/lib/router/layer.js:71:5)
leviathan-v2-template-worker-1  |     at trim_prefix (/usr/app/node_modules/express/lib/router/index.js:321:13)
leviathan-v2-template-worker-1  |     at /usr/app/node_modules/express/lib/router/index.js:284:7
leviathan-v2-template-worker-1  |     at Function.process_params (/usr/app/node_modules/express/lib/router/index.js:341:12)
leviathan-v2-template-worker-1  |     at next (/usr/app/node_modules/express/lib/router/index.js:275:10)
leviathan-v2-template-worker-1  |     at next (/usr/app/node_modules/express/lib/router/route.js:127:14)
leviathan-v2-template-worker-1  |     at /usr/app/build/lib/index.js:193:13
leviathan-v2-template-worker-1  |     at processTicksAndRejections (internal/process/task_queues.js:97:5)
leviathan-v2-template-client-1  | [2022-06-14T16:45:57.678Z][worker-os]             # Comparing captured images to reference image...
leviathan-v2-template-client-1  | [2022-06-14T16:45:58.257Z][worker-os]             # Found match, image 000003.jpg, hamming distance from reference: 0
leviathan-v2-template-client-1  | [2022-06-14T16:45:58.258Z][worker-os]             # Storing captured frames...
leviathan-v2-template-client-1  | [2022-06-14T16:45:58.273Z][worker-os]             # Frames stored
klutchell commented 2 years ago

Is this maybe because we set the OK after connecting the pipeline? https://github.com/balena-os/leviathan-worker/blob/31436f7ae000711d7c9be57b3ceceb14336415d9/lib/index.ts#L264-L272