14:18:09 <Palmik> Hmm, ever gotten SIGSEGV with acid-state?
14:18:36 <stepcut> nope
14:19:02 <stepcut> and I use it a lot..
14:19:40 <stepcut> It's been a very long time since I got SIGSGEV at all from any Haskell app
14:20:44 <stepcut> I wonder what's going on
14:21:13 <Palmik> I started getting it after some refactoring and that's only if I do one specific DB operation and the Ctrl+C the application.
14:21:57 <stepcut> still sounds mysterious
14:22:22 <Palmik> It seems to happen when the checkpoint is being written, since when I try to run the app after that, I get "list: too few bytes; From:   demandInput"
14:24:26 <stepcut> well, if you kill the app in the middle of written a checkpoint, it is normal for the checkpoint to be corrupt.. but that wouldn't explain the SIGSEGV. if you delete the corrupted checkpoint, it should load with all your data intact, since the events that lead up to the checkpoint are still there
14:24:58 <stepcut> the acid-state tool, which hasn't been written yet, is supposed to have a recovery mode that helps with that
14:25:09 <stepcut> though, rm somecheckpoint is not that hard :)
14:25:24 <Palmik> How should I kill my app safely then?
14:26:10 <Palmik> Anyway, it seems to be some other problem, since (even though the log is being written to) the operation in question (again) appears to have no effect.
14:26:26 <stepcut> do you use waitForTermination?
14:26:36 <stepcut> THat should catch the first ^C and shutdown cleaning
14:26:59 <stepcut> but if you hit ^C a bunch of times.. then you can corrupt the checkpoint
14:29:41 <Palmik> I do not think I do.
14:55:48 <stepcut> i should probably put that in the crash course somewhere.. preferably somewhere early
14:56:13 <stepcut> http://www.happstack.com/docs/happstack-server-7.0.2/doc/html/happstack-server/Happstack-Server-SimpleHTTP.html#v:waitForTermination
14:56:50 <stepcut> basically do you have: do httpTID <- forkIO $ simpleHTTP nullConf handler ; waitForTermination ; killThread httpTID
14:57:11 <stepcut> and waitForTermination just sits around waiting for ^C
14:57:34 <stepcut> I also have a patch in my inbox that registers threads with a ThreadGroup so that we can shut down even more elegantly
15:34:11 <Palmik> Hmm, something wird is goin on... I have taken the function apart, removed all the checks and reduced it to standard insert -- it returns Maybe SomeID, after the changes, there is no branch that can cause it to return Nothing, but if I print the result, it's always Nothing. I have tried cabal cleaning the project, which did not help.
16:40:45 <Palmik> I do not get this -- I have code like this: http://hpaste.org/73362 I have recompiled the whole thing countless of times, even deleted cabal-dev and then recompiled, still whenever I run the handler and submit the form, both "Foo0" and "Foo" in Nothing. Only when I changed the wrapper to return $ Just someID I get "Foo" Just someID.
16:41:35 <Palmik> And when I post the form and Ctrl+C the application afterwars, I get SIGSEGV as I mentioned earlier.
17:14:04 <Palmik> I really have no clue what is going on.
17:42:54 <Palmik> I can not believe this. I finially found a way to fix it. This is how mine IsAcidic instance looked like: http://hpaste.org/73366 when I removed the Post's events, it works as intended! The Post's events inlude an event named Insert, but with completely different signature...
17:43:29 <stepkut> did you write IsAcidic by hand?
17:43:47 <Palmik> Yes, but generated the instances using TH.
17:43:59 <Palmik> Umm, the events.
17:44:31 <stepkut> it was broken when you were using $(makeAcidic ) ?
17:44:51 <Palmik> So I guess the problem is with two events having the same name... that is really unfortunate, since the sole reason I do it this way is to be able to have events with the same name but for different types.
17:45:02 <stepkut> that *shouldn't* be a problem
17:45:09 <stepkut> but I think I know why it is
17:45:52 <stepkut> Typeable used to use the fully qualified name in some places where it now uses the unqualified name
17:46:15 <stepkut> so things that used to be unique, aren't anymore
17:46:30 <Palmik> Hmm, that's not so great. :/
17:46:32 <stepkut> either way, if your test is true, then this is definitely a fixable bug in acid-state
17:48:43 <stepkut> clearly these functions you are using as events are defined in separate modules. So as long as the module names are included, things should be fine
17:48:59 <Palmik> Thsi is the code I use to create the events http://hpaste.org/73367 (added to Acid State's TemplateHaskell.hs), it uses the same process that makeAcidic does use.
17:49:52 <Palmik> I will try to create some small example that has the same problem.
17:50:15 <stepkut> sounds good
17:50:32 <stepkut> if you can create a small test case, I can definitely fix it
17:52:49 <stepkut> but now I am going to fix some lunch
17:54:42 <Palmik> Hehe :D
18:30:27 <Palmik> Hmm, here is what I got: git@gist.github.com:bc6e976ac156e2dba8c4.git it does not break in the same way mine code does (no SIGSEGV, no demandInput, but if I run the main twice, I get "Exception: Failed reading: safecopy:..." and "Empty call stack"... not sure if that is related.)
18:37:21 <stepkut> that doesn't actually build..
18:37:43 <Palmik> Yes, you have to rename the files, gist does not allow for nested files.
18:37:44 <stepkut> it tries to import Error.Module2 but the file is named ErrorModule2 not Error/Module2.hs
18:37:50 <stepkut> lame-o
18:38:32 <Palmik> I also tried making Module1 identitcal to Module2, except I have named the type and contructor Foo2,  and I can run the main multiple times just fine.
18:44:37 <stepkut> in Data.Acid.Core, this is the problem I expect:    methodTag ev = Lazy.pack (show (typeOf ev))
18:44:52 <stepkut> that used to work, but they changed the show instance so that it doesn't
18:51:53 <Palmik> I see,,, it should be easy to try (just make unique tag for the inserts and see if it works), but the Tag type is not exported.
18:52:00 <stepkut> yup, patching it seems to fix the issue
18:52:23 <stepkut> give me a second to make this into a real patch
18:52:40 <Palmik> OK, thanks a lot by the way. :)
18:53:23 <stepkut> you did the hard part :p
18:58:15 <stepkut> what's your email?
19:00:21 <Palmik> the.palmik@gmail.com
19:03:07 <stepkut> sent
19:03:18 <stepkut> I emailed the patch to Lemmih, but I BCC'd you on it
19:03:39 <stepkut> I'm just assuming that will fix all your issues
19:03:48 <stepkut> I only tested that one example you sent
19:04:42 <Palmik> OK, thanks, I will try it out and let you know if I run into further issues. :)
19:06:24 <stepkut> thanks