{"action":"created","issue":{"url":"https://api.github.com/repos/vysheng/tgl/issues/49","labels_url":"https://api.github.com/repos/vysheng/tgl/issues/49/labels{/name}","comments_url":"https://api.github.com/repos/vysheng/tgl/issues/49/comments","events_url":"https://api.github.com/repos/vysheng/tgl/issues/49/events","html_url":"https://github.com/vysheng/tgl/issues/49","id":109616520,"number":49,"title":"tgl_timer_methods.insert called too often","user":{"login":"BenWiederhake","id":2690845,"avatar_url":"https://avatars.githubusercontent.com/u/2690845?v=3","gravatar_id":"","url":"https://api.github.com/users/BenWiederhake","html_url":"https://github.com/BenWiederhake","followers_url":"https://api.github.com/users/BenWiederhake/followers","following_url":"https://api.github.com/users/BenWiederhake/following{/other_user}","gists_url":"https://api.github.com/users/BenWiederhake/gists{/gist_id}","starred_url":"https://api.github.com/users/BenWiederhake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenWiederhake/subscriptions","organizations_url":"https://api.github.com/users/BenWiederhake/orgs","repos_url":"https://api.github.com/users/BenWiederhake/repos","events_url":"https://api.github.com/users/BenWiederhake/events{/privacy}","received_events_url":"https://api.github.com/users/BenWiederhake/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-03T10:35:13Z","updated_at":"2015-10-03T11:35:45Z","closed_at":null,"body":"While investigating a new bug, I noticed that tgl calls `.insert` before the old timer happened, and without calling `.remove` first.\r\n\r\nHere's a backtrace: http://pastebin.com/ihdTvwfc\r\n\r\nHere's my summary:\r\n\r\n- `tgl_timer_insert` (in telegram-purple), called by:\r\n- `tree_act_ex_query` (in queries.c:113), called by:\r\n- `tree_act_ex_query` (in queries.c:113), called by:\r\n- `tree_act_ex_query` (in queries.c:113), called by:\r\n- `tree_act_ex_query` (in queries.c:113), called by:\r\n- `tglq_regen_queries_from_old_session` (in queries.c:199), called by:\r\n- `rpc_execute_answer` (in mtproto-client.c:831), called by:\r\n- `rpc_execute_answer` (in mtproto-client.c:831), called by:\r\n- `rpc_execute_answer` (in mtproto-client.c:831), called by:\r\n- `rpc_execute_answer` (in mtproto-client.c:831), called by:\r\n- `rpc_execute` (in mtproto-client.c:1148)\r\n\r\nI think this is a impendence mismatch in `tree_act_ex_query`: It calls *itself* recursively, which calls `tglq_regen_queries_from_old_session` (given as argument), which *again* calls `tree_act_ex_query` recursively."},"comment":{"url":"https://api.github.com/repos/vysheng/tgl/issues/comments/145241833","html_url":"https://github.com/vysheng/tgl/issues/49#issuecomment-145241833","issue_url":"https://api.github.com/repos/vysheng/tgl/issues/49","id":145241833,"user":{"login":"majn","id":2327132,"avatar_url":"https://avatars.githubusercontent.com/u/2327132?v=3","gravatar_id":"","url":"https://api.github.com/users/majn","html_url":"https://github.com/majn","followers_url":"https://api.github.com/users/majn/followers","following_url":"https://api.github.com/users/majn/following{/other_user}","gists_url":"https://api.github.com/users/majn/gists{/gist_id}","starred_url":"https://api.github.com/users/majn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/majn/subscriptions","organizations_url":"https://api.github.com/users/majn/orgs","repos_url":"https://api.github.com/users/majn/repos","events_url":"https://api.github.com/users/majn/events{/privacy}","received_events_url":"https://api.github.com/users/majn/received_events","type":"User","site_admin":false},"created_at":"2015-10-03T11:35:45Z","updated_at":"2015-10-03T11:35:45Z","body":"Calling tgl_timer_insert multiple times shouldn't be an issue.\r\n\r\nWhat the function appears to do is to iterate through all running queries to restart them. The reason why the function shows up multiple times is that tree.h implements it as a recursive function (https://github.com/vysheng/tgl/blob/master/tree.h#L133-L147). "}}