yihui/servr

servr does not reclaim daemonised servers after deamon_stop()

Opened this issue · 1 comments

My understanding of how deamon_stop() works is that it should reclaim the indexes of daemonised servers that have been stopped. This doesn't appear to happen when this workflow is followed:

  1. Download https://github.com/rstudio/bookdown-demo
  2. Launch the bookdown-demo.Rproj project
  3. Run the following
bookdown:::serve_book()
servr::daemon_stop(1)
bookdown:::serve_book()
servr::daemon_stop(1)
  1. Unexpectedly, the second serving of the book is hosted on deamonised server 2
servr::daemon_list()
# [1] 2

Is this expected behaviour?

yihui commented

The index is incremented each time a server is started. daemon_stop() stops and removes the server. It doesn't do anything about the indexes.

In your case, the second bookdown:::serve_book() must have instructed you that the way to stop the server is servr::daemon_stop(2) instead of servr::daemon_stop(1).