{"action":"created","issue":{"url":"https://api.github.com/repos/slide-rs/specs/issues/514","repository_url":"https://api.github.com/repos/slide-rs/specs","labels_url":"https://api.github.com/repos/slide-rs/specs/issues/514/labels{/name}","comments_url":"https://api.github.com/repos/slide-rs/specs/issues/514/comments","events_url":"https://api.github.com/repos/slide-rs/specs/issues/514/events","html_url":"https://github.com/slide-rs/specs/issues/514","id":381966249,"node_id":"MDU6SXNzdWUzODE5NjYyNDk=","number":514,"title":"Panic in the `merge` method in the Allocator","user":{"login":"Moxinilian","id":30992420,"node_id":"MDQ6VXNlcjMwOTkyNDIw","avatar_url":"https://avatars0.githubusercontent.com/u/30992420?v=4","gravatar_id":"","url":"https://api.github.com/users/Moxinilian","html_url":"https://github.com/Moxinilian","followers_url":"https://api.github.com/users/Moxinilian/followers","following_url":"https://api.github.com/users/Moxinilian/following{/other_user}","gists_url":"https://api.github.com/users/Moxinilian/gists{/gist_id}","starred_url":"https://api.github.com/users/Moxinilian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Moxinilian/subscriptions","organizations_url":"https://api.github.com/users/Moxinilian/orgs","repos_url":"https://api.github.com/users/Moxinilian/repos","events_url":"https://api.github.com/users/Moxinilian/events{/privacy}","received_events_url":"https://api.github.com/users/Moxinilian/received_events","type":"User","site_admin":false},"labels":[{"id":353311158,"node_id":"MDU6TGFiZWwzNTMzMTExNTg=","url":"https://api.github.com/repos/slide-rs/specs/labels/bug","name":"bug","color":"ee0701","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-11-18T14:38:43Z","updated_at":"2018-11-19T09:22:52Z","closed_at":null,"author_association":"NONE","body":"I am not quite sure what is causing this panic as it is not my project, maybe @udoprog might know more.\r\nThis is in the context of https://github.com/udoprog/asteroids-amethyst/tree/44b7412591dd4e9c81cc771707c44debc63fad5c.\r\nIf you want to run it again, I recommend replacing amethyst in the Cargo.toml to:\r\n```\r\namethyst = { git = \"https://github.com/amethyst/amethyst.git\", rev = \"6dab277cba2837791ec77e8fec707618f3fb0d2e\" }\r\n```\r\n\r\n**In debug mode**, if you spam the shooting button (space bar) for a long time and keep restarting (R button), eventually one of the restarts will trigger the following panic:\r\n```\r\nthread 'main' panicked at 'assertion failed: self.is_alive()', C:\\Users\\theod\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\specs-0.14.0\\src\\world\\entity.rs:439:9\r\nstack backtrace:\r\n   0: std::sys::windows::backtrace::set_frames\r\n             at /rustc/424a749a01224239ba2c8850f16007d57db0a242\\src/libstd\\sys\\windows\\backtrace\\mod.rs:104\r\n   1: std::sys::windows::backtrace::set_frames\r\n             at /rustc/424a749a01224239ba2c8850f16007d57db0a242\\src/libstd\\sys\\windows\\backtrace\\mod.rs:104\r\n   2: std::sys_common::backtrace::_print\r\n             at /rustc/424a749a01224239ba2c8850f16007d57db0a242\\src/libstd\\sys_common\\backtrace.rs:71\r\n   3: std::sys_common::backtrace::_print\r\n             at /rustc/424a749a01224239ba2c8850f16007d57db0a242\\src/libstd\\sys_common\\backtrace.rs:71\r\n   4: std::panicking::default_hook::{{closure}}\r\n             at /rustc/424a749a01224239ba2c8850f16007d57db0a242\\src/libstd\\panicking.rs:211\r\n   5: std::panicking::default_hook\r\n             at /rustc/424a749a01224239ba2c8850f16007d57db0a242\\src/libstd\\panicking.rs:227\r\n   6: std::panicking::rust_panic_with_hook\r\n             at /rustc/424a749a01224239ba2c8850f16007d57db0a242\\src/libstd\\panicking.rs:476\r\n   7: std::panicking::begin_panic<str*>\r\n             at \\libstd\\panicking.rs:410\r\n   8: specs::world::entity::ZeroableGeneration::die\r\n             at C:\\Users\\theod\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\specs-0.14.0\\src\\world\\entity.rs:439\r\n   9: specs::world::entity::Allocator::merge\r\n             at C:\\Users\\theod\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\specs-0.14.0\\src\\world\\entity.rs:186\r\n  10: specs::world::World::maintain\r\n             at C:\\Users\\theod\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\specs-0.14.0\\src\\world\\mod.rs:560\r\n  11: amethyst::app::CoreApplication<asteroids_amethyst::states::Data, amethyst::state_event::StateEvent, amethyst::state_event::StateEventReader>::advance_frame<asteroids_amethyst::states::Data,amethyst::state_event::StateEvent,amethyst::state_event::StateEventReader>\r\n             at C:\\Users\\theod\\.cargo\\git\\checkouts\\amethyst-fedb0a1032a075ce\\6dab277\\src\\app.rs:370\r\n  12: amethyst::app::CoreApplication<asteroids_amethyst::states::Data, amethyst::state_event::StateEvent, amethyst::state_event::StateEventReader>::run<asteroids_amethyst::states::Data,amethyst::state_event::StateEvent,amethyst::state_event::StateEventReader>\r\n             at C:\\Users\\theod\\.cargo\\git\\checkouts\\amethyst-fedb0a1032a075ce\\6dab277\\src\\app.rs:232\r\n  13: asteroids_amethyst::main\r\n             at .\\src\\main.rs:100\r\n  14: std::rt::lang_start::{{closure}}<core::result::Result<(), amethyst::error::Error>>\r\n             at \\libstd\\rt.rs:74\r\n  15: std::rt::lang_start_internal::{{closure}}\r\n             at /rustc/424a749a01224239ba2c8850f16007d57db0a242\\src/libstd\\rt.rs:59\r\n  16: std::rt::lang_start_internal::{{closure}}\r\n             at /rustc/424a749a01224239ba2c8850f16007d57db0a242\\src/libstd\\rt.rs:59\r\n  17: panic_unwind::__rust_maybe_catch_panic\r\n             at /rustc/424a749a01224239ba2c8850f16007d57db0a242\\src/libpanic_unwind\\lib.rs:102\r\n  18: std::panicking::try\r\n             at /rustc/424a749a01224239ba2c8850f16007d57db0a242\\src/libstd\\panicking.rs:289\r\n  19: std::panicking::try\r\n             at /rustc/424a749a01224239ba2c8850f16007d57db0a242\\src/libstd\\panicking.rs:289\r\n  20: std::panicking::try\r\n             at /rustc/424a749a01224239ba2c8850f16007d57db0a242\\src/libstd\\panicking.rs:289\r\n  21: std::rt::lang_start<core::result::Result<(), amethyst::error::Error>>\r\n             at \\libstd\\rt.rs:74\r\n  22: main\r\n  23: invoke_main\r\n             at f:\\dd\\vctools\\crt\\vcstartup\\src\\startup\\exe_common.inl:78\r\n  24: invoke_main\r\n             at f:\\dd\\vctools\\crt\\vcstartup\\src\\startup\\exe_common.inl:78\r\n  25: BaseThreadInitThunk\r\n26: RtlUserThreadStart\r\n```\r\n\r\n**In release mode**, with the same steps, you get a different panic that probably is related (considering the previous panic was a debug_assert):\r\n```\r\nthread 'main' panicked at 'assertion failed: !self.is_alive()', C:\\Users\\theod\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\specs-0.14.0\\src\\world\\entity.rs:449:9\r\nstack backtrace:\r\n   0: std::sys::windows::backtrace::set_frames\r\n             at /rustc/424a749a01224239ba2c8850f16007d57db0a242\\src/libstd\\sys\\windows\\backtrace\\mod.rs:104\r\n   1: std::sys::windows::backtrace::set_frames\r\n             at /rustc/424a749a01224239ba2c8850f16007d57db0a242\\src/libstd\\sys\\windows\\backtrace\\mod.rs:104\r\n   2: std::sys_common::backtrace::_print\r\n             at /rustc/424a749a01224239ba2c8850f16007d57db0a242\\src/libstd\\sys_common\\backtrace.rs:71\r\n   3: std::sys_common::backtrace::_print\r\n             at /rustc/424a749a01224239ba2c8850f16007d57db0a242\\src/libstd\\sys_common\\backtrace.rs:71\r\n   4: std::panicking::default_hook::{{closure}}\r\n             at /rustc/424a749a01224239ba2c8850f16007d57db0a242\\src/libstd\\panicking.rs:211\r\n   5: std::panicking::default_hook\r\n             at /rustc/424a749a01224239ba2c8850f16007d57db0a242\\src/libstd\\panicking.rs:227\r\n   6: std::panicking::rust_panic_with_hook\r\n             at /rustc/424a749a01224239ba2c8850f16007d57db0a242\\src/libstd\\panicking.rs:476\r\n   7: std::panicking::begin_panic\r\n   8: specs::world::entity::Allocator::merge\r\n   9: specs::world::World::maintain\r\n  10: <amethyst::app::CoreApplication<'a, T, E, R>>::run\r\n  11: asteroids_amethyst::textures::SpriteSheet::from_path\r\n  12: ron::parse::Bytes::float\r\n  13: std::rt::lang_start_internal::{{closure}}\r\n             at /rustc/424a749a01224239ba2c8850f16007d57db0a242\\src/libstd\\rt.rs:59\r\n  14: std::rt::lang_start_internal::{{closure}}\r\n             at /rustc/424a749a01224239ba2c8850f16007d57db0a242\\src/libstd\\rt.rs:59\r\n  15: panic_unwind::__rust_maybe_catch_panic\r\n             at /rustc/424a749a01224239ba2c8850f16007d57db0a242\\src/libpanic_unwind\\lib.rs:102\r\n  16: std::panicking::try\r\n             at /rustc/424a749a01224239ba2c8850f16007d57db0a242\\src/libstd\\panicking.rs:289\r\n  17: std::panicking::try\r\n             at /rustc/424a749a01224239ba2c8850f16007d57db0a242\\src/libstd\\panicking.rs:289\r\n  18: std::panicking::try\r\n             at /rustc/424a749a01224239ba2c8850f16007d57db0a242\\src/libstd\\panicking.rs:289\r\n  19: main\r\n  20: invoke_main\r\n             at f:\\dd\\vctools\\crt\\vcstartup\\src\\startup\\exe_common.inl:78\r\n  21: invoke_main\r\n             at f:\\dd\\vctools\\crt\\vcstartup\\src\\startup\\exe_common.inl:78\r\n  22: BaseThreadInitThunk\r\n23: RtlUserThreadStart\r\n```\r\nI believe the panic is from the assert at [`src/world/entity.rs#L410`](https://github.com/slide-rs/specs/blob/f0b7377c8f028b62545d76095fd31009393ea6fb/src/world/entity.rs#L410), but not explicit in the backtrace as they probably get inlined.\r\n\r\nI am not entirely sure why those asserts are present in allocator however. If they only are about bugs like that, maybe they should either be more explicit or replaced by more typical bug-related panics.\r\n\r\nNote that the panic also happens when you are not shooting, but takes many more restarts before happening. If I did not know better, I could say it is a generation overflow, but it seems unreasonable here. I'd suggest looking at how the dead entity stack in the allocator evolves to see if something fishy happens there."},"comment":{"url":"https://api.github.com/repos/slide-rs/specs/issues/comments/439824860","html_url":"https://github.com/slide-rs/specs/issues/514#issuecomment-439824860","issue_url":"https://api.github.com/repos/slide-rs/specs/issues/514","id":439824860,"node_id":"MDEyOklzc3VlQ29tbWVudDQzOTgyNDg2MA==","user":{"login":"udoprog","id":111092,"node_id":"MDQ6VXNlcjExMTA5Mg==","avatar_url":"https://avatars0.githubusercontent.com/u/111092?v=4","gravatar_id":"","url":"https://api.github.com/users/udoprog","html_url":"https://github.com/udoprog","followers_url":"https://api.github.com/users/udoprog/followers","following_url":"https://api.github.com/users/udoprog/following{/other_user}","gists_url":"https://api.github.com/users/udoprog/gists{/gist_id}","starred_url":"https://api.github.com/users/udoprog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/udoprog/subscriptions","organizations_url":"https://api.github.com/users/udoprog/orgs","repos_url":"https://api.github.com/users/udoprog/repos","events_url":"https://api.github.com/users/udoprog/events{/privacy}","received_events_url":"https://api.github.com/users/udoprog/received_events","type":"User","site_admin":false},"created_at":"2018-11-19T09:22:52Z","updated_at":"2018-11-19T09:22:52Z","author_association":"NONE","body":"One thing to note is that I make liberal use of `LazyUpdate`, and in particular [`world.maintain()`](https://github.com/amethyst/amethyst/blob/master/src/app.rs#L370) might not be called before `world.delete_all()` since I'm [dispatching right before checking for a restart](https://github.com/udoprog/asteroids-amethyst/blob/master/src/states.rs#L101).\r\n\r\nI was not able to create a reproducible example out of this though :/. I might add some code to the game to play itself for a while so that it's easier to reproduce.\r\n"}}
{"actor":{"display_login":"udoprog"}}