{"action":"created","issue":{"url":"https://api.github.com/repos/areaDetector/ADCore/issues/100","labels_url":"https://api.github.com/repos/areaDetector/ADCore/issues/100/labels{/name}","comments_url":"https://api.github.com/repos/areaDetector/ADCore/issues/100/comments","events_url":"https://api.github.com/repos/areaDetector/ADCore/issues/100/events","html_url":"https://github.com/areaDetector/ADCore/pull/100","id":71345345,"number":100,"title":"File locks","user":{"login":"MarkRivers","id":6115534,"avatar_url":"https://avatars.githubusercontent.com/u/6115534?v=3","gravatar_id":"","url":"https://api.github.com/users/MarkRivers","html_url":"https://github.com/MarkRivers","followers_url":"https://api.github.com/users/MarkRivers/followers","following_url":"https://api.github.com/users/MarkRivers/following{/other_user}","gists_url":"https://api.github.com/users/MarkRivers/gists{/gist_id}","starred_url":"https://api.github.com/users/MarkRivers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarkRivers/subscriptions","organizations_url":"https://api.github.com/users/MarkRivers/orgs","repos_url":"https://api.github.com/users/MarkRivers/repos","events_url":"https://api.github.com/users/MarkRivers/events{/privacy}","received_events_url":"https://api.github.com/users/MarkRivers/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"ulrikpedersen","id":6115544,"avatar_url":"https://avatars.githubusercontent.com/u/6115544?v=3","gravatar_id":"","url":"https://api.github.com/users/ulrikpedersen","html_url":"https://github.com/ulrikpedersen","followers_url":"https://api.github.com/users/ulrikpedersen/followers","following_url":"https://api.github.com/users/ulrikpedersen/following{/other_user}","gists_url":"https://api.github.com/users/ulrikpedersen/gists{/gist_id}","starred_url":"https://api.github.com/users/ulrikpedersen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ulrikpedersen/subscriptions","organizations_url":"https://api.github.com/users/ulrikpedersen/orgs","repos_url":"https://api.github.com/users/ulrikpedersen/repos","events_url":"https://api.github.com/users/ulrikpedersen/events{/privacy}","received_events_url":"https://api.github.com/users/ulrikpedersen/received_events","type":"User","site_admin":false},"milestone":null,"comments":6,"created_at":"2015-04-27T17:08:43Z","updated_at":"2015-05-05T14:16:22Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/areaDetector/ADCore/pulls/100","html_url":"https://github.com/areaDetector/ADCore/pull/100","diff_url":"https://github.com/areaDetector/ADCore/pull/100.diff","patch_url":"https://github.com/areaDetector/ADCore/pull/100.patch"},"body":"I reverted NDPluginFile.cpp on master to the R2-2 version, and created a new branch, file_locks, with the changes to NDPluginFile.cpp and all of the derived classes.\r\n"},"comment":{"url":"https://api.github.com/repos/areaDetector/ADCore/issues/comments/99091775","html_url":"https://github.com/areaDetector/ADCore/pull/100#issuecomment-99091775","issue_url":"https://api.github.com/repos/areaDetector/ADCore/issues/100","id":99091775,"user":{"login":"ulrikpedersen","id":6115544,"avatar_url":"https://avatars.githubusercontent.com/u/6115544?v=3","gravatar_id":"","url":"https://api.github.com/users/ulrikpedersen","html_url":"https://github.com/ulrikpedersen","followers_url":"https://api.github.com/users/ulrikpedersen/followers","following_url":"https://api.github.com/users/ulrikpedersen/following{/other_user}","gists_url":"https://api.github.com/users/ulrikpedersen/gists{/gist_id}","starred_url":"https://api.github.com/users/ulrikpedersen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ulrikpedersen/subscriptions","organizations_url":"https://api.github.com/users/ulrikpedersen/orgs","repos_url":"https://api.github.com/users/ulrikpedersen/repos","events_url":"https://api.github.com/users/ulrikpedersen/events{/privacy}","received_events_url":"https://api.github.com/users/ulrikpedersen/received_events","type":"User","site_admin":false},"created_at":"2015-05-05T14:16:22Z","updated_at":"2015-05-05T14:16:22Z","body":"I think this is a fundamental problem with unlocking inside around openFile():\r\n\r\nIf the simDetector is running flat out (200Hz or more) the [NDPluginFile::processCallbacks()](https://github.com/areaDetector/ADCore/blob/file_locks/ADApp/pluginSrc/NDPluginFile.cpp#L681) is called virtually *all the time* and one of the first things it does it take a copy of NDFileNumCaptured [here](https://github.com/areaDetector/ADCore/blob/file_locks/ADApp/pluginSrc/NDPluginFile.cpp#L705)\r\n\r\nIf the user then suddenly clicks on \"Capture\" we call writeInt32() the NDFileCapture parameter gets set [here](https://github.com/areaDetector/ADCore/blob/file_locks/ADApp/pluginSrc/NDPluginFile.cpp#L792)\r\n\r\nHowever, before doCapture() has time to finish calling the virtual openFile() method (around which the mutex is unlocked) and setup all relevant parameters (like resetting NDFileNumCaptured) the really fast simDetector has caused another call to NDPluginFile::processCallbacks() - which now see the NDFileCapture parameter be true (or 1 or whatever) and promptly increment NDFileNumCaptured before calling writeFileBase() - and the inherited writeFile() method.\r\n\r\nSo the trouble is really that NDFileCapture is set in the parameter library too early - before the inherited openFile() method has finished and the file writer is truly ready to write frames.\r\n\r\nWhat I really don't understand is why this doesn't cause a more visible crash!!!\r\n "}}