{"action":"created","issue":{"url":"https://api.github.com/repos/EventStore/EventStore/issues/500","labels_url":"https://api.github.com/repos/EventStore/EventStore/issues/500/labels{/name}","comments_url":"https://api.github.com/repos/EventStore/EventStore/issues/500/comments","events_url":"https://api.github.com/repos/EventStore/EventStore/issues/500/events","html_url":"https://github.com/EventStore/EventStore/issues/500","id":84522969,"number":500,"title":"Replaying parked messages can lead to bad checkpoints and \"lost\" events","user":{"login":"lscpike","id":7010027,"avatar_url":"https://avatars.githubusercontent.com/u/7010027?v=3","gravatar_id":"","url":"https://api.github.com/users/lscpike","html_url":"https://github.com/lscpike","followers_url":"https://api.github.com/users/lscpike/followers","following_url":"https://api.github.com/users/lscpike/following{/other_user}","gists_url":"https://api.github.com/users/lscpike/gists{/gist_id}","starred_url":"https://api.github.com/users/lscpike/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lscpike/subscriptions","organizations_url":"https://api.github.com/users/lscpike/orgs","repos_url":"https://api.github.com/users/lscpike/repos","events_url":"https://api.github.com/users/lscpike/events{/privacy}","received_events_url":"https://api.github.com/users/lscpike/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-06-03T12:02:48Z","updated_at":"2015-07-06T12:20:48Z","closed_at":null,"body":"The subscription group check-pointing uses the event number from the OriginalEvent.EventNumber. The replayParked process in the persistent subscriptions replays messages from a separate stream to the subscription group stream id. This means OriginalEvent.EventNumber will be from the parked stream. If the checkpoint happens whilst this replayed message is in flight the checkpoint will revert to an incorrect EventNumber. \r\n\r\nSteps that will lead to the problem:\r\n- A PersistentSubscription group is created and connected.\r\n- The consumer processes 1 million events.\r\n- The checkpoint is recorded as 1000000.\r\n- The consumer nack+parks an event and carries on processing future events.\r\n- The parked message is replayed.\r\n- The parked message is in flight when the next checkpoint occurs.\r\n- The outstanding messages contains the replayed message and returns it as the lowest event.\r\n- The event is from the parked stream and has version 0.\r\n- Therefore the checkpoint written as 0.\r\n- If the node shuts down now on next start start up the subscription will start from 0. \r\n\r\nThere is also the risk that if the server shuts down before the event is processed there will be no indication that an event has not been handled. I.e. it will have been removed from the parked stream and the checkpoint will be ahead of the event.\r\n\r\nI'm not sure where to start in fixing this, so I'm just reporting it for now."},"comment":{"url":"https://api.github.com/repos/EventStore/EventStore/issues/comments/118838756","html_url":"https://github.com/EventStore/EventStore/issues/500#issuecomment-118838756","issue_url":"https://api.github.com/repos/EventStore/EventStore/issues/500","id":118838756,"user":{"login":"lscpike","id":7010027,"avatar_url":"https://avatars.githubusercontent.com/u/7010027?v=3","gravatar_id":"","url":"https://api.github.com/users/lscpike","html_url":"https://github.com/lscpike","followers_url":"https://api.github.com/users/lscpike/followers","following_url":"https://api.github.com/users/lscpike/following{/other_user}","gists_url":"https://api.github.com/users/lscpike/gists{/gist_id}","starred_url":"https://api.github.com/users/lscpike/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lscpike/subscriptions","organizations_url":"https://api.github.com/users/lscpike/orgs","repos_url":"https://api.github.com/users/lscpike/repos","events_url":"https://api.github.com/users/lscpike/events{/privacy}","received_events_url":"https://api.github.com/users/lscpike/received_events","type":"User","site_admin":false},"created_at":"2015-07-06T12:20:48Z","updated_at":"2015-07-06T12:20:48Z","body":"That will break the ability to use persistent subscriptions on projections/anything with links. Something we depend on for sure."}}