These are chat archives for YoEight/eventstore

19th
Jan 2017
Akii
@Akii
Jan 19 2017 11:07
somethings really buggy with re-connecting to the store
{-# LANGUAGE OverloadedStrings #-}

module Test4 where

import Database.EventStore
import Control.Monad (forever)

main :: IO ()
main = do
  es <- connect defaultSettings { s_retry = keepRetrying } (Static "localhost" 1113)
  sub <- subscribeFrom es "strim" True (Just 15) (Just 500)

  forever $ do
    next <- resolvedEventOriginal <$> nextEvent sub
    print $ recordedEventNumber next
 main
15
16
17
16
17
*** Exception: thread blocked indefinitely in an STM transaction
what I did here is run the store, call main, events 15 16 17 get processed, I kill the store and bring it back up; for some reason the driver fetches 16 17 again; I kill the store again it dies
the driver always resends the last 2 events
which is weird
and then the STM inf block..
Akii
@Akii
Jan 19 2017 13:51
@YoEight any idea where to look in the code?
looking at the module Subscription
it's some weird elvish, I can't read it :P
Akii
@Akii
Jan 19 2017 14:02
ye so this looks more and more like 2 bugs to me
Yorick Laupa
@YoEight
Jan 19 2017 14:08
@Akii could you fill a ticket on Github ? Will look at it this weekend
Akii
@Akii
Jan 19 2017 14:13
sure!
Yorick Laupa
@YoEight
Jan 19 2017 14:13
Thanks
Akii
@Akii
Jan 19 2017 14:31
it's a bit odd unfortunately :(
Yorick Laupa
@YoEight
Jan 19 2017 14:31
That's why I didn't tag it as bug yet
but it could be
Akii
@Akii
Jan 19 2017 14:32
I'm trying to describe this as good as I can
and investigate
Yorick Laupa
@YoEight
Jan 19 2017 14:32
you did a good job already
Akii
@Akii
Jan 19 2017 14:32
I'd also like to join you on the weekend if you like
ideally I'd be able to fix those myself :D
Yorick Laupa
@YoEight
Jan 19 2017 14:32
sure
go ahead :-)
Akii
@Akii
Jan 19 2017 14:32
I'll now investigate this resending event thing
maybe I can even come up with test cases for this
I'll look into that right after the bug description :D
Yorick Laupa
@YoEight
Jan 19 2017 14:34
It's hard to simulate connection drop in tests
maybe there is a lib for that
Akii
@Akii
Jan 19 2017 14:34
true
Akii
@Akii
Jan 19 2017 14:42
added the second issue with the resent events
Yorick Laupa
@YoEight
Jan 19 2017 14:48
This one seems 100% a bug for me though
Akii
@Akii
Jan 19 2017 14:51
ha I'm not crazy :D
Akii
@Akii
Jan 19 2017 15:10
whoopsie
just managed to get 2 connections to the store
now 3
is that normal?
nvm, probably ghci issues
yep yep nevermind that
Akii
@Akii
Jan 19 2017 15:20
another thing though
you said that the actual connection wouldn't be made until the first command
The client will really connect after a command being issued.
This establishes a connection.
  es <- connect defaultSettings (Static "localhost" 1113)
  _ <- getLine
which is fine, just something I noticed
also, reconnection works for eternity
so it gotta be something with the subscription \o/
Akii
@Akii
Jan 19 2017 15:33
and just like that I found a minimal case for #61
Yorick Laupa
@YoEight
Jan 19 2017 15:38
like you're gonna solve the issue by yourself :-)
Akii
@Akii
Jan 19 2017 15:38
until now no Haskell knowledge was required :D
Yorick Laupa
@YoEight
Jan 19 2017 15:56
I trully believe the driver code ain't that hard
but maybe I'm biased
Akii
@Akii
Jan 19 2017 15:56
or more experienced :P
I think it's in here tryRetryCatcupSubscription
Yorick Laupa
@YoEight
Jan 19 2017 15:57
do it !
Akii
@Akii
Jan 19 2017 15:57
I'm on it ^^
Yorick Laupa
@YoEight
Jan 19 2017 15:58
can't wait to review your PR !