neo4j-contrib / spatial

Neo4j Spatial is a library of utilities for Neo4j that faciliates the enabling of spatial operations on data. In particular you can add spatial indexes to already located data, and perform spatial operations on the data like searching for data within specified regions or within a specified distance of a point of interest. In addition classes are provided to expose the data to geotools and thereby to geotools enabled applications like geoserver and uDig.
http://neo4j-contrib.github.io/spatial
Other
777 stars 191 forks source link

Connection Refused #264

Open thiagomorato opened 8 years ago

thiagomorato commented 8 years ago

Hey guys I'm getting some connection refused while adding nodes to a layer. The layer is created using the /db/data/ext/SpatialPlugin/graphdb/addSimplePointLayer endpoint with a post method and this data:

{ "layer": "locations", "lat": "lat", "lon": "lon" }

Then to add a point to the layer I use /db/data/ext/SpatialPlugin/graphdb/addNodeToLayer with a post method and with this data (1234 is the node id):

{ "layer": "locations", "node": "http://localhost:7474/db/data/node/1234" }

This work just fine but after doing it a few thousand times I start getting connection refused. It is not related to the data, after 7000 items processed it breaks, if I skip the firsts 6000 it won't break close to the 1000. Does anyone have any idea what might be the issue? I have tried to enable http log but it didn't helped much.

thiagomorato commented 8 years ago

The php exception message is this:

log.ERROR: cURL error 7: Failed to connect to localhost port 7474: Connection refused (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

From that link it states that error 7 is: Failed to connect() to host or proxy

thiagomorato commented 8 years ago

This might be valuable information:

thiagomorato commented 8 years ago

I have tried switching from the direct http to doing it using the cypher endpoint with procedures, it does a never ending call at item 708, and again if I skip the 600 first itens it won't fail at step 108. I have tried to put some delay between the calls but not joy.

jexp commented 8 years ago

Any chance you can share your data to reproduce? Also any log file showing errors?

Do you run the requests concurrently?

thiagomorato commented 8 years ago

No requests concurrently, well the same strange way it appeared it has gone. If it happens again I will try to isolate it with fake data as I can't share the data I'm working with. The hard thing was exactly this, there was nothing on the logs. Anyway thanks for trying to help : )

craigtaverner commented 8 years ago

Check both the logs/neo4j.log and logs/debug.log for possible errors. Also, if you cannot share your data, perhaps you can create a fake dataset that reproduces this?

phil20686 commented 8 years ago

From the regularity and the numbers I bet it triggers a rebalance that is slow enough to time out the http socket. Could you possibly print out the index nodes of the R tree just before it fails?

Sent from my iPhone

On 12 Aug 2016, at 16:06, Craig Taverner notifications@github.com wrote:

Check both the logs/neo4j.log and logs/debug.log for possible errors. Also, if you cannot share your data, perhaps you can create a fake dataset that reproduces this?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

phil20686 commented 8 years ago

In fact. Depending on how the http endpoint is implemented, it's possible that you have concurrent modifications. It's a known bug with the current RTree implementation that a that concurrent writes, one of which triggers a rebalance, may result in a concurrent write failure due to the way the locks cascade during a rebalance.

Will the http endpoint accept a second request before the first is complete/tree fully modified?

Sent from my iPhone

On 10 Aug 2016, at 17:03, thiagomorato notifications@github.com wrote:

Hey guys I'm getting some connection refused while adding nodes to a layer. The layer is created using the /db/data/ext/SpatialPlugin/graphdb/addSimplePointLayer endpoint with a post method and this data:

{ "layer": "locations", "lat": "lat", "lon": "lon" }

Then to add a point to the layer I use /db/data/ext/SpatialPlugin/graphdb/addNodeToLayer with a post method and with this data (1234 is the node id):

{ "layer": "locations", "node": "http://localhost:7474/db/data/node/1234" }

This work just fine but after doing it a few thousand times I start getting connection refused. It is not related to the data, after 7000 items processed it breaks, if I skip the firsts 6000 it won't break close to the 1000. Does anyone have any idea what might be the issue? I have tried to enable http login but it didn't helped much.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.