Code Monkey home page Code Monkey logo

Comments (10)

stephanf avatar stephanf commented on July 22, 2024

Within a scala play app I had:

val req = Cypher("start n=node(*) return n.name")

which would return ca. 10.000 nodes, calling

val stream = req()

caused:
play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[RuntimeException: error:dispatch.StatusCode: Unexpected response status: 400]]
at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:134) [play_2.9.1.jar:2.0.4]
at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115) [play_2.9.1.jar:2.0.4]
at akka.actor.Actor$class.apply(Actor.scala:318) [akka-actor.jar:2.0.2]
at play.core.ActionInvoker.apply(Invoker.scala:113) [play_2.9.1.jar:2.0.4]
at akka.actor.ActorCell.invoke(ActorCell.scala:626) [akka-actor.jar:2.0.2]
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:197) [akka-actor.jar:2.0.2]
Caused by: java.lang.RuntimeException: error:dispatch.StatusCode: Unexpected response status: 400
at org.anormcypher.Neo4jREST$.sendQuery(Neo4jREST.scala:26) ~[classes/:na]
at org.anormcypher.CypherStatement.apply(AnormCypher.scala:313) ~[classes/:na]
at controllers.Application$$anonfun$index$1.apply(Application.scala:19) ~[classes/:na]
at controllers.Application$$anonfun$index$1.apply(Application.scala:9) ~[classes/:na]
at play.api.mvc.Action$$anonfun$apply$4.apply(Action.scala:204) ~[play_2.9.1.jar:2.0.4]
at play.api.mvc.Action$$anonfun$apply$4.apply(Action.scala:204) ~[play_2.9.1.jar:2.0.4]

Just getting a single node worked like a charm.

from anormcypher.

freeeve avatar freeeve commented on July 22, 2024

Thanks Stephan, I'm planning to revamp the error handling so you can actually see what the response from the service is, instead of just 400. Can you run your query with curl? I think the server is actually choking on it.

On Dec 19, 2012, at 4:30 AM, Stephan Froede [email protected] wrote:

Within a scala play app I had:

val req = Cypher("start n=node(*) return n.name")

which would return ca. 10.000 nodes, calling

val stream = req()

caused:
play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[RuntimeException: error:dispatch.StatusCode: Unexpected response status: 400]]
at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:134) [play_2.9.1.jar:2.0.4]
at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115) [play_2.9.1.jar:2.0.4]
at akka.actor.Actor$class.apply(Actor.scala:318) [akka-actor.jar:2.0.2]
at play.core.ActionInvoker.apply(Invoker.scala:113) [play_2.9.1.jar:2.0.4]
at akka.actor.ActorCell.invoke(ActorCell.scala:626) [akka-actor.jar:2.0.2]
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:197) [akka-actor.jar:2.0.2]
Caused by: java.lang.RuntimeException: error:dispatch.StatusCode: Unexpected response status: 400
at org.anormcypher.Neo4jREST$.sendQuery(Neo4jREST.scala:26) ~[classes/:na]
at org.anormcypher.CypherStatement.apply(AnormCypher.scala:313) ~[classes/:na]
at controllers.Application$$anonfun$index$1.apply(Application.scala:19) ~[classes/:na]
at controllers.Application$$anonfun$index$1.apply(Application.scala:9) ~[classes/:na]
at play.api.mvc.Action$$anonfun$apply$4.apply(Action.scala:204) ~[play_2.9.1.jar:2.0.4]
at play.api.mvc.Action$$anonfun$apply$4.apply(Action.scala:204) ~[play_2.9.1.jar:2.0.4]

Just getting a single node worked like a charm.


Reply to this email directly or view it on GitHub.

from anormcypher.

stephanf avatar stephanf commented on July 22, 2024

Hi Wes,

curl?I have no clue how to use cypher queries from curl.

However, the cypher query is working from the data browser and a more complex version of it:

start f=node:user_profiles(name="Group")
match f-[user_weight:car_item]->car_item-[car_weight:describes_car]->car
where
(
(car_item.mappingtype="Absolut" and user_weight.weight=car_weight.weight)
OR
(car_item.mappingtype="Norm" and abs(user_weight.weight-car_weight.weight)<=1)
)
with car, count(car_item) as matches, sum(abs(user_weight.weight-car_weight.weight)) as delta
where matches>3 and delta>0 and delta<3
with car, matches, delta
order by delta, car.preis_eur asc
limit 55
return car.name, car.preis_eur, delta, matches

// response <500 ms in average

I filled Neo4J with the batch-importer

I also ran into problems trying to use ExecutionEngine with Java, I have some doubts regarding the REST API it behaves not as expected with cypher queries.

I will try an embedded approach.

Regards,
Stephan

from anormcypher.

freeeve avatar freeeve commented on July 22, 2024

Are you using 1.9?

from anormcypher.

stephanf avatar stephanf commented on July 22, 2024

Yep.

Is that causing this problems!?

from anormcypher.

freeeve avatar freeeve commented on July 22, 2024

No, but your query wouldn't even run in 1.8.x--which could have been causing the 400 error (that's why I asked). I think it's actually a timeout issue when the data is pretty big. There was some discussion on the google group about a similar error with the PHP REST driver.

from anormcypher.

stephanf avatar stephanf commented on July 22, 2024

Hmm, the data from the request are not so big just 55 rows with 4 columns, my impression was that the query itself is causing the problem not the data delivered.

As I tried REST with Java, I had heap space problems (with 220 cells), the problem occured somewhere in REST Api, it looked like a loop that went out of control (it crashed always with an array operation).

Since AnormCypher is more or less using the same underlying REST Apis, I think it could be the same problem (that is only guessing by intuition).

from anormcypher.

freeeve avatar freeeve commented on July 22, 2024

I need to make the 400 error give the body of the response through AnormCypher's exception, because it will usually tell you exactly where it doesn't like your query. I have an open issue for that (when I was using it myself recently, that was my main pain point)--I'll try to fix it this weekend.

from anormcypher.

freeeve avatar freeeve commented on July 22, 2024

To test your query in CURL you can just run (replace your query--you might want to use single quotes instead of double, to avoid needing to escape them:

curl -X POST -H Accept:application/json -H Content-Type:application/json -v http://localhost:7474/db/data/cypher -d '{"query":"start n=node(*) return n;", "params":{}}'

from anormcypher.

stephanf avatar stephanf commented on July 22, 2024

The Curl statement worked, it needed under 1 sec to print all 9378 nodes in the terminal.

It would surly help a lot if AnormCypher would give more details, I tried it myself but I was not able to get more informations.

I am using Neo4J as an embedded db (in play!) at the moment (as I was not able to connect via REST), but it looks very pragmatic resp. ugly, using REST would probably allow for a much more scalable and flexible architecture - and more elegant as well.

from anormcypher.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.