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

cgo crash (malloc/free - deadlock) on linux/arm #5114

Closed
ajstarks opened this issue Mar 23, 2013 · 9 comments
Closed

cgo crash (malloc/free - deadlock) on linux/arm #5114

ajstarks opened this issue Mar 23, 2013 · 9 comments
Milestone

Comments

@ajstarks
Copy link
Contributor

pi@raspberrypi ~ $ go version
go version devel +c61a75775ab6 Fri Mar 22 17:46:45 2013 -0400 linux/arm
pi@raspberrypi ~ $ cd $ov/go-client/hellovg
pi@raspberrypi ~/gowork/src/github.com/ajstarks/openvg/go-client/hellovg $ ./hellovg
fatal error: malloc/free - deadlock
[signal 0xb code=0x1 addr=0x2f0 pc=0x2cc04]

goroutine 1 [syscall]:
[fp=0xb689ff1c] return()
    /home/pi/go/src/pkg/runtime/asm_arm.s:275
[fp=0xb689ff44] runtime.cgocall(0x33a54, 0xb576c)
    /home/pi/go/src/pkg/runtime/cgocall.c:149 +0xd8
[fp=0xb689ff6c] runtime.cgocall(0xb6f5f5f5, 0xff0000)
    /home/pi/go/src/pkg/runtime/cgocall.c:149 +0xd8

goroutine 2 [syscall]:

Note that all tests passed for the build.

This is my standard test when I pull a new release on my raspi-- rebuild everything,
rebuild the cgo-based openvg library, rebuild all clients.

What do you see instead?

Crash

Which compiler are you using (5g, 6g, 8g, gccgo)?

5g, cgo

Which operating system are you using?

Linux raspberrypi 3.6.11+ #385 PREEMPT Fri Mar 1 21:53:22 GMT 2013 armv6l GNU/Linux

Which version are you using?  (run 'go version')

go version devel +c61a75775ab6 Fri Mar 22 17:46:45 2013 -0400 linux/arm

Please provide any additional information below.

The crashing program is linked with a cgo-created OpenVG library. See:
https://github.com/ajstarks/openvg/blob/master/openvg.go
@ajstarks
Copy link
Contributor Author

Comment 1:

here is an example crashing client:
// first OpenVG program
package main
import (
    "bufio"
    "github.com/ajstarks/openvg"
    "os"
)
func main() {
    width, height := openvg.Init() // OpenGL, etc initialization
    w2 := float64(width / 2)
    h2 := float64(height / 2)
    w := float64(width)
    openvg.Start(width, height)                               // Start the picture
    openvg.BackgroundColor("black")                           // Black background
    openvg.FillRGB(44, 100, 232, 1)                           // Big blue marble
    openvg.Circle(w2, 0, w)                                   // The "world"
    openvg.FillColor("white")                                 // White text
    openvg.TextMid(w2, h2, "hello, world", "serif", width/10) // Greetings 
    openvg.End()                                              // End the picture
    bufio.NewReader(os.Stdin).ReadBytes('\n')                 // Pause until [RETURN]
    openvg.Finish()                                           // Graphics cleanup
}

@ajstarks
Copy link
Contributor Author

Comment 2:

Further testing shows that the bug began somewhere between revision 61a75775ab6 (March
22, crashing) and revision 68679922e4fe (March 19, working)

@ajstarks
Copy link
Contributor Author

Comment 3:

Further testing shows that the bug began somewhere between revision 0d7891ca5e06 (March
21, crashing) and revision 68679922e4fe (March 19, working)

@ajstarks
Copy link
Contributor Author

Comment 4:

Could be related to issue #5099.  My example also uses globals

@ajstarks
Copy link
Contributor Author

ajstarks commented Apr 8, 2013

Comment 5:

The problem persists with go1.1beta2.

@davecheney
Copy link
Contributor

Comment 6:

Possibly duplicate of https://golang.org/issue/5227
Can you please apply https://golang.org/cl/8602044/ and test.

Labels changed: added priority-soon, go1.1, cgo, arch-arm, removed priority-triage.

@ajstarks
Copy link
Contributor Author

Comment 7:

Fixed when https://golang.org/cl/8602044/ is applied against go1.1beta2
(revision d58997478ec6)

@ajstarks
Copy link
Contributor Author

Comment 8:

tested the fix against bubtrail colortab hellovg hgrad planets randcircle raspi
shapedemo clients found in https://github.com/ajstarks/openvg/tree/master/go-client, all
build and run correctly.

@remyoudompheng
Copy link
Contributor

Comment 9:

This issue was closed by revision 0e76a94.

Status changed to Fixed.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants