I trying to execute a procedure, its working but failed when lot of users comes …in the system.
this is the error
Jul 30 12:23:50 : 2024/07/30 12:23:50 http: panic serving 127.0.0.1:43974: runtime error: index out of range [0] with length 0
Jul 30 12:23:50 : goroutine 26 [running]:
Jul 30 12:23:50 : net/http.(*conn).serve.func1()
Jul 30 12:23:50 : C:/sw/go1.21.6.windows-amd64/go/src/net/http/server.go:1868 +0xb9
Jul 30 12:23:50 : panic({0xa57c20?, 0xc000204840?})
Jul 30 12:23:50 : C:/sw/go1.21.6.windows-amd64/go/src/runtime/panic.go:920 +0x270
Jul 30 12:23:50 : github.com/sijms/go-ora/v2.(*DataSet).setBitVector(0xc000232000?, {0xc000102900?, 0xc000081b70?, 0x434c9b?})
Jul 30 12:23:50 : C:/Users/kdf/go/pkg/mod/github.com/sijms/go-ora/v2@v2.8.19/data_set.go:94 +0xc5
Jul 30 12:23:50 : github.com/sijms/go-ora/v2.(*DataSet).load(0xc0000820a0, 0x1?)
Jul 30 12:23:50 : C:/Users/kdf/go/pkg/mod/github.com/sijms/go-ora/v2@v2.8.19/data_set.go:78 +0x1a9
Jul 30 12:23:50 : github.com/sijms/go-ora/v2.(*defaultStmt).read(0xc000152300, 0xc0000820a0)
Jul 30 12:23:50 : C:/Users/kdf/go/pkg/mod/github.com/sijms/go-ora/v2@v2.8.19/command.go:768 +0x17e
Jul 30 12:23:50 : github.com/sijms/go-ora/v2.(*Stmt)._exec(0xc000152300, {0xc0001a63c0, 0x8, 0x4eb5f0?})
Jul 30 12:23:50 : C:/Users/kdf/go/pkg/mod/github.com/sijms/go-ora/v2@v2.8.19/command.go:2001 +0xa28
Jul 30 12:23:50 : github.com/sijms/go-ora/v2.(*Stmt).ExecContext(0xc000152300, {0xb7c800, 0xc0001c01c0}, {0xc0001a63c0, 0x8, 0x8})
Jul 30 12:23:50 : C:/Users/kdf/go/pkg/mod/github.com/sijms/go-ora/v2@v2.8.19/command.go:1275 +0x1d9
Jul 30 12:23:50 : github.com/sijms/go-ora/v2.(*Connection).ExecContext(0xc0003bbab8?, {0xb7c800, 0xc0001c01c0}, {0xac5032?, 0x4e8660?}, {0xc0001a63c0, 0x8, 0x8})
Jul 30 12:23:50 : C:/Users/kdf/go/pkg/mod/github.com/sijms/go-ora/v2@v2.8.19/connection.go:1066 +0x85
Jul 30 12:23:50 : database/sql.ctxDriverExec({0xb7c800?, 0xc0001c01c0?}, {0x7f17b0495bf8?, 0xc00022c280?}, {0x0?, 0x0?}, {0xac5032?, 0xc0000826b0?}, {0xc0001a63c0, 0x8, ...})
Jul 30 12:23:50 : C:/sw/go1.21.6.windows-amd64/go/src/database/sql/ctxutil.go:31 +0xd7
Jul 30 12:23:50 : database/sql.(*DB).execDC.func2()
Jul 30 12:23:50 : C:/sw/go1.21.6.windows-amd64/go/src/database/sql/sql.go:1675 +0x165
Jul 30 12:23:50 : database/sql.withLock({0xb7a9c0, 0xc000098630}, 0xc000082870)
Jul 30 12:23:50 : C:/sw/go1.21.6.windows-amd64/go/src/database/sql/sql.go:3502 +0x82
Jul 30 12:23:50 : database/sql.(*DB).execDC(0x420a01?, {0xb7c800?, 0xc0001c01c0}, 0xc000098630, 0x3ed600?, {0xac5032, 0x8c}, {0xc0000836f8, 0x8, 0x8})
Jul 30 12:23:50 : C:/sw/go1.21.6.windows-amd64/go/src/database/sql/sql.go:1670 +0x24f
Jul 30 12:23:50 : database/sql.(*DB).exec(0x0?, {0xb7c800, 0xc0001c01c0}, {0xac5032, 0x8c}, {0xc0000836f8, 0x8, 0x8}, 0x8?)
Jul 30 12:23:50 : C:/sw/go1.21.6.windows-amd64/go/src/database/sql/sql.go:1655 +0xdb
Jul 30 12:23:50 : database/sql.(*DB).ExecContext.func1(0xcf?)
Jul 30 12:23:50 : C:/sw/go1.21.6.windows-amd64/go/src/database/sql/sql.go:1634 +0x4f
Jul 30 12:23:50 : database/sql.(*DB).retry(0x18?, 0xc000082a68)
Jul 30 12:23:50 : C:/sw/go1.21.6.windows-amd64/go/src/database/sql/sql.go:1538 +0x42
Jul 30 12:23:50 : database/sql.(*DB).ExecContext(0xa2bc80?, {0xb7c800?, 0xc0001c01c0?}, {0xac5032?, 0xaa9164?}, {0xc0000836f8?, 0xc0003ebee0?, 0xa?})
code:
ctx := context.Background()
call := "BEGIN PROCEDURE(:1,:2); END;"
stmt, err := db.DB.PrepareContext(ctx, call)
if err != nil {
log.Errorf("Error preparing statement: %v", err)
return resp, err
}
defer stmt.Close()
var FavResult go_ora.RefCursor
_, err = stmt.ExecContext(ctx, CustId, sql.Out{Dest: &FavResult })
if err != nil {
log.Errorf("Error executing statement: %v", err)
return resp, err
}
rows, err := FavResult .Query()
if err != nil {
log.Errorf("Error fetching rows : %v", err)
return resp, err
}
defer rows.Close()
var resp []models.respDTO
for rows.Next_() {
var fav models.FavDTO
err := rows.Scan(
&fav.Latitude,
&fav.Longitude,
)
if err != nil {
log.Errorf("Error scanning row: %v", err)
}
resp = append(resp , fav)
}