Hi,

I'm trying to implement a http server and I need to bind the underlying 
socket to a specific VRF instance so that the server only listens on that 
VRF instance. When some specific event happens, the program needs to 
shutdown the http server. I'm using syscall.SetsockoptString() and option 
"SO_BINDTODEVICE".

This is what I observe:

   1. 
   
   if there is no SetsockoptString() to bind the underlying socket fd call, 
   the http server close call would succeed.
   2. 
   
   if there is a SetsockoptString() to bind the underlying socket fd call, 
   then the http server close won't complete. In fact, it stuck in close() and 
   won't return.
   
Seems in the path of close(), decref() does call fd.destroy(), and later on 
the program stuck in 

func poll_runtime_Semacquire(addr *uint32) {

     semacquire1(addr, false, semaBlockProfile, 0, waitReasonSemacquire) 
>>>>>>>>>>>>>> stuck here}

comparing #1 and #2, the state number for mu is different, so that 
fd.fdmu.decref() returns false and fd.destroy not getting called.

if fd.fdmu.decref() {return fd.destroy()}

I have my program attached to this email.

The same goes for http server Shutdown(context) call. My question, does 
golang net/http packet support this scenario, shutdown() or close a http 
server where the server has some explicit underlying socket fd binding? If 
so, what code change should I make?


Thank you very much.

Bing

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/83e45088-2ed0-4ab4-b058-cf1a496cd0edn%40googlegroups.com.

Attachment: http_server_close.go
Description: Binary data

Reply via email to