{"action":"created","issue":{"url":"https://api.github.com/repos/sipwise/rtpengine/issues/234","repository_url":"https://api.github.com/repos/sipwise/rtpengine","labels_url":"https://api.github.com/repos/sipwise/rtpengine/issues/234/labels{/name}","comments_url":"https://api.github.com/repos/sipwise/rtpengine/issues/234/comments","events_url":"https://api.github.com/repos/sipwise/rtpengine/issues/234/events","html_url":"https://github.com/sipwise/rtpengine/pull/234","id":147434733,"number":234,"title":"Update obj_* debugging","user":{"login":"smititelu","id":11315022,"avatar_url":"https://avatars.githubusercontent.com/u/11315022?v=3","gravatar_id":"","url":"https://api.github.com/users/smititelu","html_url":"https://github.com/smititelu","followers_url":"https://api.github.com/users/smititelu/followers","following_url":"https://api.github.com/users/smititelu/following{/other_user}","gists_url":"https://api.github.com/users/smititelu/gists{/gist_id}","starred_url":"https://api.github.com/users/smititelu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smititelu/subscriptions","organizations_url":"https://api.github.com/users/smititelu/orgs","repos_url":"https://api.github.com/users/smititelu/repos","events_url":"https://api.github.com/users/smititelu/events{/privacy}","received_events_url":"https://api.github.com/users/smititelu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-04-11T13:44:39Z","updated_at":"2016-04-11T15:30:56Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/sipwise/rtpengine/pulls/234","html_url":"https://github.com/sipwise/rtpengine/pull/234","diff_url":"https://github.com/sipwise/rtpengine/pull/234.diff","patch_url":"https://github.com/sipwise/rtpengine/pull/234.patch"},"body":"We are investigating memory leaks that happen **only** on machines which establish calls via redis notifications (see #225). Leaks are not happening on machines that establish calls via offer/answer.\r\n\r\nWe believe leaks happen in rtpengine `redis_restore_call()`. Possible causes:\r\n- structures are not freed due to refcounting (this commit will help in debugging this)\r\n- free callback function of structures does not free all the content of calls established via `redis_restore_call()`; however, they free all the content of calls established via `offer/answer` since the leak can't be noticed there.\r\n- redis_restore_call() leak memory inside (e.g. forget to free the content of a glib queue etc..); this can't be noticed on current behaviour since `redis_restore()` is called only when rtpengine starts. But when notifications are turned on, it will receive SADD->DEL->SADD for each new foreign call which translates to (`redis_restore_call()`->`call_destroy()`->`redis_restore_call()`).\r\n\r\nAn idea, to be 100% sure that the leaks come from redis_restore_call(), is to have a rtpengine-ctl command that reloads redis calls on-demand. Thus, by repeatedly doing 'reload + terminate all' one can watch the system memory behaviour. Also I will investigate more using Valgrind.\r\n\r\nWhat do you think about the possible causes?\r\nWhat do you think about having a redis reload ctl command?\r\n\r\nOther ideas are welcomed."},"comment":{"url":"https://api.github.com/repos/sipwise/rtpengine/issues/comments/208402517","html_url":"https://github.com/sipwise/rtpengine/pull/234#issuecomment-208402517","issue_url":"https://api.github.com/repos/sipwise/rtpengine/issues/234","id":208402517,"user":{"login":"rfuchs","id":3227418,"avatar_url":"https://avatars.githubusercontent.com/u/3227418?v=3","gravatar_id":"","url":"https://api.github.com/users/rfuchs","html_url":"https://github.com/rfuchs","followers_url":"https://api.github.com/users/rfuchs/followers","following_url":"https://api.github.com/users/rfuchs/following{/other_user}","gists_url":"https://api.github.com/users/rfuchs/gists{/gist_id}","starred_url":"https://api.github.com/users/rfuchs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rfuchs/subscriptions","organizations_url":"https://api.github.com/users/rfuchs/orgs","repos_url":"https://api.github.com/users/rfuchs/repos","events_url":"https://api.github.com/users/rfuchs/events{/privacy}","received_events_url":"https://api.github.com/users/rfuchs/received_events","type":"User","site_admin":false},"created_at":"2016-04-11T15:30:56Z","updated_at":"2016-04-11T15:30:56Z","body":" In practise, every _entry point_ into the code should have a log_info_clear() at its end. Entry points are event handlers, such as control_ng_incoming() or stream_fd_readable(). They should use log_info_clear() just before returning to the handler loop."}}