I’ve encountered this occasionally as well, which is one of the reasons I made ezStan, which has a
kill_stan() function for killing wayward chains. Note, however, that all
kill_stan() does is run the unix command
killall R, so it will kill any R sessions being run from the command line.
BTW, you might like the alternative interface that
start_stan() provides whereby running chains doesn’t lock up your primary R session; you can check in on sampling progress any time by running
watch_stan(), which you can either kill with ctrl-c (or clicking stop in the Console UI) or leave running until sampling is done (with an alert sound if you have the beepr package installed). In addition to slightly prettier progress indicators,
watch_stan() shows if divergences have been encountered and gives you the option to automatically run
kill_stan() if this happens. I’m working on adding more pre- and post-warmup diagnostics to compute & present during sampling as well.