Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Having no DNS leads to a crash with no useful infos #55

Closed
MatMaul opened this issue Sep 9, 2021 · 0 comments · Fixed by #60
Closed

Having no DNS leads to a crash with no useful infos #55

MatMaul opened this issue Sep 9, 2021 · 0 comments · Fixed by #60

Comments

@MatMaul
Copy link

MatMaul commented Sep 9, 2021

Having a non working DNS setup leads to an olm failure that kills the process when it tries to download the media.

Relevant line of code is here:
https://github.com/matrix-org/matrix-content-scanner/blob/main/src/reporting.js#L251

logs:

2021-09-09 13:27:03.472 [a8019812] info - This request has an encrypted body; decrypting it...
2021-09-09 13:27:03.474 [a8019812] info - Decryption successful
2021-09-09 13:27:03.496 [a8019812] info - File not scanned yet: domain = agent.elysee.tchap.gouv.fr, mediaId = ABCDEFGHIJKLMNOP
2021-09-09 13:27:03.496 [a8019812] info - Will unlink file paths with alternate command "/etc/content-scanner/srml.sh"
2021-09-09 13:27:03.498 [a8019812] info - Downloading http://myserver.fr/_matrix/media/v1/download/myserver.fr/ABCDEFGHIJKLMNOP, writing to /tmp/av-BX9xOk/downloadedFile
2021-09-09 13:27:04.784 [b6b077a6] info - This request has an encrypted body; decrypting it...
2021-09-09 13:27:04.785 [b6b077a6] info - Decryption successful
2021-09-09 13:27:04.790 [b6b077a6] info - File not scanned yet: domain = myserver.fr, mediaId = ABCDEFGHIJKLMNOP
2021-09-09 13:27:04.790 [b6b077a6] info - Will unlink file paths with alternate command "/etc/content-scanner/srml.sh"



/usr/src/app/node_modules/@matrix-org/olm/olm.js:20
if(fa)n=m?require("path").dirname(n)+"/":__dirname+"/",ja=function(b,c){la||(la=require("fs"));ma||(ma=require("path"));b=ma.normalize(b);return la.readFileSync(b,c?null:"utf8")},ka=function(b){b=ja(b,!0);b.buffer||(b=new Uint8Array(b));b.buffer||q("Assertion failed: undefined");return b},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(b){throw b;}),process.on("unhandledRejection",q),a.inspect=function(){return"[Emscripten Module object]"};
                                                                                                                                                                                                                                                                                                                                                                                                                             ^
TypeError: Cannot read property 'pipe' of undefined
    at ClientRequest.<anonymous> (/usr/src/app/src/reporting.js:251:21)
    at ClientRequest.f (/usr/src/app/node_modules/once/once.js:25:25)
    at ClientRequest.emit (events.js:400:28)
    at Socket.socketErrorListener (_http_client.js:475:9)
    at Socket.emit (events.js:400:28)
    at emitErrorNT (internal/streams/destroy.js:106:8)
    at emitErrorCloseNT (internal/streams/destroy.js:74:3)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 7
npm ERR! matrix-context-scanner@1.7.0 start: `node src/index.js "/config/docker.config.yaml"`
npm ERR! Exit status 7

Notice that logs are saying Decryption successful while it seems that the media wasn't even downloaded at all.

babolivier added a commit that referenced this issue Dec 8, 2021
Fixes #55

It looks like the code assumes `reject` returns after handling an error, which doesn't seem to be the case in javascript.
Also improve the error handling a bit so the client doesn't get `Unhandled server error`.

Introduced in #47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant