neo4j-rstats / neo4r

A Modern and Flexible Neo4J Driver
https://neo4j-rstats.github.io/user-guide/
Other
106 stars 30 forks source link

Connection (with Docker) successful but drops to `No registered connection`. #64

Open SimonGoring opened 4 years ago

SimonGoring commented 4 years ago

This is a new problem, I'm not sure what's causing it.

I'm running a docker container with neo4j. The ports are forwarded to 7474 and 7687.

To connect I'm doing the following:

con <- neo4j_api$new(
  url = 'localhost:7474',
  user = 'neo4j',
  password = 'neo4j'
)

This works and returns:

<neo4j connection object>
Connected at localhost:7474 
User: neo4j 
Neo4j version: 3.5.3 

So all good. Then I try to use the connection and it fails:

>       query <- 'MATCH (n:OBJECT {id: "%s"})
+                 MATCH (l:LANGUAGE {code: "%s"})
+                 WITH n,l
+                 MERGE (n)-[hl:hasLanguage]->(l)
+                 ON CREATE hl.created = timestamp()'
>       langs <- strsplit(test_run$lang, ",")[[1]]
>       sapply(langs, function(x) {
+         sprintf(query, test_run$id, x) %>%
+         call_neo4j(con)
+       })
Error: API error
> 
> con
<neo4j connection object>
No registered Connection
(Wrong credentials or hostname)

In this case there is an actual error in the query (a missing SET after ON CREATE) but the connection is now lost and whatever I try to do, I can't get the connection back.

The same password/username combo works in the browser. The only way I can get back in is to actually shut down docker again and start it up, but it drops again as soon as I make a call to the database.

This is new behaviour, I'm wondering if it's actually something with neo4j. . .

SimonGoring commented 4 years ago

Ps. My docker set up is:

docker run \
    --name testneo4j \
    -p7474:7474 -p7687:7687 \
    -d \
    -v $HOME/neo4j/data:/data \
    -v $HOME/neo4j/logs:/logs \
    -v $HOME/neo4j/import:/var/lib/neo4j/import \
    -v $HOME/neo4j/plugins:/plugins \
    --ulimit=nofile=40000:40000 \
    --env NEO4J_AUTH=neo4j/neo4j \
    neo4j:latest 2> /dev/null || \
    docker start testneo4j

(I've changed the password and user name, to make this reproducible without giving away that my password is password123)

SimonGoring commented 4 years ago

Also, incidentally, I can log into the server through the browser and on the commandline without a problem.