{"action":"created","issue":{"url":"https://api.github.com/repos/cargomedia/janus-gateway-rtpbroadcast/issues/75","repository_url":"https://api.github.com/repos/cargomedia/janus-gateway-rtpbroadcast","labels_url":"https://api.github.com/repos/cargomedia/janus-gateway-rtpbroadcast/issues/75/labels{/name}","comments_url":"https://api.github.com/repos/cargomedia/janus-gateway-rtpbroadcast/issues/75/comments","events_url":"https://api.github.com/repos/cargomedia/janus-gateway-rtpbroadcast/issues/75/events","html_url":"https://github.com/cargomedia/janus-gateway-rtpbroadcast/pull/75","id":138003626,"number":75,"title":"Refactor UDP client inner structures","user":{"login":"landswellsong","id":2434329,"avatar_url":"https://avatars.githubusercontent.com/u/2434329?v=3","gravatar_id":"","url":"https://api.github.com/users/landswellsong","html_url":"https://github.com/landswellsong","followers_url":"https://api.github.com/users/landswellsong/followers","following_url":"https://api.github.com/users/landswellsong/following{/other_user}","gists_url":"https://api.github.com/users/landswellsong/gists{/gist_id}","starred_url":"https://api.github.com/users/landswellsong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/landswellsong/subscriptions","organizations_url":"https://api.github.com/users/landswellsong/orgs","repos_url":"https://api.github.com/users/landswellsong/repos","events_url":"https://api.github.com/users/landswellsong/events{/privacy}","received_events_url":"https://api.github.com/users/landswellsong/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cargomedia/janus-gateway-rtpbroadcast/labels/in%20progress","name":"in progress","color":"ededed"}],"state":"open","locked":false,"assignee":{"login":"landswellsong","id":2434329,"avatar_url":"https://avatars.githubusercontent.com/u/2434329?v=3","gravatar_id":"","url":"https://api.github.com/users/landswellsong","html_url":"https://github.com/landswellsong","followers_url":"https://api.github.com/users/landswellsong/followers","following_url":"https://api.github.com/users/landswellsong/following{/other_user}","gists_url":"https://api.github.com/users/landswellsong/gists{/gist_id}","starred_url":"https://api.github.com/users/landswellsong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/landswellsong/subscriptions","organizations_url":"https://api.github.com/users/landswellsong/orgs","repos_url":"https://api.github.com/users/landswellsong/repos","events_url":"https://api.github.com/users/landswellsong/events{/privacy}","received_events_url":"https://api.github.com/users/landswellsong/received_events","type":"User","site_admin":false},"milestone":null,"comments":7,"created_at":"2016-03-02T21:53:09Z","updated_at":"2016-03-03T10:51:44Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/cargomedia/janus-gateway-rtpbroadcast/pulls/75","html_url":"https://github.com/cargomedia/janus-gateway-rtpbroadcast/pull/75","diff_url":"https://github.com/cargomedia/janus-gateway-rtpbroadcast/pull/75.diff","patch_url":"https://github.com/cargomedia/janus-gateway-rtpbroadcast/pull/75.patch"},"body":"@kris-lab @njam I'll summarise my findings about the bug here. The bug is caused by the following:\r\n1. Session `A` creates a mountpoint `M`.\r\n2. Session `B` initiates `watch-udp` to this mountpoint, this spawns 3 instances of `cm_rtpbcast_udp_relay_gateway` into a `GArray`. Each of `M`'s sources add `B` to their `listeners` list. \r\n3. **Here is the error** compared to what I have in `watch`, `B` has no way of knowing which sources to it is connected.\r\n4. `B` disconnects, times out or whatever. Since (3) it does not remove itself from `listeners` anywhere.\r\n5. `A` disconnects, times out or whatever. It goes through `listeners` of each sources for the mountpoint it streams, then it tries to send shutdown signals to the session `A` which has already quit. This is timing dependent because `B` is not removed immediately on (4) and rather added to a special list which is removed by watchdog, this is why the bug was unreliable to reproduce. \r\n\r\nSimilarly, if `A` quits faster than `B`, then `B` will have no way of knowing this has happened and consider that it still streams something. Moreover, @kris-lab's implementation used a `GArray` while when we have `B` issue more than one `watch-udp` request we'll have to enlarge the array. This would would backfire when we remove certain of UDP clients on session `A` shotdown so I am making a `GList` here instead.\r\n\r\nHopefully will deliver right now so that we are no longer blocked for tomorrow. \r\n\r\nPlease kill #70 it's not needed anymore. I'll cherrypick parts of the source from there. "},"comment":{"url":"https://api.github.com/repos/cargomedia/janus-gateway-rtpbroadcast/issues/comments/191704419","html_url":"https://github.com/cargomedia/janus-gateway-rtpbroadcast/pull/75#issuecomment-191704419","issue_url":"https://api.github.com/repos/cargomedia/janus-gateway-rtpbroadcast/issues/75","id":191704419,"user":{"login":"landswellsong","id":2434329,"avatar_url":"https://avatars.githubusercontent.com/u/2434329?v=3","gravatar_id":"","url":"https://api.github.com/users/landswellsong","html_url":"https://github.com/landswellsong","followers_url":"https://api.github.com/users/landswellsong/followers","following_url":"https://api.github.com/users/landswellsong/following{/other_user}","gists_url":"https://api.github.com/users/landswellsong/gists{/gist_id}","starred_url":"https://api.github.com/users/landswellsong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/landswellsong/subscriptions","organizations_url":"https://api.github.com/users/landswellsong/orgs","repos_url":"https://api.github.com/users/landswellsong/repos","events_url":"https://api.github.com/users/landswellsong/events{/privacy}","received_events_url":"https://api.github.com/users/landswellsong/received_events","type":"User","site_admin":false},"created_at":"2016-03-03T10:51:44Z","updated_at":"2016-03-03T10:51:44Z","body":"Ok this is it."}}