projectmesa / mesa-viz-tornado

Apache License 2.0
2 stars 8 forks source link

Freeze when letting model run #15

Open patrickkidd opened 2 years ago

patrickkidd commented 2 years ago

Describe the bug I am seeing freezes when letting a model run on it's own.

Expected behavior The model would continue to run at any number of agents and any frame rate.

To Reproduce It isn't yet clear how to reproduce this. I also can't figure out if it's frozen in the javascript or python interpreter. I've tried setting breakpoints in both and no success yet. So for now just posting in case others have observed this.

Model in question: https://github.com/patrickkidd/systems-models To run: $ python run.py --models mythematical

Corvince commented 2 years ago

Interesting. Have you tried letting the model run without the server? That way we can at least exclude the possibility that it is a model issue

patrickkidd commented 2 years ago

How would that work since each step makes a request to the server?

Corvince commented 2 years ago

I meant just a script a la

import MyModel 
model = MyModel()
while True:
    model.step()

But I haven't really looked at your model to see if you are doing something special with the server

patrickkidd commented 2 years ago

I suspect this is in the browser. The page won't redraw when it's stuck, and I can't get model.step() to freeze in a loop. Plus, model.step() doesn't hit any I/O so it would have to be an infinite loop, and I'm seeing this just as sporadically on the examples as well. Hitting pause in the server debugger steps out on the select() call which tells me tornado was waiting on the socket.