neuroanatomy / BrainBox

BrainBox is a web application that lets you annotate and segment 3D brain imaging data in real time, collaboratively.
https://brainbox.pasteur.fr
Other
96 stars 46 forks source link

brainbox crash: TypeError: Cannot read property 'dirname' of undefined #303

Open ntraut opened 2 years ago

ntraut commented 2 years ago

Thank you for your feedback.

Please tag your issue as a feature request or a bug report using the labels on the right.

Current behaviour

Not sure exactly how this happens but brainbox often crashes at this line: https://github.com/neuroanatomy/BrainBox/blob/3cf9417c339cadd03ba7671412664e90bddfab9f/controller/atlasmakerServer/atlasmakerServer.js#L1132

traceback:

TypeError: Cannot read property 'dirname' of undefined
    at Object.receiveRequestSliceMessage (/var/www/html/brainbox/controller/atlasmakerServer/atlasmakerServer.js:1132:39)
    at Object._handleUserWebSocketMessage (/var/www/html/brainbox/controller/atlasmakerServer/atlasmakerServer.js:1809:12)
    at Object._handleWebSocketMessage (/var/www/html/brainbox/controller/atlasmakerServer/atlasmakerServer.js:1952:10)
    at WebSocket.<anonymous> (/var/www/html/brainbox/controller/atlasmakerServer/atlasmakerServer.js:2041:12)
    at WebSocket.emit (events.js:210:5)
    at Receiver.receiverOnMessage (/var/www/html/brainbox/node_modules/ws/lib/websocket.js:789:20)
    at Receiver.emit (events.js:210:5)
    at Receiver.dataMessage (/var/www/html/brainbox/node_modules/ws/lib/receiver.js:422:14)
    at Receiver.getData (/var/www/html/brainbox/node_modules/ws/lib/receiver.js:352:17)
    at Receiver.startLoop (/var/www/html/brainbox/node_modules/ws/lib/receiver.js:138:22)

we could think that it happens when me.getUserFromUserId(data.uid) returns null but it should not be the case because we would have the following error: Uncaught TypeError: Cannot read property 'User' of null

so it must be when getUserFromUserId returns an object without a User property

Expected behaviour

brainbox would handle the problem and not crash

Version information (for bug reports)

current

ntraut commented 2 years ago

Looking at the code in atlasmakerServer.js, the new entry in me.US is created in the method _connectNewUser but the property User is set in the method declareAutocompleteClient, so until the websocket message "autocompleteClient" is sent brainbox can crash because of the undefined property User.

@r03ert0 can you check that?