ferdinandhubbard981 / GameOfLife-Distributed

Other
0 stars 0 forks source link

gameState does not reset after distributor.go crtl-c #8

Closed ferdinandhubbard981 closed 2 years ago

ferdinandhubbard981 commented 2 years ago

to reproduce: cd broker go run .

in separate terminal: cd worker go run .

in separate terminal: go run . let the game run to completion (nothing is changing after each step) ctrl-c

go run .

result: nothing is changing after each step because gameState hasn't been reset.

achan-css commented 2 years ago

Try pressing q to quit the controller. This is because ctrl-c needs some separate code to intercept the SIGINT os signal, and then send the ControllerQuit RPC call.

Pressing q sends the ControllerQuit call

ferdinandhubbard981 commented 2 years ago

Do you think this is a cause of the tests failing? Do the tests exit cleanly each time?

ferdinandhubbard981 commented 2 years ago

Try pressing q to quit the controller. This is because ctrl-c needs some separate code to intercept the SIGINT os signal, and then send the ControllerQuit RPC call.

Pressing q sends the ControllerQuit call

Even with q there is an error

to reproduce: run broker, worker go run . press q result: broker crashes with error: panic: runtime error: invalid memory address or nil pointer dereference

achan-css commented 2 years ago

The nil pointer dereference is because when the controller is removed, there exists the chance that when the pushstate block has the mutex, it tries to send to the non existent client

You could probably fix this with a check that controller is not nil in the push state block