rgreen312 / OwlPlace

https://rgreen312.github.io/OwlPlace/
5 stars 1 forks source link

[needs testing] backend: ws client cleanup #88

Closed gvacaliuc closed 4 years ago

gvacaliuc commented 4 years ago

This code builds, but it needs some testing.

Commit Desc:

WS Client Connections:

Makefile:

Messages:


This change is Reviewable

gvacaliuc commented 4 years ago

this just needs a little bit more testing @almagee16 @southpawac @jeffrey990219 can y'all see if these updates regress anything? there's a start of a test under tests/wsdiag.go (run with go run tests/wsdiag.go), but it doesn't work yet. i haven't tried running the frontend though.

ThePatrickBrady commented 4 years ago

error invalid memory address or nil pointer dereference

I tried checking out the branch and running it with the front end. I clicked a pixel and I get this error. Im not sure I can debug all the code that you wrote without sitting down and going line by line. This seems to be a different error than before when it was panicing due to concurrent websocket writes, or it might just seem like a different error to me since the code is now in a different file.

Im going to try commenting out the user code with the referencing of the time and see if that is the issue. If not I'm not exactly sure what it would be and have to study for the 412 exam :(

jeffrey990219 commented 4 years ago

Hi, Patrick. Did you make sure that you have manually logged in yourself before changing a pixel?

This error may happen if the system tries to get the last modification time of a user that's not in the database. Why? Because SyncGetLastUserModification returns a pointer and we are currently getting the time by dereferencing that pointer, so if the pointer is nil, then it is a problem.

If that still doesn't work, then I will take a look later.

ThePatrickBrady commented 4 years ago

I still don't know what is going on. I tried logging out and then back in as @jeffrey990219 suggested but it also crashes the server when I do that with another invalid memory address this time in the handleLoginUser method.

loginerror

Gabe I think the way you changed it to parse the messages still works since this one is bombing out in the handleLoginUser method and the other one crashes in the handleDrawPixel method, but something is still wrong and causing segfaults.

jeffrey990219 commented 4 years ago

Ok so the issue seems to be that c *Client doesn't have a cons consensus.IConsensus field. image As a matter of fact, calling c.cons.SyncGetLastUserModification(userID) gives an error.

jeffrey990219 commented 4 years ago

Yup, the cons field is not initialized. @gvacaliuc image

image

gvacaliuc commented 4 years ago

sweet thanks for debugging this!

jeffrey990219 commented 4 years ago

idk how to fix this tho lol