You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See Go definition of CheckConnection() function attached in Sample.zip. I exported CheckConnection Go function as C function in .so file using following command. This function makes http GET request to google.com using http.client.
go build -o libapp.so -buildmode=c-shared libapp.go
Then using generated .SO and .h, called exported Go function from my C test program. Below is the command I used to compile and build my C test program.
gcc -m32 -o ctest ctest.c ./libapp.so
In the C test program, I called exported CheckConnection() function from main() and from forked process. Function call from main() gets succeeded whereas function call from forked process hangs at
res,err := myClient.Get("https://www.google.com")
Attached is the sample code reproducible. [(Sample.zip)] Sample.zip
What did you expect to see?
Both calls to CheckConnection() should succeed.
What did you see instead?
CheckConnection() call from main() succeed and CheckConnection() call from forked process hangs.
The text was updated successfully, but these errors were encountered:
odeke-em
changed the title
http.client GET request hangs in Linux forked process exported via Cgo shared library
net/http: GET request hangs in Linux forked process exported via Cgo shared library
Jul 31, 2021
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
See Go definition of CheckConnection() function attached in Sample.zip. I exported CheckConnection Go function as C function in .so file using following command. This function makes http GET request to google.com using http.client.
Then using generated .SO and .h, called exported Go function from my C test program. Below is the command I used to compile and build my C test program.
In the C test program, I called exported CheckConnection() function from main() and from forked process. Function call from main() gets succeeded whereas function call from forked process hangs at
Attached is the sample code reproducible. [(Sample.zip)]
Sample.zip
What did you expect to see?
Both calls to CheckConnection() should succeed.
What did you see instead?
CheckConnection() call from main() succeed and CheckConnection() call from forked process hangs.
The text was updated successfully, but these errors were encountered: