Negation query for "phone_calls" example 2 fails
Description
I'm trying to run the phone_calls example 2 query (with the negation query as per this PR). It fails to run when negation is used; however when the negation term is not used, the query runs without any issues.
Environment
- OS (where Grakn server runs):
- Operating System: Linux Mint 19.1
- Kernel: Linux 4.15.0-70-generic
- Architecture: x86-64
- Grakn version (and platform): Grakn Core 1.6.0
- Grakn client: client-python, workbase and console
- Other environment details:
Reproducible Steps
Steps to create the smallest reproducible scenario:
grakn console -k phone_calls -f ./examples/schemas/phone-calls-schema.gqlpython3 ./examples/phone_calls/python/migrate_json.py- This will generate the graph (no issues up to this point)
- Run query on Grakn workbase for example 2 (including the negation line as per line 91 from
examples/phone_calls/python/queries.py)match $suspect isa person, has city "London", has age > 50; $company isa company, has name "Telecom"; (customer: $suspect, provider: $company) isa contract; $pattern-callee isa person, has age < 20; (caller: $suspect, callee: $pattern-callee) isa call, has started-at $pattern-call-date; $target isa person, has phone-number $phone-number; not { (customer: $target, provider: $company) isa contract; }; (caller: $suspect, callee: $target) isa call, has started-at $target-call-date; $target-call-date > $pattern-call-date; get $phone-number; - When using workbase to run the query, the following error message is seen in the logs:
2019-11-26 17:05:20,805 [grpc-request-handler-13] ERROR g.c.s.r.SessionService$TransactionListener - Runtime Exception in RPC TransactionListener:
io.grpc.StatusRuntimeException: CANCELLED: cancelled before receiving half close
at io.grpc.Status.asRuntimeException(Status.java:517)
at io.grpc.stub.ServerCalls$StreamingServerCallHandler$StreamingServerCallListener.onCancel(ServerCalls.java:272)
at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.closed(ServerCallImpl.java:293)
at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1Closed.runInContext(ServerImpl.java:741)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
2019-11-26 17:05:20,811 [transaction-listener] ERROR g.c.s.r.SessionService$TransactionListener - Runtime Exception in RPC TransactionListener:
java.lang.NullPointerException: null
- When using the Python client to run the query as per this example, the following traceback is obtained:
ERROR:grpc._common:Exception deserializing message!
Traceback (most recent call last):
File "/home/pprao/Desktop/GitHub/graphdb-examples/venv/lib/python3.6/site-packages/grpc/_common.py", line 88, in _transform
return transformer(message)
google.protobuf.message.DecodeError: Error parsing message
Traceback (most recent call last):
File "/home/pprao/Desktop/GitHub/graphdb-examples/venv/lib/python3.6/site-packages/grakn/service/Session/TransactionService.py", line 156, in send
response = next(self._response_iterator)
File "/home/pprao/Desktop/GitHub/graphdb-examples/venv/lib/python3.6/site-packages/grpc/_channel.py", line 364, in __next__
return self._next()
File "/home/pprao/Desktop/GitHub/graphdb-examples/venv/lib/python3.6/site-packages/grpc/_channel.py", line 358, in _next
raise self
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with:
status = StatusCode.INTERNAL
details = "Exception deserializing response!"
debug_error_string = "None"
Expected Output
We should expect to see 12 phone numbers as the output:
[ '+30 419 575 7546', '+86 892 682 0628', '+1 254 875 4647',
'+351 272 414 6570', '+33 614 339 0298', '+86 922 760 0418',
'+86 825 153 5518', '+48 894 777 5173', '+351 515 605 7915',
'+63 808 497 1769', '+27 117 258 4149', '+86 202 257 8619' ]
Actual Output
ERROR message with the full stack trace shown in the logs (for the workbase example) or in the Python stack trace (for the Python client example).
Additional Information
When I remove the line with the negation term, the query works and I get a result. Looks like the issue is with the way the negation term is being parsed.
Update:
I just tried this on macOS 10.15 for two different grakn-core versions: 1.5.9 and 1.6.0.
- On grakn-core
1.5.9, the query from step 3 (above) works and I get the required result. - On grakn-core
1.6.0the query fails (just as on Linux) with the same error message.
To summarize, the issue with the negation query should be reproducible using grakn-core 1.6.0 (via console, grakn-workbase or the Python client) on both Linux and macOS systems.
Python client's half-close errors have been resolved as of version 2.x