rexyai / RestRserve

R web API framework for building high-performance microservices and app backends
https://restrserve.org
275 stars 32 forks source link

Unable to run the First example #130

Closed vikram-rawat closed 4 years ago

vikram-rawat commented 4 years ago

I am on windows. I tried this dummy code and it doesn't work. It doesn't give me any error though but my path localhost:9001/hello doesn't display anything.

library(RestRserve)
app = Application$new()
app$add_get(
  path = "/hello", 
  FUN = function(request, response) {
    response$set_body("Hello from RestRserve")
  })
backend = BackendRserve$new()
backend$start(app, http_port = 9001)
dselivanov commented 4 years ago

We have an issue template for a reason. Please provide at least full sessionInfo.

vikram-rawat commented 4 years ago

Sorry, I didn't provide enough information. This is the error I get

image

This is my Session Info Please let me know if I am doing something wrong here


R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] RestRserve_0.2.0.1

loaded via a namespace (and not attached):
 [1] tseries_0.10-47   httr_1.4.1        pkgload_1.0.2     jsonlite_1.6.1    assertthat_0.2.1 
 [6] TTR_0.23-6        yaml_2.2.1        remotes_2.1.1     r2d3_0.2.3        sessioninfo_1.1.1
[11] pillar_1.4.3      backports_1.1.5   lattice_0.20-38   glue_1.3.1        quadprog_1.5-8   
[16] uuid_0.1-4        digest_0.6.23     checkmate_2.0.0   colorspace_1.4-1  htmltools_0.4.0  
[21] timeDate_3043.102 pkgconfig_2.0.3   devtools_2.2.2    purrr_0.3.3       scales_1.1.0     
[26] processx_3.4.2    tibble_2.1.3      generics_0.0.2    ggplot2_3.2.1     usethis_1.5.1    
[31] ellipsis_0.3.0    withr_2.1.2       urca_1.3-0        nnet_7.3-12       lazyeval_0.2.2   
[36] cli_2.0.1         quantmod_0.4-15   sparklyr_1.1.0    magrittr_1.5      crayon_1.3.4     
[41] mime_0.9          memoise_1.1.0     forecast_8.11     evaluate_0.14     ps_1.3.2         
[46] fs_1.3.1          fansi_0.4.1       nlme_3.1-144      xts_0.12-0        pkgbuild_1.0.6   
[51] tools_3.6.3       prettyunits_1.1.1 lifecycle_0.1.0   munsell_0.5.0     callr_3.4.2      
[56] packrat_0.5.0     compiler_3.6.3    forge_0.2.0       tinytex_0.19      rlang_0.4.4      
[61] grid_3.6.3        rstudioapi_0.11   htmlwidgets_1.5.1 base64enc_0.1-3   rmarkdown_2.1    
[66] testthat_2.3.1    gtable_0.3.0      fracdiff_1.5-1    DBI_1.1.0         curl_4.3         
[71] R6_2.4.1          zoo_1.8-7         knitr_1.28        dplyr_0.8.4       rprojroot_1.3-2  
[76] desc_1.2.0        parallel_3.6.3    AmesHousing_0.0.3 Rcpp_1.0.3        dbplyr_1.4.2     
[81] tidyselect_1.0.0  xfun_0.12         lmtest_0.9-37  
dselivanov commented 4 years ago

@vikram-rawat thanks. We really appreciate your report as none of us hasn't heavily test RestRserve on windows.

  1. May I also now output of the packageVersion('Rserve') ?
  2. In order to eliminate possible browser interference could you check if readLines("http://localhost:9001/hello") gives something?
  3. It makes sense to try to install latest Rserve (1.8.6) from rforge and see whether it works:
    install.packages('Rserve',,'http://www.rforge.net/')
  4. Do you have any firewall/anitivirus?
vikram-rawat commented 4 years ago
  1. ‘1.8.6’ is the package version of Rserve

  2. > readLines("http://localhost:9001/hello")
    Error in file(con, "r") : cannot open the connection
    In addition: Warning message:
    In file(con, "r") :
    InternetOpenUrl failed: 'A connection with the server could not be established'
  3. RestRserve gave me the message to install latest Rserve and I did before I posted it here. I also changed the port from 8080 to 9001 because postgres was using that port.

  4. No I don't have any firewalls at all.

let me know if you need any information from me. I am happy to help in any way possible.

dselivanov commented 4 years ago

It looks like we can reproduce. What we've observed, it takes quite some time to start Rserve on windows (not sure why that long). Could you try to start the app and try to send requests after 10sec-30sec-1min-2min?

dselivanov commented 4 years ago

@vikram-rawat could you please check whether dev branch fixes the issue? It seems the problem was that on windows the function which checks port availability has 60 sec timeout. Now server should start within 2 seconds.

vikram-rawat commented 4 years ago

I ran the initial code on development branch but then you asked for sessionInfo and I realized maybe development version is breaking things. Thus I reinstalled everything on the 3.6.3 version and gave you the sessionInfo. dev version has already been tried.

dselivanov commented 4 years ago

I've pushed a patch this morning, that's why I ask

On Fri, 6 Mar 2020, 13:37 Anantadinath, notifications@github.com wrote:

I ran the initial code on development branch but then you asked for sessionInfo and I realized maybe development version is breaking things. Thus I reinstalled everything on the 3.6.3 version and gave you the sessionInfo. dev version has already been tried.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rexyai/RestRserve/issues/130?email_source=notifications&email_token=ABHC5XPRTUDGZFM2E42G4MTRGC743A5CNFSM4K7TNJW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOAWYXA#issuecomment-595684444, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHC5XO2I65II23QDED4LHTRGC743ANCNFSM4K7TNJWQ .

artemklevtsov commented 4 years ago

Now issue fixed in the dev branch. The fix will be released in the 0.2.0.2.

vikram-rawat commented 4 years ago

Thanks a lot. I will check this issue periodically just to see If I can use this framework on my laptop :)

dselivanov commented 4 years ago

@vikram-rawat on CRAN now. Thanks for reporting!