{"action":"created","issue":{"url":"https://api.github.com/repos/ZoneMinder/zoneminder/issues/855","repository_url":"https://api.github.com/repos/ZoneMinder/zoneminder","labels_url":"https://api.github.com/repos/ZoneMinder/zoneminder/issues/855/labels{/name}","comments_url":"https://api.github.com/repos/ZoneMinder/zoneminder/issues/855/comments","events_url":"https://api.github.com/repos/ZoneMinder/zoneminder/issues/855/events","html_url":"https://github.com/ZoneMinder/zoneminder/issues/855","id":81458078,"node_id":"MDU6SXNzdWU4MTQ1ODA3OA==","number":855,"title":"zm_signal.cpp ignores signal safety","user":{"login":"davidsainty","id":2861601,"node_id":"MDQ6VXNlcjI4NjE2MDE=","avatar_url":"https://avatars0.githubusercontent.com/u/2861601?v=4","gravatar_id":"","url":"https://api.github.com/users/davidsainty","html_url":"https://github.com/davidsainty","followers_url":"https://api.github.com/users/davidsainty/followers","following_url":"https://api.github.com/users/davidsainty/following{/other_user}","gists_url":"https://api.github.com/users/davidsainty/gists{/gist_id}","starred_url":"https://api.github.com/users/davidsainty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidsainty/subscriptions","organizations_url":"https://api.github.com/users/davidsainty/orgs","repos_url":"https://api.github.com/users/davidsainty/repos","events_url":"https://api.github.com/users/davidsainty/events{/privacy}","received_events_url":"https://api.github.com/users/davidsainty/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2015-05-27T13:57:01Z","updated_at":"2018-06-15T22:02:19Z","closed_at":null,"author_association":"NONE","body":"Both zm_hup_handler() and zm_term_handler() call Info(), which calls zm_logger.cpp:logPrint(), which is a long long long way off being signal safe.\n\nThe solution has to be to not call the logging functions from the signal handlers.\n\nThe reason why I found this is that I have a one-off problem with an event, with Start Time = May 26 18:34:21, but the frames are deep storage'd in 15/05/26/18/34/25.  Because the directory doesn't match, the event is unviewable.\n\nThis happened because zm_logger.cpp:logPrint() calls localtime() and so does zm_event.cpp:Event::Event(), and the TERM signal just happened to be called at the right time to trash the contents of the localtime() results it appears.\n- 1432640065.372001 | zma_m1 | 22291 |0|INF| Reception: 073 - Gone into alarm state               | zm_monitor.cpp | 1444 | 2015-05-26 18:34:25\n- 1432640065.409520 | zmdc   |  2524 |0|INF| 'zma -m 1' stopping at 15/05/26 18:34:25             | zmdc.pl        | NULL | 2015-05-26 18:34:25\n- 1432640065.759327 | zma_m1 | 22291 |0|INF| Got signal 15 (Terminated), exiting                  | zm_signal.cpp  |   40 | 2015-05-26 18:34:25\n- 1432640065.813068 | zma_m1 | 22291 |0|INF| Reception: 073 - Opening new event 2305, alarm start | zm_monitor.cpp | 1464 | 2015-05-26 18:34:25\n\nOn a side note, the call to `Warning( \"Event %d has zero time, setting to current\", id );` in zm_event.cpp would have the same breaking effect.  This simpler case could be solved by extracting the contents of the localtime() results immediately, rather than assuming they will be safe - that really should happen here.\n## <bountysource-plugin>\n\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/18131039-zm_signal-cpp-ignores-signal-safety?utm_campaign=plugin&utm_content=tracker%2F188329&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F188329&utm_medium=issues&utm_source=github).\n</bountysource-plugin>\n"},"comment":{"url":"https://api.github.com/repos/ZoneMinder/zoneminder/issues/comments/397753507","html_url":"https://github.com/ZoneMinder/zoneminder/issues/855#issuecomment-397753507","issue_url":"https://api.github.com/repos/ZoneMinder/zoneminder/issues/855","id":397753507,"node_id":"MDEyOklzc3VlQ29tbWVudDM5Nzc1MzUwNw==","user":{"login":"stale[bot]","id":26384082,"node_id":"MDM6Qm90MjYzODQwODI=","avatar_url":"https://avatars3.githubusercontent.com/in/1724?v=4","gravatar_id":"","url":"https://api.github.com/users/stale%5Bbot%5D","html_url":"https://github.com/apps/stale","followers_url":"https://api.github.com/users/stale%5Bbot%5D/followers","following_url":"https://api.github.com/users/stale%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/stale%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/stale%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stale%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/stale%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/stale%5Bbot%5D/repos","events_url":"https://api.github.com/users/stale%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/stale%5Bbot%5D/received_events","type":"Bot","site_admin":false},"created_at":"2018-06-15T22:02:19Z","updated_at":"2018-06-15T22:02:19Z","author_association":"NONE","body":"This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.\n"}}
{"actor":{"display_login":"stale"}}