Make server Ctrl-C safe [patch]

11 views
Skip to first unread message

Gracjan Polak

unread,
Apr 20, 2010, 1:43:05 AM4/20/10
to ha...@googlegroups.com

Hi Jeremy and all,

Would be really good to include this patch before 0.5, as it really enables GHCi-style development for GuestBook example app.

--
Gracjan

--
You received this message because you are subscribed to the Google Groups "HAppS" group.
To post to this group, send email to ha...@googlegroups.com.
To unsubscribe from this group, send email to happs+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/happs?hl=en.
make-server-ctrl_c-safe.dpatch

Jeremy Shaw

unread,
Apr 20, 2010, 8:45:31 AM4/20/10
to ha...@googlegroups.com
applied. Do you think we should add withSystemState' to happstack-
state ?

Also, I am not convinced this patch will really enable GHCi style
development. In my experience, killing the main http thread does not
actually stop the server from listening, because there are other
threads still listening. And even if you reload/restart the
application, your request might be handled by an old thread? As a
result, you are force to completely restart GHCi between runs :(

There is some code in Happstack.Util.Concurrent related to this
problem -- no idea if it is actually useful though.

thanks for the patches though!
- jeremy
> <make-server-ctrl_c-safe.dpatch>

Gracjan Polak

unread,
Apr 20, 2010, 9:15:37 AM4/20/10
to HAppS

On 20 Kwi, 14:45, Jeremy Shaw <jer...@n-heptane.com> wrote:
> applied. Do you think we should add withSystemState' to happstack-
> state ?

I took it from happstack-extra and I'm all for putting it into
happstack proper!

>
> Also, I am not convinced this patch will really enable GHCi style  
> development. In my experience, killing the main http thread does not  
> actually stop the server from listening, because there are other  
> threads still listening. And even if you reload/restart the  
> application, your request might be handled by an old thread? As a  
> result, you are force to completely restart GHCi between runs :(

Well, works in devel scenario where I'm the sole user of the app. Kill
the logger (so files are closed), kills state (so files are closed)
and kills http thread (so port is freed and socket is closed). For
devel and debug this is enough!

BTW: killThread with httpPid really closes the socket, because
simpleHTTP has proper `bracket` where it should.

It is probably also correct in the compiled code case, when somebody
hits Ctrl-C then it tries to do rather clean exit.

> There is some code in Happstack.Util.Concurrent related to this  
> problem -- no idea if it is actually useful though.

I'll check that later, I've never looked inside this module before...

>
> thanks for the patches though!
> - jeremy
>
> On Apr 20, 2010, at 12:43 AM, Gracjan Polak wrote:
>
>
>
>
>
> > Hi Jeremy and all,
>
> > Would be really good to include this patch before 0.5, as it really  
> > enables GHCi-style development for GuestBook example app.
>
> > --
> > Gracjan
>
> > --
> > You received this message because you are subscribed to the Google  
> > Groups "HAppS" group.
> > To post to this group, send email to ha...@googlegroups.com.
> > To unsubscribe from this group, send email to happs+un...@googlegroups.com
> > .
> > For more options, visit this group athttp://groups.google.com/group/happs?hl=en
Reply all
Reply to author
Forward
0 new messages