Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kill processes on unload, on Windows #58

Open
gaborcsardi opened this issue May 18, 2017 · 7 comments
Open

Kill processes on unload, on Windows #58

gaborcsardi opened this issue May 18, 2017 · 7 comments
Labels
feature a feature request or enhancement

Comments

@gaborcsardi
Copy link
Member

No description provided.

@shrektan
Copy link

shrektan commented Jan 17, 2018

Guess the callr package fails to really kill the process on Windows is due to the same reason. Minimal Repro:

callr::r(function() {
  message("hi")
  Sys.sleep(3)
  message("hi2")
  Sys.sleep(3)
  message("hi3")
}, timeout = 1)
#> Error: callr timed out hi
#> hi2
#> hi3
sessionInfo()
#> R version 3.4.1 (2017-06-30)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 7 x64 (build 7601) Service Pack 1
#> 
#> Matrix products: default
#> 
#> locale:
#> [1] LC_COLLATE=Chinese (Simplified)_People's Republic of China.936 
#> [2] LC_CTYPE=Chinese (Simplified)_People's Republic of China.936   
#> [3] LC_MONETARY=Chinese (Simplified)_People's Republic of China.936
#> [4] LC_NUMERIC=C                                                   
#> [5] LC_TIME=Chinese (Simplified)_People's Republic of China.936    
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] Rcpp_0.12.13          crayon_1.3.4          digest_0.6.13        
#>  [4] rprojroot_1.3-2       assertthat_0.2.0      R6_2.2.2             
#>  [7] backports_1.1.2       magrittr_1.5          evaluate_0.10.1      
#> [10] debugme_1.1.0         stringi_1.1.6         rstudioapi_0.7.0-9000
#> [13] callr_1.0.0.9000      rmarkdown_1.8         tools_3.4.1          
#> [16] stringr_1.2.0         yaml_2.1.16           compiler_3.4.1       
#> [19] processx_3.0.1        htmltools_0.3.6       knitr_1.18

@gaborcsardi
Copy link
Member Author

Confirmed. Interesting. This is actually tested, and it does kill some processes, but seems like it does not kill R:

> system.time(processx::run("src/tools/px.exe", c("sleep", "100"), timeout = 1))
Error in processx::run("src/tools/px.exe", c("sleep", "100"), timeout = 1) :
  System command timeout
Timing stopped at: 0 0 1.05
> system.time(processx::run(file.path(R.home("bin"), "R"), c("-q", "-e", "Sys.sleep(3)"), timeout = 1))
Error in processx::run(file.path(R.home("bin"), "R"), c("-q", "-e", "Sys.sleep(3)"),  :
  System command timeout
Timing stopped at: 0.02 0 3.3

@gaborcsardi
Copy link
Member Author

This is a bug, btw, and does not have much to do with this issue.

@shrektan
Copy link

It does kill the R process with the same pid reported by the processx object.

It's very weird. Although I can see the R process has been killed in the task manager of Windows, it seems like it's still running in the background...

@shrektan
Copy link

The CRAN version of processx works fine for this case since it's using tools::pskill(). Do you need me to open a new issue because it's not much to do with the current?

@gaborcsardi
Copy link
Member Author

@shrektan opened a separate issue for this: #96

@shrektan
Copy link

Thanks!

@gaborcsardi gaborcsardi added the feature a feature request or enhancement label Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants