{"action":"created","issue":{"url":"https://api.github.com/repos/JacpFX/JacpFX/issues/51","repository_url":"https://api.github.com/repos/JacpFX/JacpFX","labels_url":"https://api.github.com/repos/JacpFX/JacpFX/issues/51/labels{/name}","comments_url":"https://api.github.com/repos/JacpFX/JacpFX/issues/51/comments","events_url":"https://api.github.com/repos/JacpFX/JacpFX/issues/51/events","html_url":"https://github.com/JacpFX/JacpFX/issues/51","id":177582817,"number":51,"title":"Thread leaks and memory leaks when deactivating/activating components","user":{"login":"mg-2014","id":9593044,"avatar_url":"https://avatars.githubusercontent.com/u/9593044?v=3","gravatar_id":"","url":"https://api.github.com/users/mg-2014","html_url":"https://github.com/mg-2014","followers_url":"https://api.github.com/users/mg-2014/followers","following_url":"https://api.github.com/users/mg-2014/following{/other_user}","gists_url":"https://api.github.com/users/mg-2014/gists{/gist_id}","starred_url":"https://api.github.com/users/mg-2014/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mg-2014/subscriptions","organizations_url":"https://api.github.com/users/mg-2014/orgs","repos_url":"https://api.github.com/users/mg-2014/repos","events_url":"https://api.github.com/users/mg-2014/events{/privacy}","received_events_url":"https://api.github.com/users/mg-2014/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"amoAHCP","id":5213423,"avatar_url":"https://avatars.githubusercontent.com/u/5213423?v=3","gravatar_id":"","url":"https://api.github.com/users/amoAHCP","html_url":"https://github.com/amoAHCP","followers_url":"https://api.github.com/users/amoAHCP/followers","following_url":"https://api.github.com/users/amoAHCP/following{/other_user}","gists_url":"https://api.github.com/users/amoAHCP/gists{/gist_id}","starred_url":"https://api.github.com/users/amoAHCP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amoAHCP/subscriptions","organizations_url":"https://api.github.com/users/amoAHCP/orgs","repos_url":"https://api.github.com/users/amoAHCP/repos","events_url":"https://api.github.com/users/amoAHCP/events{/privacy}","received_events_url":"https://api.github.com/users/amoAHCP/received_events","type":"User","site_admin":false},"assignees":[{"login":"amoAHCP","id":5213423,"avatar_url":"https://avatars.githubusercontent.com/u/5213423?v=3","gravatar_id":"","url":"https://api.github.com/users/amoAHCP","html_url":"https://github.com/amoAHCP","followers_url":"https://api.github.com/users/amoAHCP/followers","following_url":"https://api.github.com/users/amoAHCP/following{/other_user}","gists_url":"https://api.github.com/users/amoAHCP/gists{/gist_id}","starred_url":"https://api.github.com/users/amoAHCP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amoAHCP/subscriptions","organizations_url":"https://api.github.com/users/amoAHCP/orgs","repos_url":"https://api.github.com/users/amoAHCP/repos","events_url":"https://api.github.com/users/amoAHCP/events{/privacy}","received_events_url":"https://api.github.com/users/amoAHCP/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2016-09-17T14:59:57Z","updated_at":"2016-09-22T08:24:57Z","closed_at":null,"body":"When components are deactivated and activated again I can observe the \"old\" `EmbeddedFXComponentWorker` threads still active although they shouldn't be. The problem doesn't appear every time I debug the code. It seems to depend on where I put breakpoints and delay the execution. See thread \"ControlView\" in the attached \"jvisualvm\" screenshot:\r\n\r\n![threads](https://cloud.githubusercontent.com/assets/9593044/18608990/66002716-7cf7-11e6-9d2d-ebafb092ecd4.png)\r\n\r\nSince these threads reference `EmbeddedFXComponents` which in turn reference UI components there are memory leaks as well.\r\n\r\nThe problem seems to be that when `lock.unlock()` in `WorkerUtil:101` interrupts `getNextIncomingMessage()` in `EmbeddedFXComponentWorker:93` we immediately end up calling `handleComponentExecution()` again in line 82. (The line numbers correspond to the sources as they appear in version 2.1.)\r\n\r\nThere seems to be a `t.interrupt()` missing where the `InterruptedException` is caught (line 112):\r\n```\r\n        } catch (InterruptedException e) {\r\n        \tt.interrupt();\r\n        } catch (Exception e) {\r\n```\r\n\r\nThe same probably holds for `EmbeddedCallbackComponentWorker` (line 92). Maybe check other occurrences where `InterruptedException` is caught as well. I've found a couple of occurrences where `InterruptedException` is neither propagated nor the interrupted flag set.\r\n\r\nThe problems seems to exist in the current master version (`EmbeddedFXComponent:130`) as well. \r\n\r\nFrom what I gathered there is no `context.setActive()` to activate/deactive components anymore. Unfortunately I make heavy use of activating/deactivating components in my application.\r\n"},"comment":{"url":"https://api.github.com/repos/JacpFX/JacpFX/issues/comments/248841107","html_url":"https://github.com/JacpFX/JacpFX/issues/51#issuecomment-248841107","issue_url":"https://api.github.com/repos/JacpFX/JacpFX/issues/51","id":248841107,"user":{"login":"mg-2014","id":9593044,"avatar_url":"https://avatars.githubusercontent.com/u/9593044?v=3","gravatar_id":"","url":"https://api.github.com/users/mg-2014","html_url":"https://github.com/mg-2014","followers_url":"https://api.github.com/users/mg-2014/followers","following_url":"https://api.github.com/users/mg-2014/following{/other_user}","gists_url":"https://api.github.com/users/mg-2014/gists{/gist_id}","starred_url":"https://api.github.com/users/mg-2014/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mg-2014/subscriptions","organizations_url":"https://api.github.com/users/mg-2014/orgs","repos_url":"https://api.github.com/users/mg-2014/repos","events_url":"https://api.github.com/users/mg-2014/events{/privacy}","received_events_url":"https://api.github.com/users/mg-2014/received_events","type":"User","site_admin":false},"created_at":"2016-09-22T08:24:57Z","updated_at":"2016-09-22T08:24:57Z","body":"Hi Andy,\r\nthanks. I will verify it at the weekend.\r\n\r\nConcerning the use of `context.setActive()`... My use case is that I have menu items that open different views in the same target layout. Setting a single view to active state and all others to inactive state seemed to be the way to go. Thus I'm sending `activate` and `inactivate` messages and use `context.setActive()` in the handle() method."}}
{"actor":{"display_login":"mg-2014"}}