-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connection refused when using hetio/py2neo to export to neo4j #11
Comments
So the warning is because your operating system is set to allow at most 1024 open files handles. However, it's just a warning... not an error. IIRC, the number of open files in Neo4j is only large if you have many users modifying the database at a given time. I don't think this should happen for our use cases... but if it does there will be an error message in the log. It looks like in Neo4j 3.1, it's now easier to change the open file limit. But I suspect this isn't your problem.
If we can get a log here that would be great! |
The strange thing is that the neo4j.log file is empty when this happens. It seems that the server is starting, refusing a connection to the Python code, and then shuts down immediately.
The code looks like:
|
My guess is that the following python line is actually shutting down the server: finally:
subprocess.run([neo4j_bin, 'stop']) This is happing after the error of
Then see what that does in your browser. You can comment out finally to keep the server running for debugging (but then you may have to manually kill the neo4j processes in the terminal, e.g. |
It's running on AWS, so I'll have to try some things to see if I can access the neo4j instance. It seems that the refused connection is occurring even if I comment out the stop command in the finally block. |
Are you able to get this file from AWS: |
Here are the logs:
and
|
I've simplified the code a little to try and isolate the problem. Right now all it's trying to do is establish a connection to the more default neo4j 3.1.1 (port 7474). Here is the Python traceback I'm getting:
|
It seems that the problem is that the new binary Bolt interface is the default, and the |
I think the issue is getting caused by the use of Neo4j 3.x rather than 2.x. Obviously, Neo4j 3.x is better, but it may take some work to upgrade this repo to use 3.x. The pip install --upgrade py2neo==3.1.2 That may fix the issue, but I'm worried the py2neo API may have changed in version 3. Worth a try though. Maybe first check this answer. Could that fix this? (would be odd if that was the issue) If neither of these fix the issue, we may need to consult the Neo4j slack of slack overflow. |
Ah, there may be a way to get bolt to work or to disable it. |
Yes I think I'm going to need to update your |
So do you think the issue is in this line of db_graph = py2neo.Graph(uri) |
Yes, in my current testing code I can get the following to work:
Connecting to neo4j 3.1.1 directly through There is a setting to turn bolt off in the configuration files, but I'm going to see if I can get things to work with bolt, and resort to the http way if all else fails. |
Currently, https://neo4j.het.io is running Neo4j 3.1.0 and exposes the following ports: 80, 443, 7687.
import py2neo
# Works, but fails without the port (makes sense)
py2neo.Graph('http://neo4j.het.io:80')
# Works, but fails without the port (makes sense)
py2neo.Graph('https://neo4j.het.io:443')
# Fails with and without the port (does not make sense)
py2neo.Graph('bolt://neo4j.het.io:7687') So I do think py2neo is a bit buggy here as @veleritas your issue may be slightly different. The bolt connection cannot use the same port as http(s). The default bolt port is However, it's good that you can get |
Alright, I think I have figured out what's wrong. It seems like there is nothing wrong with py2neo except that it doesn't play well with neo4j sometimes. The current situation is that if neo4j is started from the bash terminal by hand using I'm not really sure how to solve this though, since manually starting neo4j isn't really the best of options. |
Alright. It turns out that the code needs to wait for 5 seconds (not 4 or less) via a sleep command in order for the connection to work properly. Maddening. |
Ahh good to know! I still think there is a py2neo problem as described in https://github.com/technige/py2neo/issues/605. If I'm correct, you'll still have trouble connecting to Neo4j 3.1 using bolt with just at URI. So it sounds like I don't need to edit neo4j_bin = os.path.join(neo4j_dir, 'bin', 'neo4j')
subprocess.run([neo4j_bin, 'start']) However, I would need to update |
I think editing For example, see this issue. |
Awesome. If you make a pull request into |
It does seem like the URI interpreter in py2neo has some sort of bug at the moment. Removing the |
Hi Daniel,
Do you remember what you needed to do to increase the number of concurrent open files allowable by neo4j? At the moment I get a warning that says:
Also, I think they way that neo4j is started with a subprocess call in Python is giving me issues, since I trying to start neo4j 3.1.1 in the same manner causes the service to shut down immediately before any Python code can be executed.
The text was updated successfully, but these errors were encountered: