Skip to content

cgo on win32 and dll: malloc/free - deadlock #5487

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

Closed
simonhege opened this issue May 16, 2013 · 4 comments
Closed

cgo on win32 and dll: malloc/free - deadlock #5487

simonhege opened this issue May 16, 2013 · 4 comments

Comments

@simonhege
Copy link

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. Compile the attached c code as a dll
2. Compile the attached go code using the dll produced during previous step
3. Run the generated executable

(see build.bat in the attached zip file)

//The code sample is the same as in issue #5273, corrected to link with dll.

What is the expected output?
[DLL] Hello from go

What do you see instead?
fatal error: malloc/free - deadlock
[signal 0xc0000005 code=0x1 addr=0x2f0 pc=0x414bf8]

goroutine 1 [syscall]:
[fp=0x25177c] return()
        C:/go/src/pkg/runtime/asm_386.s:472
[fp=0x2517a4] runtime.cgocall(0x41e053, 0x2517b0)
        C:/go/src/pkg/runtime/cgocall.c:162 +0x10a
[fp=0x2517b0] main._Cfunc_Echo(0x572fb8)
        C:/Users/SIMONH~1/AppData/Local/Temp/go-build942746867/_/E_/GoIssue/GoEc
ho/_obj/_cgo_defun.c:44 +0x31
[fp=0x2517c4] main.main()
        C:/Users/SIMONH~1/AppData/Local/Temp/go-build942746867/_/E_/GoIssue/GoEc
ho/_obj/main.cgo1.go:19 +0x55
[fp=0x2517dc] runtime.main()
        C:/go/src/pkg/runtime/proc.c:182 +0x8e
[fp=0x2517e0] runtime.goexit()
        C:/go/src/pkg/runtime/proc.c:1223

goroutine 2 [syscall]:

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

Which operating system are you using?
Windows 7/x86

Which version are you using?  (run 'go version')
go version go1.1 windows/386

(compiled from source with gcc 4.6.2)

Please provide any additional information below.
I came up to this issue with a more complex library which works fine on linux x64 (.so
library). It seems to be windows related only.

I've also tried with the curent tip version and the issue is the same.

Attachments:

  1. GoIssue.zip (1708 bytes)
@alexbrainman
Copy link
Member

Comment 1:

simonhege,
It looks to me, your issue is not broken any more. Since
https://code.google.com/p/go/source/detail?r=75123d9d5b96
commit. I am no good with cgo and gcc, and I don't have time to investigate it further,
but if you are OK I will close it.
Alex

Labels changed: added os-windows.

Status changed to WaitingForReply.

@simonhege
Copy link
Author

Comment 2:

I confirm that my tests cases are not broken any more.
Thank you for your work.
Simon

@minux
Copy link
Member

minux commented May 25, 2013

Comment 3:

Status changed to Fixed.

@gopherbot
Copy link
Contributor

Comment 4 by [email protected]:

I also meet this issue when I use access DB in win32 xp.

@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

4 participants