{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/22702","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/22702/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/22702/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/22702/events","html_url":"https://github.com/rust-lang/rust/issues/22702","id":58556143,"number":22702,"title":"Crashes on periodic timers","user":{"login":"vhbit","id":140199,"avatar_url":"https://avatars.githubusercontent.com/u/140199?v=3","gravatar_id":"","url":"https://api.github.com/users/vhbit","html_url":"https://github.com/vhbit","followers_url":"https://api.github.com/users/vhbit/followers","following_url":"https://api.github.com/users/vhbit/following{/other_user}","gists_url":"https://api.github.com/users/vhbit/gists{/gist_id}","starred_url":"https://api.github.com/users/vhbit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vhbit/subscriptions","organizations_url":"https://api.github.com/users/vhbit/orgs","repos_url":"https://api.github.com/users/vhbit/repos","events_url":"https://api.github.com/users/vhbit/events{/privacy}","received_events_url":"https://api.github.com/users/vhbit/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/rust/labels/A-x86_64","name":"A-x86_64","color":"d7e102"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-02-23T08:24:15Z","updated_at":"2016-01-08T06:10:13Z","closed_at":"2016-01-08T06:10:13Z","body":"I have rare but regular crashes while using periodic timers, here are a couple of stacktraces:\r\n\r\nSample 1\r\n-------------\r\n\r\nThread 1 - crashed thread (timer helper)\r\n```\r\n0  syncpoint                      0x0000000100181604 sync::mpsc::Sender$LT$T$GT$::send::h16650001638270525609\r\n1  syncpoint                      0x000000010018c628 sys::timer::helper::signal::hab3153c68321ad88HcF\r\n2  syncpoint                      0x000000010018c628 sys::timer::helper::signal::hab3153c68321ad88HcF\r\n3  syncpoint                      0x000000010018783c sys::timer::helper::hdac220bc3f730824MaF\r\n```\r\n\r\nSample 2\r\n------------\r\n\r\nThread 1 - crashed thread\r\n```\r\n0  syncpoint                      0x00000001001d30bc sync::mpsc::stream::Packet$LT$T$GT$::send::h1567901069159111330\r\n1  syncpoint                      0x00000001001d3284 sync::mpsc::stream::Packet$LT$T$GT$::send::h1567901069159111330\r\n2  syncpoint                      0x00000001001d1df4 sys_common::helper_thread::Helper$LT$M$GT$::send::h11186096963694568971\r\n3  syncpoint                      0x00000001001c4410 io::timer::Timer::periodic::h21d0a7b80a1b161f5Tg\r\n```\r\n\r\nThread 2 (timer helper)\r\n```\r\n0  libsystem_kernel.dylib         0x000000019447b498 __select + 8\r\n1  syncpoint                      0x00000001001c9074 sys::timer::helper::h0574e0739f8f1c6d6Kw\r\n```\r\n\r\nSample 3\r\n------------\r\n\r\nThread 1 - crashed thread\r\n\r\n```\r\n0  syncpoint                      0x00000001001e9bdc sync::mpsc::stream::Packet$LT$T$GT$::send::h12172527083798108928\r\n1  syncpoint                      0x00000001001e9b6c sync::mpsc::stream::Packet$LT$T$GT$::send::h12172527083798108928\r\n2  syncpoint                      0x00000001001e847c sys_common::helper_thread::Helper$LT$M$GT$::send::h3499295349918654522\r\n3  syncpoint                      0x00000001001e6ee4 sys::timer::Timer::inner::h199f8c41d26dfeaaDoF\r\n4  syncpoint                      0x00000001001d7b90 sys::timer::Timer.Drop::drop::h28078e5d8eac0274jpF\r\n```\r\n\r\nThread 2 (timer helper)\r\n\r\n```\r\n0  libsystem_kernel.dylib         0x000000019387f498 __select + 8\r\n1  syncpoint                      0x00000001001df824 sys::timer::helper::hdac220bc3f730824MaF\r\n```\r\n\r\nThe most interesting thing is that I can't reproduce it on i386/armv7, crashes happen only on aarch64 devices. \r\n\r\nConsidering `Packet.send` is defined as:\r\n\r\n``` rust\r\n    pub fn send(&mut self, t: T) -> Result<(), T> {\r\n        // If the other port has deterministically gone away, then definitely\r\n        // must return the data back up the stack. Otherwise, the data is\r\n        // considered as being sent.\r\n        if self.port_dropped.load(Ordering::SeqCst) { return Err(t) }\r\n\r\n        match self.do_send(Data(t)) {\r\n            UpSuccess | UpDisconnected => {},\r\n            UpWoke(token) => { token.signal(); }\r\n        }\r\n        Ok(())\r\n    }\r\n```\r\n\r\nit looks like crash point is inlined `self.port_dropped.load` call, which should be translated into intrinsic, which is weird. \r\n\r\nConsidering channels are used quite intensively in the app and have no other crashes other than in periodic timers, it seems the problem is actually related to timer + helper_thread communications, but so far I have no idea what exactly can go wrong."},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/169906223","html_url":"https://github.com/rust-lang/rust/issues/22702#issuecomment-169906223","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/22702","id":169906223,"user":{"login":"huonw","id":1203825,"avatar_url":"https://avatars.githubusercontent.com/u/1203825?v=3","gravatar_id":"","url":"https://api.github.com/users/huonw","html_url":"https://github.com/huonw","followers_url":"https://api.github.com/users/huonw/followers","following_url":"https://api.github.com/users/huonw/following{/other_user}","gists_url":"https://api.github.com/users/huonw/gists{/gist_id}","starred_url":"https://api.github.com/users/huonw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huonw/subscriptions","organizations_url":"https://api.github.com/users/huonw/orgs","repos_url":"https://api.github.com/users/huonw/repos","events_url":"https://api.github.com/users/huonw/events{/privacy}","received_events_url":"https://api.github.com/users/huonw/received_events","type":"User","site_admin":false},"created_at":"2016-01-08T06:10:13Z","updated_at":"2016-01-08T06:10:13Z","body":"Timers no longer exist, so I'm closing."}}