mozart / mozart2

Mozart Programming System v2
http://mozart.github.io/
BSD 2-Clause "Simplified" License
564 stars 96 forks source link

Enhancement: Report stack traces when using Ctrl+C (SIGINT) to kill a program. #98

Open kennytm opened 11 years ago

kennytm commented 11 years ago

This is mainly as a debugging aid. Currently when a program is stuck, there is no way to check why. In Python or Ruby, we could Ctrl+C to kill the program and the VM will print the current stack trace before the KeyboardInterrupt.

(Having a proper debugger is of course more welcome.)

sjmackenzie commented 11 years ago

Agreed Kenny this is a great enhancement. Though you might have many different threads running/waiting simultaneously. I'm not sure there is a way to easily determine which thread is waiting because of and honest to $(deity) dataflow wait and a thread that is waiting because of a bug in the code. both waits are legitimate reactions.

sjmackenzie commented 10 years ago

There has to be some way to determine which threads are waiting. If we press Ctrl+C it'll just dump a list of threads and their wait times and maybe which variable they are waiting on. This way we will have at least a better way of knowing where the issue lies.

sjrd commented 10 years ago

VM::aliveThreads contains a list of all alive threads. This includes threads that are waiting, as long as they are still alive. A thread is dead if it waits on a variable that is not reachable anymore from the runnable threads or from IO operations. At the next GC, these threads will be GCed and hence will disappear from aliveThreads.