compiler-explorer / conanproxy

Nodejs proxy in front of conanserver
Apache License 2.0
2 stars 2 forks source link

Invalid type crash #42

Closed partouf closed 5 months ago

partouf commented 5 months ago
node:buffer:740
    throw new ERR_INVALID_ARG_TYPE(
    ^
TypeError [ERR_INVALID_ARG_TYPE]: The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received an instance 
    at new NodeError (node:internal/errors:387:5)
    at Function.byteLength (node:buffer:740:11)
    at ProxyServer.<anonymous> (/home/ubuntu/ceconan/conanproxy/index.js:216:57)
    at ProxyServer.emit (/home/ubuntu/ceconan/conanproxy/node_modules/eventemitter3/index.js:184:35)
    at ClientRequest.<anonymous> (/home/ubuntu/ceconan/conanproxy/node_modules/http-proxy/lib/http-proxy/passes/web-incoming.js:133:16)
    at ClientRequest.emit (node:events:513:28)
    at tickOnSocket (node:_http_client:833:7)
    at onSocketNT (node:_http_client:893:5)
    at processTicksAndRejections (node:internal/process/task_queues:84:21) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Happened in this case before/during fetch of annotations?

Jun 22 11:00:07 librarybuilder librarycpp.build abseil/trunk@abseil/trunk: Created package revision df316e62328dd0cbc6d9ac9406b52009
Jun 22 11:00:07 librarybuilder librarycpp.build 2024-06-22 09:00:07,185 lib.installable.installable INFO     Export succesful
Jun 22 11:00:07 librarybuilder librarycpp.build 2024-06-22 09:00:07,496 lib.installable.installable INFO     commithash: d1e5f4cbe36ef977dc7a9cb2bb50dbe7ad50cb7c
Jun 22 11:00:07 librarybuilder librarycpp.build 2024-06-22 09:00:07,878 lib.ce_install  INFO     libraries/c++/nightly/abseil trunk failed to build: Fetch failure for https://conan.compiler-explorer.com/annotations/abseil/trunk/d1e5f4cbe36ef977dc7a9cb2bb50dbe7ad50cb7c: <Response [502]>
partouf commented 5 months ago

Line 216 is https://github.com/compiler-explorer/conanproxy/blob/main/index.js#L216

partouf commented 5 months ago

bodyData depends on the content-type

partouf commented 5 months ago

Attempt at fix: https://github.com/compiler-explorer/conanproxy/commit/8e8ae40c37f5800574bd3ca9a3a933e074a3418b

partouf commented 5 months ago

Ok that was not the cause

the crash is caused by visiting https://conan.compiler-explorer.com /annotations/fmt/1000

partouf commented 5 months ago
  errno: -2,
  code: 'ENOENT',
  syscall: 'opendir',
  path: '/home/ce/.conan_server/data/fmt/1000/fmt/1000/0/package'
[Error: ENOENT: no such file or directory
partouf commented 5 months ago

Should catch the error, and on the callsite it should be version 10.0.0 instead

partouf commented 5 months ago

fixed