{"action":"created","issue":{"url":"https://api.github.com/repos/rncbc/qtractor/issues/45","repository_url":"https://api.github.com/repos/rncbc/qtractor","labels_url":"https://api.github.com/repos/rncbc/qtractor/issues/45/labels{/name}","comments_url":"https://api.github.com/repos/rncbc/qtractor/issues/45/comments","events_url":"https://api.github.com/repos/rncbc/qtractor/issues/45/events","html_url":"https://github.com/rncbc/qtractor/issues/45","id":178697494,"number":45,"title":"Qtractor LV2 worker implementation bug","user":{"login":"swesterfeld","id":14840066,"avatar_url":"https://avatars.githubusercontent.com/u/14840066?v=3","gravatar_id":"","url":"https://api.github.com/users/swesterfeld","html_url":"https://github.com/swesterfeld","followers_url":"https://api.github.com/users/swesterfeld/followers","following_url":"https://api.github.com/users/swesterfeld/following{/other_user}","gists_url":"https://api.github.com/users/swesterfeld/gists{/gist_id}","starred_url":"https://api.github.com/users/swesterfeld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swesterfeld/subscriptions","organizations_url":"https://api.github.com/users/swesterfeld/orgs","repos_url":"https://api.github.com/users/swesterfeld/repos","events_url":"https://api.github.com/users/swesterfeld/events{/privacy}","received_events_url":"https://api.github.com/users/swesterfeld/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-09-22T19:19:46Z","updated_at":"2016-09-22T21:49:19Z","closed_at":null,"body":"I can reproducibly crash Qtractor from git by loading my SpectMorph plugin and generating lots of UI changes with the mouse (using the 2x2 grid template). I debugged the problem, and the crash is\r\ncaused by the function qtractorLv2Worker::schedule, which in the original implementation uses:\r\n\r\n::jack_ringbuffer_write(m_pRequests, (const char *) &size, sizeof(size));\r\n::jack_ringbuffer_write(m_pRequests, (const char *) data, size);\r\n\r\nto write the request. Now the case that triggers the crash is that the first ringbuffer_write is executed, and then the request is read by the worker thread. Since data isn't yet written, the worker thread executes an incomplete request, which in turn causes a crash in the SpectMorph plugin. I know it sounds like an unlikely thing to happen, but I can trigger it reproducibly in a short amount of time.\r\n\r\nMy fix is to copy the data into one consecutive chunk of data, and writing that with one single ringbuffer_write. Patch attached.\r\n\r\n   Cu... Stefan\r\n[lv2workerfix.diff.txt](https://github.com/rncbc/qtractor/files/488177/lv2workerfix.diff.txt)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/rncbc/qtractor/issues/comments/249038403","html_url":"https://github.com/rncbc/qtractor/issues/45#issuecomment-249038403","issue_url":"https://api.github.com/repos/rncbc/qtractor/issues/45","id":249038403,"user":{"login":"swesterfeld","id":14840066,"avatar_url":"https://avatars.githubusercontent.com/u/14840066?v=3","gravatar_id":"","url":"https://api.github.com/users/swesterfeld","html_url":"https://github.com/swesterfeld","followers_url":"https://api.github.com/users/swesterfeld/followers","following_url":"https://api.github.com/users/swesterfeld/following{/other_user}","gists_url":"https://api.github.com/users/swesterfeld/gists{/gist_id}","starred_url":"https://api.github.com/users/swesterfeld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swesterfeld/subscriptions","organizations_url":"https://api.github.com/users/swesterfeld/orgs","repos_url":"https://api.github.com/users/swesterfeld/repos","events_url":"https://api.github.com/users/swesterfeld/events{/privacy}","received_events_url":"https://api.github.com/users/swesterfeld/received_events","type":"User","site_admin":false},"created_at":"2016-09-22T21:49:18Z","updated_at":"2016-09-22T21:49:18Z","body":"Looks reasonable, except for one detail (which breaks all requests as you committed it):\r\n\r\nif (::jack_ringbuffer_write_space(m_pRequests) < request_size) {\r\n\r\nshould be     ... >= request_size\r\n\r\nAs to whether to inform the user somehow if the out-of-space-condition occurred (which assert() would have done), it's probably a matter of taste whether to fail silently - as you implemented it - or produce some sort of warning."}}
{"actor":{"display_login":"swesterfeld"}}