--- Log opened Tue Jul 21 00:00:30 2009
03:07 < butterfly_die> hey hapsters whats happenin
06:42 < dcoutts> how does one shut down a server these days?
06:43 < dcoutts> ctl-C used to work nicely
06:43 < dcoutts> now I get a stale state/db.lock file hanging around
07:02 < Oejet> dcoutts: Inside ghci, or standalone?
07:02 < dcoutts> standalone
07:38 < Oejet> Hm, then I don't know.
08:03 < Oejet> dcoutts: Something I could try to reproduce?
08:19 < mightybyte>  dcoutts: Ctrl-C works for me.
08:26 < mightybyte> dcoutts: Are you using the waitForTermination function?
08:29 < stepcut> dcoutts: do you call the shutdownSystem function (or whatever it is called)? That is what removes the lock
08:31 < dcoutts> I'm just running simpleHTTP
08:32 < mightybyte> with forkIO?
08:32 < dcoutts> nope
08:32 < dcoutts> run :: Server -> IO ()
08:32 < dcoutts> run server = simpleHTTP conf $ msum (impl server)
08:32 < mightybyte> That's probably the problem.
08:32 < dcoutts>   where
08:32 < dcoutts>     conf = nullConf { Happstack.Server.port = serverPort server }
08:32 < mightybyte> tid <- forkIO $ simpleHTTP...
08:33 < mightybyte> waitForTermination
08:33 < mightybyte> killThread tid
08:33 < mightybyte> shutdownSystem control
08:33 < dcoutts> what does waitForTermination do?
08:33  * dcoutts is suspicious since it takes no parameters
08:34 < mightybyte> I'm not sure.  I assume it is what waits for Ctrl-C
08:34 < stepcut> dcoutts: if you are just using simpleHTTP, then why do you have a state directory?
08:35 < dcoutts> stepcut: because I'm using happstack-data
08:35 < dcoutts> is there some new way of initialising the data/transaction system?
08:35 < mightybyte> waitForTermination hs here http://happstack.com/docs/0.2/happstack-state/0.2/src/Happstack-State-Control.html
08:35 < stepcut> dcoutts: same as always, startSystemState..
08:35 < dcoutts> http://code.haskell.org/hackage-server/Distribution/Server.hs
08:36 < dcoutts> stepcut: we've never used that
08:36 < dcoutts> not with happs or happstack
08:36 < dcoutts> ah, though we do use runTxSystem
08:37 < stepcut> dcoutts: right, I just saw that
08:37 < stepcut> dcoutts: there using runTxSystem is fine, that allows you to have control over where the state is stored
08:37 < stepcut> startSystemState is just a wrapper around it
08:37 < dcoutts> ok
08:38 < stepcut> but you should still call, shutdownSystem txCtl, on shutdown
08:38 < dcoutts> what I'd expect is that I catch the ctl-c exception from simpleHTTP and then use shutdownSystem
08:39 < stepcut> dcoutts: that exactly right. waitForTermination is a function for catching ctl-c
08:39 < dcoutts> which I should really do using bracket
08:39 < dcoutts> bracket startSystemState shutdownSystem $ \_ -> simpleHTTP ...
08:40 < stepcut> right
08:41 < stepcut> dcoutts: I use, waitForTermination becasue I do, forkIO $ simpleHTTP ..., so I need something to stop the application from immediately exiting
08:41 < dcoutts> right
08:41 < dcoutts> ok, thanks stepcut, mightybyte, Oejet
08:42 < dcoutts> stepcut: btw, on this topic, the thing I find rather weird is that the state components are global
08:42 < stepcut> dcoutts: using shutdownSystem will ensure that all the pending events are saved to disk rather than lost
08:43 < dcoutts> I'd feel much happier if I had to use the txctl in each query or transaction
08:43 < stepcut> dcoutts: yes, I have never liked the state compnents being global, because it means you can only have one
08:43 < dcoutts> I realise it's convenient in the simple case
08:43 < dcoutts> but I'd be quite happy to just pass the txctl around in the Server record, or some monad
08:44 < stepcut> dcoutts: right. but it is problematic if you want to have an application which integrates two unrelated happstack applications
08:44 < stepcut> (where, it == single global state)
08:44 < dcoutts> I wonder if the API could be extended so that we can use the stuff explicitly
08:44 < dcoutts> and then later you may consider deprecating the global 'convenience' versions
08:45 < stepcut> dcoutts: I think that should be doable
08:45 < dcoutts> if you do it, lemme know, I'd be happy to try adapting the hackage-server to use it
08:45 < stepcut> yeah
10:01 < Oejet> I am trying to get the formlet tutorial from
10:02 < Oejet> Chris Done to run, and it seems to work, except when updating the database:
10:04 < Oejet> Register: SqlError {seState = "", seNativeError = 1, seErrorMsg = "step: SQL logic error or missing database"}
10:04 < Oejet> (from: http://chrisdone.com/blog/html/2008-12-14-haskell-formlets-composable-web-form-construction-and-validation.html)
10:07 < Oejet> It happily reads from the database file, and the SQL seems to be well formed: "INSERT INTO `customer` (`username`,`password`) VALUES (?,?)"
--- Log closed Wed Jul 22 00:00:32 2009