sassoftware / R-swat

The SAS Scripting Wrapper for Analytics Transfer (SWAT) package is the R client to SAS Cloud Analytic Services (CAS). It allows users to execute CAS actions and process the results all from R.
Other
50 stars 22 forks source link

CAS Connection returns error #32

Open FBOMMA opened 2 years ago

FBOMMA commented 2 years ago

SAS VIYA Version : 3.5 R version 3.2.3 (2015-12-10) swat_1.6.3.9000 CentOS release 6.7

library('swat') library('dplyr') library('jsonlite') library('httr')

Sys.setenv(CASCLIENTDEBUG=1) options(cas.print.messages = TRUE)

Sys.setenv(CAS_CLIENT_SSL_CA_LIST="/home/xxx/SAS/xxx.pem") conn <- CAS('server.domain', 5570, username="myuser@mydomain.fr", password="xxx") [1] "NOTE: Client is using userid=myuser@mydomain.fr, password=***" [1] "NOTE: Client is using the userpass identity provider" [1] "NOTE: Sent challenge length 132" [1] "NOTE: Received response length 72" [1] "NOTE: User myuser@mydomain.fr connected to CAS using user/pass." NOTE: Connecting to CAS and generating CAS action functions for loaded action sets...

Error in [.data.frame(table, c(setdiff(names(table), col.names), col.names)) : undefined columns selected

sessionInfo() R version 3.2.3 (2015-12-10) Platform: x86_64-redhat-linux-gnu (64-bit) Running under: CentOS release 6.7 (Final)

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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

other attached packages: [1] httr_1.4.0 jsonlite_1.6 dplyr_0.8.3 swat_1.6.3.9000

loaded via a namespace (and not attached): [1] Rcpp_1.0.3 crayon_1.3.4 assertthat_0.2.1 R6_2.4.0 magrittr_1.5 pillar_1.4.2 rlang_0.4.2
[8] curl_3.3 rstudioapi_0.10 tools_3.2.3 glue_1.3.1 purrr_0.3.2 pkgconfig_2.0.2 tidyselect_0.2.5 [15] tibble_2.1.3

frayos commented 2 years ago

Hello, for SAS reference, this issue was suggested to be opened in track : 7613432080 as we believe the issue seems to be on the R side and not SAS / CAS.

Thanks ! Younes

tomweber-sas commented 2 years ago

@frayos I haven't been able to reproduce this, after installing the latest version, which you are running. I do see where that error appears to be happening in the code, and that code's been in there for some time now. Can you run the following, just to get some diagnostic output to see how far along in the process this is when the error happens?

Just add the options code below to your same test, just before the CAS() connection invocation. I'm expecting the same error, as the only thing that is really different here should be the trace.action=TRUE. But, this will easily give us an idea of where/when the error is happening; is there some action loaded in your environment I don't have and it has something unusual w/ it's columns, or how the results for it are coming back, which are causing this error? Is it on the very first one, and maybe there's some mismatch? ... Seeing the output will give a little better clue.

getOption('cas.gen.function.sig')
getOption('cas.trace.actions')
options(cas.gen.function.sig=FALSE)
options(cas.trace.actions=TRUE)

conn <- CAS('server.domain', 5570, username="myuser@mydomain.fr", password="xxx")
cas.builtins.about(conn)

Also, does it work if you connect with the HTTP method instead of the Binary protocol?

Thanks, Tom

FBOMMA commented 2 years ago

Command executed :

library('swat')
library('dplyr')
library('jsonlite')
library('httr')
Sys.setenv(CASCLIENTDEBUG=1)
Sys.setenv(CAS_CLIENT_SSL_CA_LIST="/home/60minsupport/SAS/sasviyadatascience.pem")
options(cas.print.messages = TRUE)
getOption('cas.gen.function.sig')
getOption('cas.trace.actions')
options(cas.gen.function.sig=FALSE)
options(cas.trace.actions=TRUE)
conn <- CAS('server.domain', 5570, username="myuser@mydomain.fr", password="xxx")
cas.builtins.about(conn)

Result [1] "NOTE: Client is using userid=s012552@societe.mma.fr, password=***" [1] "NOTE: Client is using the userpass identity provider" [1] "NOTE: Sent challenge length 132" [1] "NOTE: Received response length 72" [1] "NOTE: User S012552@societe.mma.fr connected to CAS using user/pass." NOTE: Connecting to CAS and generating CAS action functions for loaded action sets... [1] "[builtins.reflect]" [1] " action = \"builtins.reflect\" (string)" [1] " _messagelevel = \"error\" (string)" [1] "[builtins.about]" [1] " _messagelevel = \"error\" (string)" Error in [.data.frame(table, c(setdiff(names(table), col.names), col.names)) : undefined columns selected

cas.builtins.about(conn) Error: could not find function "cas.builtins.about"

The hhtp method doesn't work at all : conn <- CAS("lx40461.posix.covea.priv", 8777, protocol='https', user='s012552@societe.mma.fr', password='xxxx') Error in curl::curl_fetch_memory(url, handle = handle) : Timeout was reached: Operation timed out after 10001 milliseconds with 0 out of 0 bytes received

I have tried this command on the R server : curl -k -vvv https://myserver:8777/ I works fine :

  • Trying 10.231.1.231...
  • TCP_NODELAY set
  • Connected to lx40461.posix.covea.priv (10.231.1.231) port 8777 (#0)
  • Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
  • successfully set certificate verify locations:
  • CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none
  • TLSv1.2 (OUT), TLS handshake, Client hello (1):
  • TLSv1.2 (IN), TLS handshake, Server hello (2):
  • TLSv1.2 (IN), TLS handshake, Certificate (11):
  • TLSv1.2 (IN), TLS handshake, Server key exchange (12):
  • TLSv1.2 (IN), TLS handshake, Server finished (14):
  • TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
  • TLSv1.2 (OUT), TLS change cipher, Client hello (1):
  • TLSv1.2 (OUT), TLS handshake, Finished (20):
  • TLSv1.2 (IN), TLS change cipher, Client hello (1):
  • TLSv1.2 (IN), TLS handshake, Finished (20):
  • SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
  • Server certificate:
  • subject: CN=lx40461.posix.covea.priv
  • start date: Sep 3 09:59:32 2021 GMT
  • expire date: Jul 27 14:00:02 2028 GMT
  • issuer: CN=SAS VIYA Intermediate CA SSL certificate verify result: unable to get local issuer certificate (20), c ontinuing anyway. GET / HTTP/1.1 Host: lx40461.posix.covea.priv:8777 User-Agent: curl/7.58.0 Accept: /*

< HTTP/1.1 301 Moved Permanently < Connection: keep-alive < Date: Thu, 07 Oct 2021 08:26:00 GMT < Public: GET, PUT, HEAD, POST, DELETE, TRACE, OPTIONS, PATCH < Server: SAS HTTPD 10 < Origin: https://lx40456.posix.covea.priv:8777 < Cache-Control: private < Content-Length: 0 < Location: /cas-shared-default-http/healthCheck <

  • Connection #0 to host lx40461.posix.covea.priv left intact
tomweber-sas commented 2 years ago

Thanks, that shows that it's just getting started trying to get the actions that are loaded to create them as functions, and it's failing to get the output from CAS into a data frame to then process; creating the functions. I don't know what would cause this, going to have to get a SWAT person to diagnose this. But that output is very helpful in seeing where/when this happened. And, I don't know about the http either. Need someone to identify how/why that doesn't connect. I'll try to route this to someone here to help.

Thanks! Tom