cayleygraph / cayley

An open-source graph database
https://cayley.io
Apache License 2.0
14.86k stars 1.25k forks source link

delete actions can cause the database to respond badly to subsequent queries #389

Closed davidascher closed 8 years ago

davidascher commented 8 years ago

I was cleaning up a cayley db with some 'bad facts' due to bad original encoding. I ran code like so:

g.V('PT0.06S').Tag('durationMin').In('durationMin').All(function(err,result) {
  console.log("got ", result.length, "matching events");
  result.forEach(function(event) {
    client.delete([{
      subject: event.id,
      predicate: "durationMin",
      object: "PT0.06S"
    }], function(err, body, res) {

    });
  })
})

Which seems to run fine, but makes any query that looks to verify the absence of PT0.06S nodes spin up a cayley process at 150%+ CPU, and then a server crash, apparently in JSON handling:

runtime: goroutine stack exceeds 1000000000-byte limit
fatal error: stack overflow

runtime stack:
runtime.throw(0x841140, 0xe)
    /usr/local/Cellar/go/1.5.3/libexec/src/runtime/panic.go:527 +0x90
runtime.newstack()
    /usr/local/Cellar/go/1.5.3/libexec/src/runtime/stack1.go:800 +0xb17
runtime.morestack()
    /usr/local/Cellar/go/1.5.3/libexec/src/runtime/asm_amd64.s:330 +0x7f

goroutine 9 [stack growth]:
reflect.Value.Type(0x6182e0, 0xc8205da780, 0xc6, 0x0, 0x0)
    /usr/local/Cellar/go/1.5.3/libexec/src/reflect/value.go:1661 fp=0xc842400240 sp=0xc842400238
encoding/json.(*decodeState).indirect(0xc8205dc690, 0x6182e0, 0xc8205da780, 0xc6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    /usr/local/Cellar/go/1.5.3/libexec/src/encoding/json/decode.go:337 +0xb4 fp=0xc8424003d8 sp=0xc842400240
encoding/json.(*decodeState).literalStore(0xc8205dc690, 0xc82009e351, 0x3, 0xf, 0x6182e0, 0xc8205da780, 0xc6, 0x0)
    /usr/local/Cellar/go/1.5.3/libexec/src/encoding/json/decode.go:677 +0x2d1 fp=0xc842400880 sp=0xc8424003d8
encoding/json.(*decodeState).literal(0xc8205dc690, 0x6182e0, 0xc8205da780, 0xc6)
    /usr/local/Cellar/go/1.5.3/libexec/src/encoding/json/decode.go:646 +0xe9 fp=0xc8424008e8 sp=0xc842400880
...
dennwc commented 8 years ago

@davidascher Can you provide full stack trace? What version and backend are you using?

davidascher commented 8 years ago

I'm not a golang dev so not sure how to do the former. I can follow directions though if you have some handy.

I'll see what versions are and get back to you.

On Thu, Apr 21, 2016, 10:06 AM Denys Smirnov notifications@github.com wrote:

@davidascher https://github.com/davidascher Can you provide full stack trace? What version and backend are you using?

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/google/cayley/issues/389#issuecomment-212796211

dennwc commented 8 years ago

You originally posted a part of the trace, so I'm asking if you can share the whole trace.

davidascher commented 8 years ago

Ok. I'll see if I can repro.

On Thu, Apr 21, 2016, 10:24 AM Denys Smirnov notifications@github.com wrote:

You originally posted a part of the trace, so I'm asking if you can share the whole trace.

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/google/cayley/issues/389#issuecomment-212803271

dennwc commented 8 years ago

@davidascher If it's possible, please try to reproduce it on 0.5 release and reopen issue if you see the same trace again.