{"action":"created","issue":{"url":"https://api.github.com/repos/gambol99/go-marathon/issues/199","repository_url":"https://api.github.com/repos/gambol99/go-marathon","labels_url":"https://api.github.com/repos/gambol99/go-marathon/issues/199/labels{/name}","comments_url":"https://api.github.com/repos/gambol99/go-marathon/issues/199/comments","events_url":"https://api.github.com/repos/gambol99/go-marathon/issues/199/events","html_url":"https://github.com/gambol99/go-marathon/issues/199","id":178660134,"number":199,"title":"Potential goroutine leak when using SSE subscriptions","user":{"login":"sybrandy","id":1188879,"avatar_url":"https://avatars.githubusercontent.com/u/1188879?v=3","gravatar_id":"","url":"https://api.github.com/users/sybrandy","html_url":"https://github.com/sybrandy","followers_url":"https://api.github.com/users/sybrandy/followers","following_url":"https://api.github.com/users/sybrandy/following{/other_user}","gists_url":"https://api.github.com/users/sybrandy/gists{/gist_id}","starred_url":"https://api.github.com/users/sybrandy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sybrandy/subscriptions","organizations_url":"https://api.github.com/users/sybrandy/orgs","repos_url":"https://api.github.com/users/sybrandy/repos","events_url":"https://api.github.com/users/sybrandy/events{/privacy}","received_events_url":"https://api.github.com/users/sybrandy/received_events","type":"User","site_admin":false},"labels":[{"id":176060321,"url":"https://api.github.com/repos/gambol99/go-marathon/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-09-22T16:35:44Z","updated_at":"2017-01-06T02:14:30Z","closed_at":null,"body":"The goroutine [here](https://github.com/gambol99/go-marathon/blob/master/subscription.go#L177) listens for events on two channels.  However, the goroutine has no way to know when it should stop.  If I create an application that wants to close the marathon connection, this goroutine will continue to run in the background.  It is highly suggested, and a best practice, that this goroutine be modified so that it can be stopped if the user wishes to close the connection to Marathon.\n"},"comment":{"url":"https://api.github.com/repos/gambol99/go-marathon/issues/comments/270813877","html_url":"https://github.com/gambol99/go-marathon/issues/199#issuecomment-270813877","issue_url":"https://api.github.com/repos/gambol99/go-marathon/issues/199","id":270813877,"user":{"login":"iandyh","id":431658,"avatar_url":"https://avatars.githubusercontent.com/u/431658?v=3","gravatar_id":"","url":"https://api.github.com/users/iandyh","html_url":"https://github.com/iandyh","followers_url":"https://api.github.com/users/iandyh/followers","following_url":"https://api.github.com/users/iandyh/following{/other_user}","gists_url":"https://api.github.com/users/iandyh/gists{/gist_id}","starred_url":"https://api.github.com/users/iandyh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iandyh/subscriptions","organizations_url":"https://api.github.com/users/iandyh/orgs","repos_url":"https://api.github.com/users/iandyh/repos","events_url":"https://api.github.com/users/iandyh/events{/privacy}","received_events_url":"https://api.github.com/users/iandyh/received_events","type":"User","site_admin":false},"created_at":"2017-01-06T02:14:30Z","updated_at":"2017-01-06T02:14:30Z","body":"Hi @timoreimann @sybrandy @gambol99 . I was going to ask similar questions until I found this thread. \r\n\r\nThere are two scenarios when the connection between go-marathon and Marathon Event Bus should be closed:\r\n\r\n1. Applications want to close the connection for whatever reason (Currently there is no solution for the scenario as this PR stated. )\r\n2. There are errors between the client and server, the connection should be closed and try with another Marathon node. \r\n\r\nI purposed a PR for scenario 2 to the underlying eventsource library(basically by adding a timeout and then close the channels when timeout is reached) and the maintainer of that lib suggests to do the retry and timeout at go-marathon side. I am a little bit sceptical about the suggestion and wonder you guys' advice. \r\n\r\nMore discussions can be seen here: https://github.com/donovanhide/eventsource/pull/24\r\n\r\nThanks for the reply!"}}
{"actor":{"display_login":"iandyh"}}