Re: [go-nuts] Re: http.Server.Shutdown() crashing?

2017-07-14 Thread charlievx
Ah - that explains it. Even though the bug's been fixed, the behaviour's been bugging me! Thanks for the explanation :-) On Saturday, July 15, 2017 at 11:33:37 AM UTC+10, Matt Harden wrote: > > The reason it was exiting was because you didn't wait at the end of main() > after http.ListenAndServe

Re: [go-nuts] Re: http.Server.Shutdown() crashing?

2017-07-13 Thread charlievx
Well that makes sense! But shouldn't it have hung instead of exiting then? On Friday, July 14, 2017 at 12:01:36 PM UTC+10, Matt Harden wrote: > > Oh! In retrospect, it's obvious. The whole point of Shutdown() is to give > running handlers a chance to finish, so if we call it from within a handler

Re: [go-nuts] Re: http.Server.Shutdown() crashing?

2017-07-09 Thread charlievx
Yes! That works :-) Thanks so much. So apparently we cannot call *net.http.Server.Shutdown()* from a handler function. Maybe this should be added to the docs. On Monday, July 10, 2017 at 3:05:10 PM UTC+10, mikioh...@gmail.com wrote: > > calling Shutdown method of http.Server in a registered HTTP

Re: [go-nuts] Re: http.Server.Shutdown() crashing?

2017-07-09 Thread charlievx
Interesting - now I get the same messages: 2017/07/10 13:23:17 Server starting up... 2017/07/10 13:23:22 Server shutting down... test - before shutdown But the program doesn't stop! I need to Ctrl+C to stop it... I don't get it - why doesn't server.Shutdown() just work? On Monday, July 10, 201

[go-nuts] Re: http.Server.Shutdown() crashing?

2017-07-09 Thread charlievx
Just tried it but it doesn't work. The problem I started from is that server.Shutdown didn't wait for my requests to complete. (To check this I put in the time.Sleep(6000 * time.Millisecond)). When I narrowed down the problem it showed me that code after the Shutdown call wasn't being executed.

[go-nuts] http.Server.Shutdown() crashing?

2017-07-09 Thread charlievx
Hi, Go code after calling srv.Shutdown() simply isn't called. There is no error message, no dump, nothing. This is the output after visiting http://localhost:8080/stop on my browser 2017/07/09 13:58:40 Server starting up... 2017/07/09 13:58:44 Server shutting down... test - before shutdown Not