{"action":"opened","issue":{"url":"https://api.github.com/repos/andreaskoch/go-fswatch/issues/6","repository_url":"https://api.github.com/repos/andreaskoch/go-fswatch","labels_url":"https://api.github.com/repos/andreaskoch/go-fswatch/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/andreaskoch/go-fswatch/issues/6/comments","events_url":"https://api.github.com/repos/andreaskoch/go-fswatch/issues/6/events","html_url":"https://github.com/andreaskoch/go-fswatch/issues/6","id":189127545,"number":6,"title":"Insecure increment of numberOfFileWatchers & numberOfFolderWatchers++","user":{"login":"luedigernet","id":1688743,"avatar_url":"https://avatars.githubusercontent.com/u/1688743?v=3","gravatar_id":"","url":"https://api.github.com/users/luedigernet","html_url":"https://github.com/luedigernet","followers_url":"https://api.github.com/users/luedigernet/followers","following_url":"https://api.github.com/users/luedigernet/following{/other_user}","gists_url":"https://api.github.com/users/luedigernet/gists{/gist_id}","starred_url":"https://api.github.com/users/luedigernet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luedigernet/subscriptions","organizations_url":"https://api.github.com/users/luedigernet/orgs","repos_url":"https://api.github.com/users/luedigernet/repos","events_url":"https://api.github.com/users/luedigernet/events{/privacy}","received_events_url":"https://api.github.com/users/luedigernet/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-14T14:37:03Z","updated_at":"2016-11-14T14:37:03Z","closed_at":null,"body":"Hi the increments should be surrounded with an Mutex to synchronize the write access to the variable. Because of concurrent go routines.\r\n\r\ngo-fswatch/file.go:\r\n   87  \r\n   88  \t\t// increment watcher count\r\n   89: \t\tnumberOfFileWatchers++\r\n   90  \r\n   91  \t\tvar modTime time.Time\r\n\r\ngo-fswatch/folder.go:\r\n  119  \r\n  120  \t\t// increment watcher count\r\n  121: \t\tnumberOfFolderWatchers++\r\n  122  \r\n  123  \t\tfor folderWatcher.wasStopped == false {"}}
{"actor":{"display_login":"luedigernet"}}