Skip to content
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

Possible to add corrupted data to DB which crash the server when trying to query it #3740

Closed
felixfbecker opened this issue Jul 31, 2019 · 4 comments · Fixed by #4318
Closed
Assignees
Labels
area/crash Dgraph issues that cause an operation to fail, or the whole server to crash. area/data-loss Issues related to loss of data. kind/bug Something is broken. priority/P0 Critical issue that requires immediate attention. status/accepted We accept to investigate/work on it. status/needs-attention This issue needs more eyes on it, more investigation might be required before accepting/rejecting it

Comments

@felixfbecker
Copy link

If you suspect this could be a bug, follow the template.

  • What version of Dgraph are you using?

Dgraph version : v1.0.16
Commit SHA-1 : 0590ee9
Commit timestamp : 2019-07-11 11:52:54 -0700
Branch : HEAD
Go version : go1.12.5

  • Have you tried reproducing the issue with latest release?

should be latest

  • What is the hardware spec (RAM, OS)?

macOS

  • Steps to reproduce the issue (command/config used to run Dgraph).

I tried to figure out how to use the geo type. The API takes either a Base64 string or a UInt8Array. I wasn't sure how to encode coordinate in that, so I tried

value.setGeoVal(Buffer.from(JSON.stringify({ type: 'Point', coordinates: [0, 1] }).toString('base64'))

The mutation succeeded, but when I then queried for the UID, the server crashed with

2019/07/31 16:12:59 Error while interpreting appropriate type from binary error: wkb: unknown byte order: 1111011
  • Expected behaviour and actual result.

This seems like it should not happen, the server should validate data before inserting so that corrupted data cannot crash the server.

@campoy campoy added area/crash Dgraph issues that cause an operation to fail, or the whole server to crash. area/data-loss Issues related to loss of data. kind/bug Something is broken. status/accepted We accept to investigate/work on it. status/needs-attention This issue needs more eyes on it, more investigation might be required before accepting/rejecting it labels Sep 13, 2019
@campoy
Copy link
Contributor

campoy commented Sep 13, 2019

Hi @felixfbecker,

Thanks for the report! Can you reproduce the issue on v1.1.0?

@campoy campoy added the priority/P1 Serious issue that requires eventual attention (can wait a bit) label Sep 13, 2019
@campoy
Copy link
Contributor

campoy commented Sep 13, 2019

In the meantime, could you have a look @prashant-shahi?
Also, could you confirm whether this is a dgraph-js issue or something that could happen in other clients / curl?

@prashant-shahi
Copy link
Contributor

@campoy I had looked into the issue and was able to reproduce it in v1.0.x, v1.1.0, and master with the dgraph-js. Even when a valid geojson is passed to Value#setGeoVal, this issue can be seen. Here is the complete code to reproduce the issue.
I wasn't able to reproduce the steps using the pydgraph.

When I used @index(geo) for the predicate in the schema, during the mutation itself, we get to see the error that used to crash the server while querying.

Nevertheless, we can make use of Mutation#setSetJson or Mutation#setSetNquads to perform the mutation and later query back successfully.

@danielmai and I discussed the same.

@campoy campoy added priority/P0 Critical issue that requires immediate attention. and removed priority/P1 Serious issue that requires eventual attention (can wait a bit) labels Oct 16, 2019
@mangalaman93 mangalaman93 self-assigned this Nov 22, 2019
@mangalaman93
Copy link
Contributor

I am able to reproduce this issue using Go code. Looking into it to figure out what is going on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/crash Dgraph issues that cause an operation to fail, or the whole server to crash. area/data-loss Issues related to loss of data. kind/bug Something is broken. priority/P0 Critical issue that requires immediate attention. status/accepted We accept to investigate/work on it. status/needs-attention This issue needs more eyes on it, more investigation might be required before accepting/rejecting it
Development

Successfully merging a pull request may close this issue.

4 participants