Closed
Description
There is no way to close a connection and it's resulting in memory leak
my 8gb RAM is filled within 1.5 minutes
Get http://localhost:8529/_db/redbus/_api/database/current: dial tcp 127.0.0.1:8529: connect: cannot assign requested address
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x70 pc=0x4bc8be]
I am doing something like this
for _,item := range SomeArray{
ic:=getCount(item)
}
func getCount(Item) (iCount int) {
conn, err := http.NewConnection(http.ConnectionConfig{
Endpoints: []string{"http://localhost:8529"},
})
if err != nil {
fmt.Println("Error in Arango Connection", err)
} else {
// fmt.Println("Arangodb connection successfull")
}
c, err := driver.NewClient(driver.ClientConfig{
Connection: conn,
Authentication: driver.BasicAuthentication("test", "test"),
})
if err != nil {
fmt.Println("Error in Arango Client Creation", err)
} else {
fmt.Println("Arangodb client creation successful")
}
db, err := c.Database(nil, "redbus")
if err != nil {
fmt.Println("Error in database selection : ", err)
} else {
fmt.Println("Selected Dataase ")
}
ctx := driver.WithQueryCount(context.Background())
query := `<some query to return count>`
cursor, err := db.Query(ctx, query, nil)
if err != nil {
fmt.Println("ERROIR IN INTERLINKING COUNT CURSOR : ", err)
}
var interlinkingCount int
for {
_, err := cursor.ReadDocument(ctx, &interlinkingCount)
if driver.IsNoMoreDocuments(err) {
fmt.Println("NO MORE INTERLINKIGN COUUNT DOCUMENTS : ", err)
break
} else if err != nil {
fmt.Println(" Error in record interlinking count : ", err)
}
} /*for*/
defer cursor.Close()
return interlinkingCount
}
There is no way to close the connection object in this function resulting in leak
Metadata
Metadata
Assignees
Labels
No labels