nicolewhite / RNeo4j

Neo4j Driver for R.
https://cran.r-project.org/web/packages/RNeo4j/
Other
239 stars 69 forks source link

Error 503 connecting to Neo4j via startGraph (RStudio) #54

Closed kkruups closed 8 years ago

kkruups commented 8 years ago

Hi Nicole,

Please reference SO entry below for details.

rneoj-rstudio cannot connect to neo4j db Error 503

nicolewhite commented 8 years ago

I can't reproduce this. :(

> library(RNeo4j)
> graph = startGraph("http://localhost:7474/db/data/")
> graph
< Graph > 
$version
[1] "3.0.1"

Did you install Neo4j using the .exe or the .zip?

kkruups commented 8 years ago

hi Nicole,

Neo4j installed using exe. Is your system connected to internet via proxy servers? You will need to be connected via proxy to reproduce. The real error is a 301 there is an internet proxy appliance which masks the actual 301 error with a 503 error. I used a sniffer to confirm error. It looks like the underlying http_request method in startGraph doesn't handle proxy configurations. Is there there any way for you to add proxy server support?

sunitj commented 8 years ago

Hi KK, Nicole I was getting a similar error at startGraph as well. My RStudio would simply crash as soon as I executed my startGraph command. I tried running the same commands in R console and got the following traceback:

> library(RNeo4j)
> graph = startGraph("http://localhost:7474/db/data/",
+                    username = Sys.getenv("NEO4J_USER"),
+                    password = Sys.getenv("NEO4J_PASSWORD"))

 *** caught segfault ***
address 0x18, cause 'memory not mapped'

Traceback:
 1: .Call(R_new_handle)
 2: curl::new_handle()
 3: handle(name)
 4: handle_find(url)
 5: handle_url(handle, url, ...)
 6: httr::VERB(request_type, url = url, config = httr::config(opts),     body = body)
 7: http_request(url, "GET")
 8: startGraph.default("http://localhost:7474/db/data/", username = Sys.getenv("NEO4J_USER"),     password = Sys.getenv("NEO4J_PASSWORD"))
 9: startGraph("http://localhost:7474/db/data/", username = Sys.getenv("NEO4J_USER"),     password = Sys.getenv("NEO4J_PASSWORD"))

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace

When I found that it was address 0x18, cause 'memory not mapped', I was able to find a solution on SO:

http://stackoverflow.com/questions/25672974/caught-segfault-error-in-r

My world is right side up again... 😄 Hope this helps. Cheers!


R v.3.3.0 Neo4j v3.0.1 RNeo4j v.1.6.4 RStudio v.0.99.902 Mac OSX v 10.11.4 (El Capitan)

kkruups commented 8 years ago

Hi Nicole,

What SunitJ is reporting above is unrelated to the issue I have reported here.

I am not experiencing any segment faults. It is strickly related to Proxy settings.

Can you add proxy support to http_request method in your internal.R file?

Use opts to pass proxy settings to setConfig( ) the way your currently implementing timeout option.

BR/KK

nicolewhite commented 8 years ago

You can set your own config options with the opts argument in startGraph. Can you try this and let me know if it works? These options are sent to httr in http_request:

response = httr::VERB(request_type, url=url, config=httr::config(opts), body=body)
kkruups commented 8 years ago

Hi Nicole,

I had already tried the opts settings to pass proxy setings and not working!

BR/KK

kkruups commented 8 years ago

Hi Nicole,

Here is what I tried.

graph = startGraph("http://localhost:7474/db/data/", opts = list( timeout = 3, proxy = "myproxy.net", proxyport = 8080, proxyusername = "domainname\username", proxypassword = "mypassword"))

I still get the same exact error.

kkruups commented 8 years ago

Hi Nicole,

I was able to successfully execute startGraph by bypassing the proxy for localhost.

Steps

1.I first troubleshooted the issue using curl outside at a windows command prompt using the [noproxy] option to successful conclusion (verified this works correctly):

curl -v --noproxy localhost, http://localhost:7474/db/data/

2.Then at the RStudio console I set my httr configuration (since it is same underlying curl interface) to use [noproxy] option by doing the following:


rstudio_console>set_config(config(noproxy = "localhost"))  #set noproxy option

rstudio_console>set_config(config(verbose()))      #set verbose to view http messages

3.Then execute startGraph with no options:

rstudio_console>> graph = startGraph("http://localhost:7474/db/data")

4.Voila Success:


rstudio_console> graph 

< Graph > 

$version
[1] "3.0.1"
nicolewhite commented 8 years ago

Ah! I didn't realize it was a set_config thing. That makes sense. I'm glad you got it working. I think you could also try set_config(use_proxy()) instead of bypassing it? http://www.inside-r.org/packages/cran/httr/docs/use_proxy

kkruups commented 8 years ago

Hi NIcole,

set_Config(use_proxy()) will not work since there is a network security appliance that disallows I/O through to localhost. I confirmed behavior through curl proxy options ( If it does work for curl it will not work in RStudio). But thanks for the recommendation, it may work for folks that don't have such a strict proxy environment.

BR/KK