I've got a server-like program in Windows 10 where the main program waits for the requests with http.Handle(dst, handlerStruct), and for every query does the corresponding operations and returns a result or just prints something through the screen.
It usually works fine, but sometimes, and just sometimes, when I leave the program running "waiting" for requests to come in for a long time (3 minutes up) and then I send a request, it just gets "stucked" until I press CTRL+C, and then it returns the values inmediately. So it looks like the program runs well, but the returning thread is having a break or something when I leave it a long time without requests.
This happens ever since I started developing the program, and not only when using functions with goroutines.
For me it looks like it has more to do with Windows 10 than with Golang itself, but it's just very annoying, and of course I don't want this to happen with my server...
Hope you can see what's going wrong here...
Thanks.
EDIT
This is the main program waiting for the requests:
func main() {
runtime.GOMAXPROCS(10000000)
http.Handle("/sameDayCombinations", CBR.SameDayCombinationsHandler{})
http.ListenAndServe(":8080", nil)
}
Now this is the code of ServeHTTP for the handler:
func (h SameDayCombinationsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
t1 := time.Now()
q := common.DecodeRequest(r)
json := common.EncodeAnswer((&h).RetrieveSpecificSolutions(q.Year, q.Month, q.Day, q.DepID, q.ArrID, q.Adults, q.Children, q.Infants), true)
fmt.Fprintf(w, json)
t2 := time.Now()
fmt.Println(t2.Sub(t1))
}
EDIT2
Here I add the stack of a program execution after the appearance of this weird behavior. So, after doing CTRL+C I got this; looks pretty normal to me.
Though, now, by empirical demonstration, I'm sure it has to do with the console Prints (probably large prints?). That's a good new, cause it'll only happen while debugging, but stills a weird behavior...