我有一个无头的Debian 9服务器,每晚都运行一个R BATCH
脚本。基本上,它从Gmail帐户获取附加数据以生成夜间报告。这一直在完美地运作了很长时间。但大约一个星期前,它停了下来。我无法肯定地说,但它可能与Debian第9版的重大更新同时发生......
脚本的第一件事就是对gmail帐户进行身份验证。像这样:
library(gmailr)
gmail_auth(secret_file = 'lib/secret.json')
但是它毫不犹豫地停了下来,给了我:
Error in httpuv::startServer(use$host, use$port, list(call = listen)) :
Failed to create server
Calls: gmail_auth ... init_oauth2.0 -> oauth_authorize -> oauth_listener -> <Anonymous>
Execution halted
从它看起来,错误来自httpuv
。所以我对树脂表示:
devtools::install_github(c("shiny", "httpuv"), "rstudio")
但没有爱。
除此之外,我的本地Linux机箱可以无误地运行gmail_auth
电话。这是一个Linux Mint 17.3 Rosa&#39;
也许相关:
sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS
Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.0
LAPACK: /usr/lib/lapack/liblapack.so.3.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=sv_SE.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=sv_SE.UTF-8 LC_NAME=sv_SE.UTF-8
[9] LC_ADDRESS=sv_SE.UTF-8 LC_TELEPHONE=sv_SE.UTF-8
[11] LC_MEASUREMENT=sv_SE.UTF-8 LC_IDENTIFICATION=sv_SE.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] gmailr_0.7.1 extrafont_0.17 ReporteRs_0.8.8
[4] ReporteRsjars_0.0.2 DBI_0.7 rjson_0.2.15
loaded via a namespace (and not attached):
[1] zip_1.0.0 Rcpp_0.12.12 compiler_3.4.1 plyr_1.8.4
[5] bindr_0.1 R.methodsS3_1.7.1 R.utils_2.5.0 base64enc_0.1-3
[9] tools_3.4.1 digest_0.6.12 uuid_0.1-2 tibble_1.3.4
[13] gtable_0.2.0 pkgconfig_2.0.1 png_0.1-7 rlang_0.1.2
[17] shiny_1.0.5 bindrcpp_0.2 Rttf2pt1_1.3.4 rJava_0.9-8
[21] httr_1.3.1 officer_0.1.5 dplyr_0.7.2 xml2_1.1.1
[25] knitr_1.17 gdtools_0.1.5 grid_3.4.1 glue_1.1.1
[29] R6_2.2.2 rvg_0.1.4 extrafontdb_1.0 ggplot2_2.2.1
[33] purrr_0.2.3 magrittr_1.5 scales_0.5.0 htmltools_0.3.6
[37] assertthat_0.2.0 xtable_1.8-2 mime_0.5 colorspace_1.3-2
[41] httpuv_1.3.5 lazyeval_0.2.0 munsell_0.4.3 R.oo_1.21.0
sessionInfo()
R version 3.3.3 (2017-03-06)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 9 (stretch)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=sv_SE.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=sv_SE.UTF-8 LC_NAME=sv_SE.UTF-8
[9] LC_ADDRESS=sv_SE.UTF-8 LC_TELEPHONE=sv_SE.UTF-8
[11] LC_MEASUREMENT=sv_SE.UTF-8 LC_IDENTIFICATION=sv_SE.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] gmailr_0.7.1 extrafont_0.17 ReporteRs_0.8.8
[4] ReporteRsjars_0.0.2 DBI_0.7 RMariaDB_0.11-6
[7] rjson_0.2.15
loaded via a namespace (and not attached):
[1] zip_1.0.0 Rcpp_0.12.12 plyr_1.8.4 bindr_0.1
[5] R.methodsS3_1.7.1 R.utils_2.5.0 base64enc_0.1-3 tools_3.3.3
[9] digest_0.6.12 uuid_0.1-2 tibble_1.3.4 gtable_0.2.0
[13] pkgconfig_2.0.1 png_0.1-7 rlang_0.1.2 shiny_1.0.5.9000
[17] bindrcpp_0.2 Rttf2pt1_1.3.4 rJava_0.9-8 httr_1.3.1
[21] officer_0.1.5 dplyr_0.7.2 xml2_1.1.1 knitr_1.17
[25] gdtools_0.1.5 grid_3.3.3 glue_1.1.1 R6_2.2.2
[29] rvg_0.1.4 extrafontdb_1.0 ggplot2_2.2.1 purrr_0.2.3
[33] magrittr_1.5 scales_0.5.0 htmltools_0.3.6 assertthat_0.2.0
[37] xtable_1.8-2 mime_0.5 colorspace_1.3-2 httpuv_1.3.5
[41] lazyeval_0.2.0 munsell_0.4.3 R.oo_1.21.0
答案 0 :(得分:0)
好的,一天的工作终于解决了。我想......
R阻止了1410
端口。根据我的发现,httpuv
需要此端口。但是,在杀死R进程后发生了新的错误。 httpuv
服务器似乎已启动,但需要从Web浏览器重新运行gmailr
身份验证,从而生成新的.httr-auth
。
我猜测R在我的无头Debian服务器上waiting for authentication in browser...
状态冻结,有效地阻塞了端口1410
。在我的笔记本电脑(Mint机器)上完成身份验证过程,并将.httr-auth
移动到无头服务器后,一切似乎都有效。
究竟为什么会发生这种情况我不知道。但如果从现在开始一切顺利,我会接受无知!手指交叉。