Issue with your sample code

8 views
Skip to the first unread message

Dean

unread,
24 Apr 2016, 09:43:4524/04/2016
to sn...@snapframework.com
Hello,

I would like to report one issue with sample code on your page, or
rather with the simpleHttpServe function it is indirectly calling.

http://snapframework.com/docs/tutorials/snap-api

When I load your sample into cabal repl it works but only the first
time. If I break out of the main loop with Ctrl+c and try to run it
again I get error that is pasted at the end of this email. I tested this
under Windows 8.1, ghc 7.8.4, snap-0.14.0.6-808, snap-core-0.9.8.0-24,
snap-server-0.9.5.1.

Code is not closing log file handles that it opens when I break out of
the loop with C-c. This is unfortunate because it makes it impossible to
use cabal repl for development to speed up write-compile-run cycle.
Interpreter has to be restarted after every change which defeats the
purpose of using it.

I took a quick look at your code and it seems that simpleHttpServe is
trying to handle this with withLoggers function but I couldn't yet
figure out why it isn't working.

Kind regards,

Dean Kostadinović

*Main> main
no port specified, defaulting to port 8000
Listening on http://0.0.0.0:8000/
<breaking out with C-c C-c>
Interrupted.
*Main> main
no port specified, defaulting to port 8000
Listening on http://0.0.0.0:8000/
Can't open log file "log/access.log".
Can't open log file "log/error.log".
Exception: log/access.log: openFile: resource busy (file is locked)
Exception: log/error.log: openFile: resource busy (file is locked)
Logging to stderr instead. **THIS IS BAD, YOU OUGHT TO FIX THIS**

Logging to stderr instead. **THIS IS BAD, YOU OUGHT TO FIX THIS**

[24/Apr/2016:15:32:12 +0200] Server.httpServe: START, binding to
[http://0.0.0.0
:8000/]

<code hangs in here, but if I try to connect to the server it shuts down>

Shutting down...




Reply all
Reply to author
Forward
0 new messages