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

runtime: http/net exception - in dll context #26952

Closed
code34 opened this issue Aug 13, 2018 · 12 comments
Closed

runtime: http/net exception - in dll context #26952

code34 opened this issue Aug 13, 2018 · 12 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@code34
Copy link

code34 commented Aug 13, 2018

What version of Go are you using (go version)?

go 1.10 windows / amd64

Does this issue reproduce with the latest release?

i don't know

What operating system and processor architecture are you using (go env)?

windows
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\code34\AppData\Local\go-build
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\code34\go
set GORACE=
set GOROOT=C:\Go
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\code34\AppData\Local\Temp\go-build638089086=/tmp/go-build -gno-record-gcc-switches

What did you do?

I have a C program wich call a GO dll. The GO dll use net/http to retrieve a distant json. You can retrieve the C program and the go source file at this URL:
https://www.dropbox.com/s/21k6nm75zlxn68q/armaws_x64.zip?dl=0

You only have to call it in powershell, it will load automatically the dll file
.\callextension_x64.exe .\test_script.sqf

What did you expect to see?

The content of my http request. The same code source works when it's a simple .exe file.

What did you see instead?

An exception crash

Exception log file is at this place:
log.txt

@davecheney
Copy link
Contributor

@code34 please include the full text of the crash you received (please do not include a screenshot of the text)

@davecheney davecheney added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 13, 2018
@code34
Copy link
Author

code34 commented Aug 13, 2018

done i just added the log file at the end of post

@davecheney
Copy link
Contributor

Thank you. I don't understand where this exception is being produced. Is it possible to get the Go stack trace?

@code34
Copy link
Author

code34 commented Aug 13, 2018

yes of course. how can i retrieve it ?

@davecheney
Copy link
Contributor

I'm sorry I don't know. Hopefully someone else can help you.

@code34
Copy link
Author

code34 commented Aug 13, 2018

the body exception message change during each execution. I thought that a go routine continues to run when the dll finishes its execution. If i add a fmt.Println(data), i see the result is well returned.

@agnivade
Copy link
Contributor

You can send the kill -ABRT signal to the process to get goroutine stack traces.

@davecheney
Copy link
Contributor

davecheney commented Aug 13, 2018 via email

@code34
Copy link
Author

code34 commented Aug 13, 2018

for the memmove it has been tested, you can for exemple return:
data = "hello"

without http/net code it works, with http there is an exception.

how can i send kill -ABRT on windows ? is it a simple kill throught task manager ?

@code34
Copy link
Author

code34 commented Aug 13, 2018

i test again and effectively you are right. there is something relative to the memmove but i dont understand what. Cause when i use a very large string ouput it doesn't create any exception.

@davecheney
Copy link
Contributor

@code34 is this the test you mean?

//export RVExtension
func RVExtension(output *C.char, outputsize C.size_t, input *C.char) {
	data:= "hello"
	result := C.CString(data)
	defer C.free(unsafe.Pointer(result))
	C.memmove(unsafe.Pointer(output), unsafe.Pointer(result), outputsize - 1)
}

Do you see that C.memmove will attempt to copy outputsize - 1 bytes from result to output irrespective of the size of data?

@code34
Copy link
Author

code34 commented Aug 13, 2018

thanks you davecheney i better understand now 👍

i only manage the return of long variable size not the short.

@code34 code34 closed this as completed Aug 13, 2018
@mikioh mikioh changed the title http/net exception - in dll context runtime: http/net exception - in dll context Feb 26, 2019
@golang golang locked and limited conversation to collaborators Feb 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants