Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error in the.Next() method #255

Open
mehrdod opened this issue Sep 19, 2018 · 5 comments
Open

Getting error in the.Next() method #255

mehrdod opened this issue Sep 19, 2018 · 5 comments

Comments

@mehrdod
Copy link

mehrdod commented Sep 19, 2018

I'm getting some cursor, which can be empty. Everything works good when I have some rows, but I'm getting next exception when cursor is empty:
Exception 0xc0000005 0x0 0x10 0x52a215c
PC=0x52a215c

runtime: unknown pc 0x52a215c
stack: frame={sp:0x3e2cf90, fp:0x0} stack=[0x3c31ed0,0x3e2fed0)
0000000003e2ce90:  52005a0054002000  0000000000000000 
0000000003e2cea0:  0000000000000000  0000000000000000 
0000000003e2ceb0:  59592f4d4d2f4444  2e00440044000000 
0000000003e2cec0:  52002e004d004d00  4800480020005200 
0000000003e2ced0:  4d003a0034003200  530053003a004900 
0000000003e2cee0:  2000460046005800  000052005a005400 
0000000003e2cef0:  0000000000000000  0000000000000000 
0000000003e2cf00:  0000000000000000  0000000000000000 
0000000003e2cf10:  0000000000000000  0000000000000000 
0000000003e2cf20:  000050add4648a1b  00000000052944b0 
0000000003e2cf30:  000000000ce716d0  000000000ce6d710 
0000000003e2cf40:  000000000ce6d710  000000000ce7eac8 
0000000003e2cf50:  3a494d3a34324848  5a54204646585353 
0000000003e2cf60:  000000000c539ef8  000000000464869c 
0000000003e2cf70:  0000000000000001  0000000000000000 
0000000003e2cf80:  0000000000000000  0000000000000000 
0000000003e2cf90: <000000000c539ef8  0000000003e2d048 
0000000003e2cfa0:  000000000ce7c9f0  00000000045137fe 
0000000003e2cfb0:  000000000c539880  0000000000000000 
0000000003e2cfc0:  0000000000000000  000000000ce6d530 
0000000003e2cfd0:  000000000ce7c9f0  00000000053d9e1e 
0000000003e2cfe0:  000000000cf5fb10  000000000ce6d450 
0000000003e2cff0:  000000000ce6cc20  0000000004512229 
0000000003e2d000:  0000000000000010  00000000046443a3 
0000000003e2d010:  000000000ce6d530  0000000000005f11 
0000000003e2d020:  000000000ce6cc20  000000000ce6cd18 
0000000003e2d030:  000000000ce948f0  000000000529e121 
0000000003e2d040:  0000000000000000  000000000ce948f0 
0000000003e2d050:  0000000000000010  0000000000000001 
0000000003e2d060:  0000000000000400  000000000451244c 
0000000003e2d070:  0000000000000010  00000000046443a3 
0000000003e2d080:  000000000c87f510  000000000cf69200 
runtime: unknown pc 0x52a215c
stack: frame={sp:0x3e2cf90, fp:0x0} stack=[0x3c31ed0,0x3e2fed0)
0000000003e2ce90:  52005a0054002000  0000000000000000 
0000000003e2cea0:  0000000000000000  0000000000000000 
0000000003e2ceb0:  59592f4d4d2f4444  2e00440044000000 
0000000003e2cec0:  52002e004d004d00  4800480020005200 
0000000003e2ced0:  4d003a0034003200  530053003a004900 
0000000003e2cee0:  2000460046005800  000052005a005400 
0000000003e2cef0:  0000000000000000  0000000000000000 
0000000003e2cf00:  0000000000000000  0000000000000000 
0000000003e2cf10:  0000000000000000  0000000000000000 
0000000003e2cf20:  000050add4648a1b  00000000052944b0 
0000000003e2cf30:  000000000ce716d0  000000000ce6d710 
0000000003e2cf40:  000000000ce6d710  000000000ce7eac8 
0000000003e2cf50:  3a494d3a34324848  5a54204646585353 
0000000003e2cf60:  000000000c539ef8  000000000464869c 
0000000003e2cf70:  0000000000000001  0000000000000000 
0000000003e2cf80:  0000000000000000  0000000000000000 
0000000003e2cf90: <000000000c539ef8  0000000003e2d048 
0000000003e2cfa0:  000000000ce7c9f0  00000000045137fe 
0000000003e2cfb0:  000000000c539880  0000000000000000 
0000000003e2cfc0:  0000000000000000  000000000ce6d530 
0000000003e2cfd0:  000000000ce7c9f0  00000000053d9e1e 
0000000003e2cfe0:  000000000cf5fb10  000000000ce6d450 
0000000003e2cff0:  000000000ce6cc20  0000000004512229 
0000000003e2d000:  0000000000000010  00000000046443a3 
0000000003e2d010:  000000000ce6d530  0000000000005f11 
0000000003e2d020:  000000000ce6cc20  000000000ce6cd18 
0000000003e2d030:  000000000ce948f0  000000000529e121 
0000000003e2d040:  0000000000000000  000000000ce948f0 
0000000003e2d050:  0000000000000010  0000000000000001 
0000000003e2d060:  0000000000000400  000000000451244c 
0000000003e2d070:  0000000000000010  00000000046443a3 
0000000003e2d080:  000000000c87f510  000000000cf69200 

goroutine 18 [syscall]:
gopkg.in/rana/ora%2ev4._Cfunc_OCIStmtFetch2(0xce7c9f0, 0xce6cc20, 0x200000000, 0x0, 0x0)
	_cgo_gotypes.go:1319 +0x54
gopkg.in/rana/ora%2ev4.(*Rset).beginRow.func1(0xce7c9f0, 0xce6cc20, 0x200000000, 0x0, 0xc0422f4bd0)
	C:/Users/OdilzodaM/go/src/gopkg.in/rana/ora.v4/rset.go:262 +0xb8
gopkg.in/rana/ora%2ev4.(*Rset).beginRow(0xc0422da0e0, 0x0, 0x0)
	C:/Users/OdilzodaM/go/src/gopkg.in/rana/ora.v4/rset.go:262 +0x3c0
gopkg.in/rana/ora%2ev4.(*Rset).Next(0xc0422da0e0, 0x0)
	C:/Users/OdilzodaM/go/src/gopkg.in/rana/ora.v4/rset.go:370 +0xf3
iborg_integration/models.GetAccounts(0xc042280031, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	C:/Users/OdilzodaM/go/src/iborg_integration/models/accounts.go:59 +0x392
iborg_integration/routes.getAccounts(0xc0422ea000)
	C:/Users/OdilzodaM/go/src/iborg_integration/routes/accounts.go:11 +0x74
github.com/gin-gonic/gin.(*Context).Next(0xc0422ea000)
	C:/Users/OdilzodaM/go/src/github.com/gin-gonic/gin/context.go:108 +0x4a
github.com/gin-gonic/gin.RecoveryWithWriter.func1(0xc0422ea000)
	C:/Users/OdilzodaM/go/src/github.com/gin-gonic/gin/recovery.go:48 +0x61
github.com/gin-gonic/gin.(*Context).Next(0xc0422ea000)
	C:/Users/OdilzodaM/go/src/github.com/gin-gonic/gin/context.go:108 +0x4a
github.com/gin-gonic/gin.LoggerWithWriter.func1(0xc0422ea000)
	C:/Users/OdilzodaM/go/src/github.com/gin-gonic/gin/logger.go:84 +0xd3
github.com/gin-gonic/gin.(*Context).Next(0xc0422ea000)
	C:/Users/OdilzodaM/go/src/github.com/gin-gonic/gin/context.go:108 +0x4a
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest(0xc0422aa240, 0xc0422ea000)
	C:/Users/OdilzodaM/go/src/github.com/gin-gonic/gin/gin.go:361 +0x58d
github.com/gin-gonic/gin.(*Engine).ServeHTTP(0xc0422aa240, 0xc8a420, 0xc0422da000, 0xc042147300)
	C:/Users/OdilzodaM/go/src/github.com/gin-gonic/gin/gin.go:326 +0x15a
net/http.serverHandler.ServeHTTP(0xc0422824e0, 0xc8a420, 0xc0422da000, 0xc042147300)
	C:/Go/src/net/http/server.go:2694 +0xc3
net/http.(*conn).serve(0xc0422883c0, 0xc8ae20, 0xc042228c80)
	C:/Go/src/net/http/server.go:1830 +0x658
created by net/http.(*Server).Serve
	C:/Go/src/net/http/server.go:2795 +0x282

goroutine 1 [IO wait]:
internal/poll.runtime_pollWait(0x2ed0ea0, 0x72, 0xc867c0)
	C:/Go/src/runtime/netpoll.go:173 +0x5e
internal/poll.(*pollDesc).wait(0xc0422b0488, 0x72, 0xf89400, 0x0, 0x0)
	C:/Go/src/internal/poll/fd_poll_runtime.go:85 +0xa2
internal/poll.(*ioSrv).ExecIO(0xfca468, 0xc0422b02d8, 0xc04226e720, 0x1, 0x0, 0x458)
	C:/Go/src/internal/poll/fd_windows.go:223 +0x13a
internal/poll.(*FD).acceptOne(0xc0422b02c0, 0x458, 0xc0422c41c0, 0x2, 0x2, 0xc0422b02d8, 0x47a4d9, 0xc0420739e8, 0x41220f, 0x10)
	C:/Go/src/internal/poll/fd_windows.go:793 +0xae
internal/poll.(*FD).Accept(0xc0422b02c0, 0xc04226a410, 0x0, 0x0, 0x0, 0x0, 0xc000000000, 0x0, 0x0, 0x0, ...)
	C:/Go/src/internal/poll/fd_windows.go:827 +0x142
net.(*netFD).accept(0xc0422b02c0, 0xc0422884e0, 0xc042073b58, 0x402858)
	C:/Go/src/net/fd_windows.go:192 +0x86
net.(*TCPListener).accept(0xc04226c080, 0xc042073b88, 0x4016fe, 0xc0422884e0)
	C:/Go/src/net/tcpsock_posix.go:136 +0x35
net.(*TCPListener).AcceptTCP(0xc04226c080, 0xc042073bd0, 0xc042073bd8, 0x18)
	C:/Go/src/net/tcpsock.go:246 +0x50
net/http.tcpKeepAliveListener.Accept(0xc04226c080, 0xc1a640, 0xc042288460, 0xc8aee0, 0xc042268c30)
	C:/Go/src/net/http/server.go:3216 +0x36
net/http.(*Server).Serve(0xc0422824e0, 0xc8aa20, 0xc04226c080, 0x0, 0x0)
	C:/Go/src/net/http/server.go:2770 +0x1ac
net/http.(*Server).ListenAndServe(0xc0422824e0, 0xc0422824e0, 0xc04226a390)
	C:/Go/src/net/http/server.go:2711 +0xb0
net/http.ListenAndServe(0xc042286570, 0x5, 0xc853c0, 0xc0422aa240, 0x1, 0x44381e)
	C:/Go/src/net/http/server.go:2969 +0x81
github.com/gin-gonic/gin.(*Engine).Run(0xc0422aa240, 0xc042073db8, 0x1, 0x1, 0x0, 0x0)
	C:/Users/OdilzodaM/go/src/github.com/gin-gonic/gin/gin.go:287 +0x13f
iborg_integration/routes.Init()
	C:/Users/OdilzodaM/go/src/iborg_integration/routes/routes.go:34 +0x20b
main.main()
	C:/Users/OdilzodaM/go/src/iborg_integration/main.go:18 +0x17b

goroutine 19 [IO wait]:
internal/poll.runtime_pollWait(0x2ed0d00, 0x72, 0xc867c0)
	C:/Go/src/runtime/netpoll.go:173 +0x5e
internal/poll.(*pollDesc).wait(0xc0422b0a08, 0x72, 0xf89400, 0x0, 0x0)
	C:/Go/src/internal/poll/fd_poll_runtime.go:85 +0xa2
internal/poll.(*ioSrv).ExecIO(0xfca468, 0xc0422b0858, 0xc1a418, 0x40, 0x38, 0xb67a00)
	C:/Go/src/internal/poll/fd_windows.go:223 +0x13a
internal/poll.(*FD).Read(0xc0422b0840, 0xc0422c8000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
	C:/Go/src/internal/poll/fd_windows.go:484 +0x248
net.(*netFD).Read(0xc0422b0840, 0xc0422c8000, 0x1000, 0x1000, 0xc042255978, 0x7fd942, 0xb67a00)
	C:/Go/src/net/fd_windows.go:151 +0x56
net.(*conn).Read(0xc04226c098, 0xc0422c8000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
	C:/Go/src/net/net.go:176 +0x71
net/http.(*connReader).Read(0xc042268d80, 0xc0422c8000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
	C:/Go/src/net/http/server.go:764 +0xff
bufio.(*Reader).fill(0xc04225c240)
	C:/Go/src/bufio/bufio.go:100 +0x125
bufio.(*Reader).ReadSlice(0xc04225c240, 0xa, 0xc042255ad8, 0x4114ed, 0x3aa368, 0x0, 0xc042255ac0)
	C:/Go/src/bufio/bufio.go:341 +0x33
bufio.(*Reader).ReadLine(0xc04225c240, 0xc0422ca000, 0x100, 0xf8, 0xbd9ea0, 0x1, 0x100c04203ac00)
	C:/Go/src/bufio/bufio.go:370 +0x3b
net/textproto.(*Reader).readLineSlice(0xc042268db0, 0xc04208d001, 0xc042255ba8, 0x41220f, 0x100, 0xbd9ea0)
	C:/Go/src/net/textproto/reader.go:55 +0x77
net/textproto.(*Reader).ReadLine(0xc042268db0, 0xc0422ca000, 0x0, 0x0, 0x72)
	C:/Go/src/net/textproto/reader.go:36 +0x32
net/http.readRequest(0xc04225c240, 0x0, 0xc0422ca000, 0x0, 0x0)
	C:/Go/src/net/http/request.go:929 +0x93
net/http.(*conn).readRequest(0xc042288460, 0xc8ae20, 0xc042272440, 0x0, 0x0, 0x0)
	C:/Go/src/net/http/server.go:944 +0x176
net/http.(*conn).serve(0xc042288460, 0xc8ae20, 0xc042272440)
	C:/Go/src/net/http/server.go:1768 +0x4e3
created by net/http.(*Server).Serve
	C:/Go/src/net/http/server.go:2795 +0x282

goroutine 34 [IO wait]:
internal/poll.runtime_pollWait(0x2ed0dd0, 0x72, 0xc867c0)
	C:/Go/src/runtime/netpoll.go:173 +0x5e
internal/poll.(*pollDesc).wait(0xc0422b0748, 0x72, 0xf89400, 0x0, 0x0)
	C:/Go/src/internal/poll/fd_poll_runtime.go:85 +0xa2
internal/poll.(*ioSrv).ExecIO(0xfca468, 0xc0422b0598, 0xc1a418, 0x0, 0x0, 0x0)
	C:/Go/src/internal/poll/fd_windows.go:223 +0x13a
internal/poll.(*FD).Read(0xc0422b0580, 0xc0422741c1, 0x1, 0x1, 0x0, 0x0, 0x0)
	C:/Go/src/internal/poll/fd_windows.go:484 +0x248
net.(*netFD).Read(0xc0422b0580, 0xc0422741c1, 0x1, 0x1, 0x0, 0x0, 0x0)
	C:/Go/src/net/fd_windows.go:151 +0x56
net.(*conn).Read(0xc04226c090, 0xc0422741c1, 0x1, 0x1, 0x0, 0x0, 0x0)
	C:/Go/src/net/net.go:176 +0x71
net/http.(*connReader).backgroundRead(0xc0422741b0)
	C:/Go/src/net/http/server.go:668 +0x61
created by net/http.(*connReader).startBackgroundRead
	C:/Go/src/net/http/server.go:664 +0xd5
rax     0x0
rbx     0x0
rcx     0xce7c9f0
rdi     0x0
rsi     0xce6d450
rbp     0x0
rsp     0x3e2cf90
r8      0x400f
r9      0x0
r10     0x0
r11     0xce7c9f0
r12     0x0
r13     0x0
r14     0x0
r15     0xce7c9f0
rip     0x52a215c
rflags  0x10206
cs      0x33
fs      0x53
gs      0x2b

Process finished with exit code 0

My code is next

	getAccCall, err := ses.Prep("BEGIN z$iborg_services_lib.get_accounts(:customerId, :accounts, :errorCode, :errorDescription); END;")
	defer getAccCall.Close()

	if err != nil {
		panic(err)
	}
	accountsCursor := &ora.Rset{}
	_, err = getAccCall.Exe(customerID, accountsCursor, &errorCode, &errorDescription)

	if err != nil {
		panic(err)
	}

	fieldNames := accountsCursor.ColumnIndex()

	if accountsCursor.IsOpen() {
		err := accountsCursor.Err()
		if err == nil {
			for accountsCursor.Next() {
				fmt.Println("ok")

				account.AccNumber = accountsCursor.Row[fieldNames["C_NUMBER"]].(string)
				account.Balance = accountsCursor.Row[fieldNames["BALANCE"]].(string)
				account.Branch = accountsCursor.Row[fieldNames["BRANCH"]].(string)
				account.Currency = accountsCursor.Row[fieldNames["CURRENCY"]].(string)
				account.CurrencyISO = accountsCursor.Row[fieldNames["CURRENCY_ISO"]].(string)
				account.Opened = accountsCursor.Row[fieldNames["OPENED"]].(string)
				account.Status = accountsCursor.Row[fieldNames["STATUS"]].(string)

				accountsList.Accounts = append(accountsList.Accounts, account)

			}
		}

	}

Error is in this line for accountsCursor.Next() {
And if we go dipper with debugger it is here beginRow()

r := C.OCIStmtFetch2(
		rset.ocistmt,         //OCIStmt     *stmthp,
		env.ocierr,           //OCIError    *errhp,
		C.ub4(rset.fetchLen), //ub4         nrows,
		C.OCI_FETCH_NEXT,     //ub2         orientation,
		C.sb4(0),             //sb4         fetchOffset,
		C.OCI_DEFAULT)        //ub4         mode );
@mehrdod mehrdod changed the title Getting error .Next() Getting error in the.Next() method Sep 19, 2018
@tgulacsi
Copy link
Collaborator

tgulacsi commented Sep 19, 2018 via email

@mehrdod
Copy link
Author

mehrdod commented Oct 22, 2018

Don't know. Can you try to use gopkg.in/goracle.v2 ? That's maintained, gopkg.in/rana/ora.v4 is not. Mehrdod Odilzoda [email protected] ezt írta (időpont: 2018. szept. 19., Sze, 16:18):

@tgulacsi Still can't solve this issue. I should defenetly use another driver. Is it any example avalable for "goracle.v2"? Thanks

@tgulacsi
Copy link
Collaborator

You can use goracle.WrapRows to create a database/sql.Rows which can be used just as a regular Rows, with its Scan method - no need to find out the columns' types exactly.

@mehrdod
Copy link
Author

mehrdod commented Oct 23, 2018 via email

@tgulacsi
Copy link
Collaborator

See go-goracle/goracle#101

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants