You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello.
I got a strange situation with GOGM and intense loading of objects. Sometimes GOGM returns "gogm: data not found" instead of loaded objects or timeout-error.
Here's some code example.
It creates go-routines that loads objects and outputs the result (error or not).
func gogmTest() {
config := &gogm.Config{
Host: "127.0.0.1",
Port: 7687,
Username: "neo4j",
Password: "neo4j",
PoolSize: 100,
IndexStrategy: gogm.IGNORE_INDEX,
DefaultTransactionTimeout: time.Second * 10,
}
_gogm, _ := gogm.New(config, IdPolicy(), globalTypes...)
var wg sync.WaitGroup
for i := 1; i < 70; i++ {
wg.Add(1)
go func(i int) {
sensors := []Sensor{}
sess, _ := _gogm.NewSessionV2(gogm.SessionConfig{AccessMode: gogm.AccessModeRead})
defer wg.Done()
defer sess.Close()
whereFilter := gocypherdsl.C(&gocypherdsl.ConditionConfig{Name: "n", Field: "name", ConditionOperator: gocypherdsl.EqualToOperator, Check: "CupWndSpdMeasVirtual"})
err := sess.LoadAllDepthFilter(context.Background(), &sensors, 0, whereFilter, nil)
if err != nil && errors.Is(err, gogm.ErrNotFound) {
fmt.Printf("%d - Not found - %s\n", i, err.Error())
} else if err != nil {
fmt.Printf("%d - Other error - %s\n", i, err.Error())
} else {
fmt.Printf("%d - OK - %s\n", i, sensors[0].Name)
}
}(i)
}
wg.Wait()
fmt.Printf("DONE\n")
}
And the output.
Timeout errors are OK, but why does GOGM return gogm: data not found?
42 - OK - CupWndSpdMeasVirtual
23 - OK - CupWndSpdMeasVirtual
15 - Not found - failed auto read tx, no primary nodes to return, gogm: data not found
33 - Other error - failed auto read tx, Neo4jError: Neo.ClientError.Transaction.TransactionTimedOut (...)
3 - Not found - failed auto read tx, no primary nodes to return, gogm: data not found
13 - Not found - failed auto read tx, no primary nodes to return, gogm: data not found
12 - Not found - failed auto read tx, no primary nodes to return, gogm: data not found
21 - Other error - failed auto read tx, Neo4jError: Neo.ClientError.Transaction.TransactionTimedOut (...)
...
53 - Not found - failed auto read tx, no primary nodes to return, gogm: data not found
56 - Not found - failed auto read tx, no primary nodes to return, gogm: data not found
57 - Not found - failed auto read tx, no primary nodes to return, gogm: data not found
69 - Not found - failed auto read tx, no primary nodes to return, gogm: data not found
52 - Not found - failed auto read tx, no primary nodes to return, gogm: data not found
19 - Not found - failed auto read tx, no primary nodes to return, gogm: data not found
...
61 - OK - CupWndSpdMeasVirtual
63 - OK - CupWndSpdMeasVirtual
67 - OK - CupWndSpdMeasVirtual
DONE
The text was updated successfully, but these errors were encountered:
I think the problem is not the intense load itself, but the transaction timeout and processing of the results.
If timeout occurs before any results come to gogm you will get failed auto read tx, Neo4jError: Neo.ClientError.Transaction.TransactionTimedOut (...)
If a timeout occurs during result processing (gogm starts processing query results using result.Next), you will get automatic tx reading failed, no primary nodes to return, gogm: no data found and GOGM wraps non found error with transaction error.
Example (try to get nodes with enough timeout and too small):
...
{"level":"error","error":"failed auto read tx, no primary nodes to return, gogm: data not found","time":"2024-06-05T18:35:48+03:00"}
...
{"level":"debug","time":"2024-06-05T18:35:54+03:00","message":"Nodes count: 27"}
Hello.
I got a strange situation with GOGM and intense loading of objects. Sometimes GOGM returns "gogm: data not found" instead of loaded objects or timeout-error.
Here's some code example.
It creates go-routines that loads objects and outputs the result (error or not).
And the output.
Timeout errors are OK, but why does GOGM return
gogm: data not found
?The text was updated successfully, but these errors were encountered: