Giter VIP home page Giter VIP logo

Comments (6)

eriklupander avatar eriklupander commented on July 17, 2024

Update / FYI:

We executed our application (which uses this module) with the -gcflags=all=-d=checkptr arguments, which reported two issues with unsafe pointers. One in initDriver in driver.go and one in Conn.setAutoCommitAttr in tx.go.

By applying the changes from asifjalil/cli@2598d7f into a local fork of this module, we got rid of the unsafe pointer warnings. Our application builds and runs fine with the modified go_ibm_db fork, but since the fatal error: invalid pointer found on stack error is very rare we'll need much more testing before we can say for sure it solved our problems.

from go_ibm_db.

vmathur12 avatar vmathur12 commented on July 17, 2024

@eriklupander Could you please provide script/steps to reproduce this issue would be helpful. Thanks.

from go_ibm_db.

eriklupander avatar eriklupander commented on July 17, 2024

Hi,

the actual error with fatal error: invalid pointer found on stack is very hard to reproduce, it happens so rarely I cannot really create a program that certainly would reproduce the problem.

However, you can easily check the go_ibm_db module's codebase for bad pointer usage by entering the /testdata folder and run:

go run -gcflags=all=-d=checkptr main.go

This results in (truncated) running locally on my Mac:

fatal error: checkptr: pointer arithmetic computed bad pointer value

goroutine 1 [running, locked to thread]:
runtime.throw({0x10012a140?, 0x1000cfe40?})
	/usr/local/opt/go/libexec/src/runtime/panic.go:1047 +0x5d fp=0xc000066c38 sp=0xc000066c08 pc=0x10003491d
runtime.checkptrArithmetic(0x1?, {0x0?, 0x1001f0000?, 0x10034a9a8?})
	/usr/local/opt/go/libexec/src/runtime/checkptr.go:52 +0xbb fp=0xc000066c68 sp=0xc000066c38 pc=0x10000919b
github.com/ibmdb/go_ibm_db.initDriver()
	/Users/<username>/golang/pkg/mod/github.com/ibmdb/[email protected]/driver.go:37 +0xb2 fp=0xc000066ce0 sp=0xc000066c68 pc=0x1000c6952
github.com/ibmdb/go_ibm_db.init.0()
	/Users/<username>/golang/pkg/mod/github.com/ibmdb/[email protected]/driver.go:62 +0x3f fp=0xc000066d20 sp=0xc000066ce0 pc=0x1000c6b9f
runtime.doInit(0x1001e78a0)

from go_ibm_db.

vmathur12 avatar vmathur12 commented on July 17, 2024

@eriklupander
We are seeing the checkptr issue because this is a new feature added in Go 1.14
-d=checkptr as a compile-time option for adding instrumentation to check that Go code is following unsafe.Pointer safety rules dynamically. This can be disabled with -gcflags=all=-d=checkptr=0.
go run -gcflags=all=-d=checkptr=0 main.go

from go_ibm_db.

eriklupander avatar eriklupander commented on July 17, 2024

Thanks for your answer.

The issue is that the code in driver.go and tx.go seems to be incorrect given that the checkptr check detects an issue. Turning off the checkptr check doesn't solve the root issue which is that we're getting those "invalid pointer found on stack" panics.

After applying the same fixes (in our local fork of this module) as in asifjalil/cli@2598d7f we have not seen any more panics and the checkptr check runs without complaining.

from go_ibm_db.

bimalkjha avatar bimalkjha commented on July 17, 2024

Fix for this issue has been delivered using PR #215. Closing the issue now. Thanks.

from go_ibm_db.

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.