{"action":"created","issue":{"url":"https://api.github.com/repos/PistonDevelopers/sdl2_window/issues/144","labels_url":"https://api.github.com/repos/PistonDevelopers/sdl2_window/issues/144/labels{/name}","comments_url":"https://api.github.com/repos/PistonDevelopers/sdl2_window/issues/144/comments","events_url":"https://api.github.com/repos/PistonDevelopers/sdl2_window/issues/144/events","html_url":"https://github.com/PistonDevelopers/sdl2_window/issues/144","id":59827648,"number":144,"title":"Windows freeze of SDL after arbitrary amount of time","user":{"login":"ebfull","id":3794471,"avatar_url":"https://avatars.githubusercontent.com/u/3794471?v=3","gravatar_id":"","url":"https://api.github.com/users/ebfull","html_url":"https://github.com/ebfull","followers_url":"https://api.github.com/users/ebfull/followers","following_url":"https://api.github.com/users/ebfull/following{/other_user}","gists_url":"https://api.github.com/users/ebfull/gists{/gist_id}","starred_url":"https://api.github.com/users/ebfull/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ebfull/subscriptions","organizations_url":"https://api.github.com/users/ebfull/orgs","repos_url":"https://api.github.com/users/ebfull/repos","events_url":"https://api.github.com/users/ebfull/events{/privacy}","received_events_url":"https://api.github.com/users/ebfull/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-03-04T17:02:27Z","updated_at":"2015-03-05T11:29:33Z","closed_at":null,"body":"After maybe 30 minutes or an hour, pretty much randomly it seems, my event loop freezes on Windows only. I created a very simple demo application which triggers the problem: https://github.com/ebfull/brokensdl\r\n\r\n```rust\r\nextern crate sdl2_window;\r\nextern crate opengl_graphics;\r\nextern crate piston;\r\n\r\nuse std::cell::RefCell;\r\nuse sdl2_window::Sdl2Window;\r\npub use opengl_graphics::{ Gl, OpenGL };\r\nuse piston::window::WindowSettings;\r\n\r\nuse piston::event::{\r\n\tself,\r\n\tEvent\r\n};\r\npub use piston::event::{\r\n\tRenderArgs,\r\n\tUpdateArgs\r\n};\r\n\r\nfn main() {\r\n\tlet opengl = OpenGL::_3_2;\r\n\tlet window = RefCell::new(Sdl2Window::new(\r\n\t\topengl,\r\n\t\tWindowSettings {\r\n\t\t\ttitle: format!(\"Howdy!\"),\r\n\t\t\tsize: [900, 900],\r\n\t\t\tfullscreen: false,\r\n\t\t\texit_on_esc: true,\r\n\t\t\tsamples: 4,\r\n\t\t}\r\n\t));\r\n\r\n\tlet mut gl = Gl::new(opengl);\r\n\tfor event in event::events(&window) {\r\n\t\tprintln!(\"processing event: {:?}\", event);\r\n\t\tif let Event::Render(args) = event {\r\n\t\t\tgl.draw([0, 0, args.width as i32, args.height as i32], |_, gl| {});\r\n\t\t}\r\n\t\tprintln!(\"finished event!\");\r\n\t}\r\n}\r\n```\r\n\r\nAs you can see in my program, I print at the beginning and end of the event loop iteration to demonstrate the event loop is getting stuck on the iterator's .next().\r\n\r\nHere's the console output of my program:\r\n\r\n```\r\nfinished event!\r\nprocessing event: Update(UpdateArgs { dt: 0.008333 })\r\nfinished event!\r\nprocessing event: Idle(IdleArgs { dt: 0.002937 })\r\nfinished event!\r\nprocessing event: Update(UpdateArgs { dt: 0.008333 })\r\nfinished event!\r\nprocessing event: Update(UpdateArgs { dt: 0.008333 })\r\nfinished event!\r\nprocessing event: Idle(IdleArgs { dt: 0.000382 })\r\nfinished event!\r\nprocessing event: Idle(IdleArgs { dt: 5153.363529 })\r\nfinished event!\r\nprocessing event: Idle(IdleArgs { dt: 0.004295 })\r\nfinished event!\r\nprocessing event: Idle(IdleArgs { dt: 5153.365719 })\r\nfinished event!\r\nprocessing event: Idle(IdleArgs { dt: 5153.367442 })\r\nfinished event!\r\nprocessing event: Idle(IdleArgs { dt: 5153.337568 })\r\nfinished event!\r\n```\r\n\r\nSuddenly it seems, IdleArgs starts sending me a dt of over 5000. The window becomes unresponsive. Fetching the \"next\" event takes forever.\r\n\r\nI looked at the stack of the only thread doing anything:\r\n\r\n```\r\nntoskrnl.exe!memset+0x61a\r\nntoskrnl.exe!KeWaitForMultipleObjects+0xd52\r\nntoskrnl.exe!KeWaitForSingleObject+0x19f\r\nntoskrnl.exe!_misaligned_access+0xba4\r\nntoskrnl.exe!_misaligned_access+0x1821\r\nntoskrnl.exe!KeWaitForMultipleObjects+0xf5d\r\nntoskrnl.exe!KeWaitForSingleObject+0x19f\r\nntoskrnl.exe!NtWaitForSingleObject+0xde\r\nntoskrnl.exe!KeSynchronizeExecution+0x3a23\r\nntdll.dll!NtWaitForSingleObject+0xa\r\nKERNELBASE.dll!WaitForSingleObjectEx+0x9c\r\nSDL2.dll!SDL_LogCritical+0xad1d6\r\nSDL2.dll!SDL_LogCritical+0xad8c5\r\nSDL2.dll!SDL_LogCritical+0xa8339\r\nSDL2.dll!SDL_LogCritical+0x49ae7\r\nSDL2.dll!SDL_LogCritical+0xad3ca\r\nkernel32.dll!BaseThreadInitThunk+0xd\r\nntdll.dll!RtlUserThreadStart+0x21\r\n```\r\n\r\nIt's pretty much stuck calling SDL_LogCritical over and over? Or maybe SDL_LogCritical is getting stuck? I've tried several times to get errors out of SDL but I have no idea how. Is there any way to debug this further? I can replicate the issue very consistently, just keep the application open."},"comment":{"url":"https://api.github.com/repos/PistonDevelopers/sdl2_window/issues/comments/77348697","html_url":"https://github.com/PistonDevelopers/sdl2_window/issues/144#issuecomment-77348697","issue_url":"https://api.github.com/repos/PistonDevelopers/sdl2_window/issues/144","id":77348697,"user":{"login":"bvssvni","id":1743862,"avatar_url":"https://avatars.githubusercontent.com/u/1743862?v=3","gravatar_id":"","url":"https://api.github.com/users/bvssvni","html_url":"https://github.com/bvssvni","followers_url":"https://api.github.com/users/bvssvni/followers","following_url":"https://api.github.com/users/bvssvni/following{/other_user}","gists_url":"https://api.github.com/users/bvssvni/gists{/gist_id}","starred_url":"https://api.github.com/users/bvssvni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bvssvni/subscriptions","organizations_url":"https://api.github.com/users/bvssvni/orgs","repos_url":"https://api.github.com/users/bvssvni/repos","events_url":"https://api.github.com/users/bvssvni/events{/privacy}","received_events_url":"https://api.github.com/users/bvssvni/received_events","type":"User","site_admin":false},"created_at":"2015-03-05T11:29:33Z","updated_at":"2015-03-05T11:29:33Z","body":"I think we should try to solve this before we close it.\r\n\r\n@ebfull I've saw you did some experiments in the IRC logs, would you mind posting them on https://github.com/tomaka/clock_ticks/issues ?"}}