{"action":"opened","issue":{"url":"https://api.github.com/repos/nzbget/nzbget/issues/41","labels_url":"https://api.github.com/repos/nzbget/nzbget/issues/41/labels{/name}","comments_url":"https://api.github.com/repos/nzbget/nzbget/issues/41/comments","events_url":"https://api.github.com/repos/nzbget/nzbget/issues/41/events","html_url":"https://github.com/nzbget/nzbget/issues/41","id":91627083,"number":41,"title":"Spin locks causing hanging","user":{"login":"hugbug","id":3368402,"avatar_url":"https://avatars.githubusercontent.com/u/3368402?v=3","gravatar_id":"","url":"https://api.github.com/users/hugbug","html_url":"https://github.com/hugbug","followers_url":"https://api.github.com/users/hugbug/followers","following_url":"https://api.github.com/users/hugbug/following{/other_user}","gists_url":"https://api.github.com/users/hugbug/gists{/gist_id}","starred_url":"https://api.github.com/users/hugbug/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hugbug/subscriptions","organizations_url":"https://api.github.com/users/hugbug/orgs","repos_url":"https://api.github.com/users/hugbug/repos","events_url":"https://api.github.com/users/hugbug/events{/privacy}","received_events_url":"https://api.github.com/users/hugbug/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-28T19:00:41Z","updated_at":"2015-06-28T19:00:41Z","closed_at":null,"body":"## Problem\r\nA problem on Drobo NAS was reported. The program was sometimes hanging during par-repair when multithreading par-repair was active (option *ParThreads*).\r\nAfter investigation it was found the program was hanging in the system function *pthread_spin_lock*.\r\n\r\nThe spin locks are alternative to mutexes and can provide performance gain in certain situations. In NZBGet spin locks are used only in two cases:\r\n- during par-repair if multicore par-repair is active - to synchronize repair threads;\r\n- if option **AccurateRate** is active - to synchronize download threads.\r\n\r\nSpin locks can be always replaced by mutexes. Furthermore not all platforms support spin locks (for example Mac OS X doesn't and not every Linux system has them). NZBGet uses spin locks if available, otherwise it falls back to mutexes.\r\n\r\n## Steps to reproduce\r\nAlthough the problem was initially reported during par-repair the easier way to reproduce is:\r\n- activate option **AccurateRate**;\r\n- download something.\r\n\r\nIf the system has problem with spin locks the download will soon stop.\r\n\r\n## Tasks:\r\n - [ ] deactivate the usage of spin locks in builds included in Linux installer;\r\n - [ ] investigate if spin locks provide any measurable performance gain in NZBGet;\r\n - [ ] if there are no any advantages - remove spin locks from the code."}}