net/http: Client.Do hangs (in Linux Daemon) when exported via Cgo shared library #47077
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
Milestone
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 given below. I exported CheckConnection Go function as C function in .so file using following command.
go build -o mygolib.so -buildmode=c-shared mygolib.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 -o testclient testclient.c ./mygolib.so
With this testclient program in C I am able to get the response from myClient. However when I included this .so and .h file in our existing Linux service (in C only),I am unable to make http request. Below is my Go function. Call gets blocked at below line, does not timeout or gives any error. testclient and linux service is on same machine. However from testclient function returns me the response but from linux service call gets hang.
res,err := myClient.Do(req)
What did you expect to see?
res,err := myClient.Do(req)
Above call should either return me the response string or timeout error.
What did you see instead?
Call gets hand on below code line -
res,err := myClient.Do(req)
The text was updated successfully, but these errors were encountered: