{"action":"created","issue":{"url":"https://api.github.com/repos/acid-state/acid-state/issues/89","repository_url":"https://api.github.com/repos/acid-state/acid-state","labels_url":"https://api.github.com/repos/acid-state/acid-state/issues/89/labels{/name}","comments_url":"https://api.github.com/repos/acid-state/acid-state/issues/89/comments","events_url":"https://api.github.com/repos/acid-state/acid-state/issues/89/events","html_url":"https://github.com/acid-state/acid-state/issues/89","id":290854112,"number":89,"title":"acid-state may not restart if killed with kill 9-","user":{"login":"pierreMizrahi","id":35733449,"avatar_url":"https://avatars1.githubusercontent.com/u/35733449?v=4","gravatar_id":"","url":"https://api.github.com/users/pierreMizrahi","html_url":"https://github.com/pierreMizrahi","followers_url":"https://api.github.com/users/pierreMizrahi/followers","following_url":"https://api.github.com/users/pierreMizrahi/following{/other_user}","gists_url":"https://api.github.com/users/pierreMizrahi/gists{/gist_id}","starred_url":"https://api.github.com/users/pierreMizrahi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pierreMizrahi/subscriptions","organizations_url":"https://api.github.com/users/pierreMizrahi/orgs","repos_url":"https://api.github.com/users/pierreMizrahi/repos","events_url":"https://api.github.com/users/pierreMizrahi/events{/privacy}","received_events_url":"https://api.github.com/users/pierreMizrahi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-01-23T14:18:30Z","updated_at":"2018-02-14T16:54:17Z","closed_at":null,"author_association":"NONE","body":"Acid state uses a a PID file to ensure being a singleton. Unfortunately,the following sequence does not allow for an automatic recovery:\r\n\r\n- kill  the process instance with kill -9\r\n- have another, unrelated process take the same process ID while the program using acid-state is down\r\n- restart the program using acid-state\r\n\r\n(to simulate this, one can manually modify the PID in the lock file to usurp the one of an existing, unrelated process)\r\n\r\nThe occurrence of this sequence of events is unfortunately high at machine reboot: it happened to us in production during a disaster recovery test that simulates a power outage.\r\n\r\nA possibility would be to use a unix socket rather than a PID file, or alternatively to use flock(2). This seems to be possible, since the win32 and linux implementations are already different, but I did not checked in much details.\r\n\r\nSome discussion around this topic can be found here:\r\n\r\nhttps://stackoverflow.com/questions/220525/ensure-a-single-instance-of-an-application-in-linux/221159\r\nhttps://stackoverflow.com/questions/5339200/how-to-create-a-single-instance-application-in-c-or-c\r\n"},"comment":{"url":"https://api.github.com/repos/acid-state/acid-state/issues/comments/365671770","html_url":"https://github.com/acid-state/acid-state/issues/89#issuecomment-365671770","issue_url":"https://api.github.com/repos/acid-state/acid-state/issues/89","id":365671770,"user":{"login":"gromakovsky","id":2556409,"avatar_url":"https://avatars0.githubusercontent.com/u/2556409?v=4","gravatar_id":"","url":"https://api.github.com/users/gromakovsky","html_url":"https://github.com/gromakovsky","followers_url":"https://api.github.com/users/gromakovsky/followers","following_url":"https://api.github.com/users/gromakovsky/following{/other_user}","gists_url":"https://api.github.com/users/gromakovsky/gists{/gist_id}","starred_url":"https://api.github.com/users/gromakovsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gromakovsky/subscriptions","organizations_url":"https://api.github.com/users/gromakovsky/orgs","repos_url":"https://api.github.com/users/gromakovsky/repos","events_url":"https://api.github.com/users/gromakovsky/events{/privacy}","received_events_url":"https://api.github.com/users/gromakovsky/received_events","type":"User","site_admin":false},"created_at":"2018-02-14T16:54:17Z","updated_at":"2018-02-14T16:54:17Z","author_association":"NONE","body":"I have a question which might be silly, but still: why not use [filelock](https://hackage.haskell.org/package/filelock-0.1.1.2/docs/System-FileLock.html) library?\r\n\r\nWe have the same problem and I wanted to try `filelock` before I saw this issue.\r\n@pierreMizrahi did you consider using `filelock`? It uses `flock(2)` on linux and it's crossplatform, so there would be no need to have `src-unix` and `src-win32`."}}
{"actor":{"display_login":"gromakovsky"}}