Git Product home page Git Product logo

Comments (5)

qasaur avatar qasaur commented on June 1, 2024

Hi,

Do you get the same issue if you pass in an empy map instead of nil?

from gremgo.

kushal256 avatar kushal256 commented on June 1, 2024

Yes, I'm having issues getting any response. See example:

for i := 0; i < 100; i++ {
res, err := g.Execute(// Sends a query to Gremlin Server with bindings
fmt.Sprintf("g.addV('label%v').property('testkey','testvalue')", i),
map[string]string{},
)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(res) //Always prints [], even though can verify vertex got added via gremlin console with a label0, label1, label2, etc...
}

for i := 0; i < 2000; i++ {
    res, err := g.Execute(// Sends a query to Gremlin Server with bindings
        "g.V(x)",
        map[string]string{"x": fmt.Sprintf("%v", i)},
    )
    if err != nil {
        fmt.Println(err)
        return
    }
    fmt.Println(res)  //Always prints[], not sure if bindings are working
}

for i := 0; i < 2000; i++ {
    res, err := g.Execute(// Sends a query to Gremlin Server with bindings
        fmt.Sprintf("g.V(%v)", i),
        map[string]string{},
    )
    if err != nil {
        fmt.Println(err)
        return
    }
    fmt.Println(res)  //Always prints[], even though via gremlin console can verify g.V(0) exists
}

Additionally, I periodically got an error, so I added this line to gremgo/client.go:

func (c *Client) executeRequest(query string, bindings map[string]string) (resp interface{}, err error) {
req, id := prepareRequest(query, bindings)
msg, err := packageRequest(req)
if err != nil {
fmt.Println(err) // <-------------------------Added here
return // TODO: Fix error handling
}
c.dispatchRequest(msg)
resp = c.retrieveResponse(id)
return
}

and when running that above code, randomly see this exception occur at different times.

goroutine 1 [running]:
runtime.throw(0x4b8280, 0x21)
/usr/local/Cellar/go/1.6/libexec/src/runtime/panic.go:530 +0x90 fp=0xc82004bad8 sp=0xc82004bac0
runtime.mapaccess1_faststr(0x32cb60, 0xc820073170, 0xc8203fe210, 0x24, 0x0)
/usr/local/Cellar/go/1.6/libexec/src/runtime/hashmap_fast.go:202 +0x5b fp=0xc82004bb38 sp=0xc82004bad8
github.com/qasaur/gremgo.(_Client).executeRequest(0xc820073110, 0x451948, 0x6, 0xc8203fe1e0, 0x0, 0x0, 0x0, 0x0)
/Users/dev/gowork/src/github.com/qasaur/gremgo/client.go:59 +0x2ef fp=0xc82004bcb8 sp=0xc82004bb38
github.com/qasaur/gremgo.(_Client).Execute(0xc820073110, 0x451948, 0x6, 0xc8203fe1e0, 0x0, 0x0, 0x0, 0x0)
/Users/dev/gowork/src/github.com/qasaur/gremgo/client.go:65 +0x5e fp=0xc82004bd00 sp=0xc82004bcb8
main.initGremlin()

from gremgo.

qasaur avatar qasaur commented on June 1, 2024

Thank you for bringing this up. I investigated the code further and discovered some issues and a critical race condition with the read worker and the read handler which caused the errors. I have fixed the bug in the latest commit on the master branch. It should be working properly now, but I'll wait until it has been resolved on your end before closing this issue.

Thanks,
Marcus

from gremgo.

kushal256 avatar kushal256 commented on June 1, 2024

Looks good now, thanks!!!

from gremgo.

qasaur avatar qasaur commented on June 1, 2024

Good to hear. Closing this issue seeing as the bug was resolved.

from gremgo.

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.