EmbarkStudios / puffin

🐦 Friendly little instrumentation profiler for Rust 🦀
Apache License 2.0
1.49k stars 75 forks source link

Panic -> crash #199

Open xNxExOx opened 8 months ago

xNxExOx commented 8 months ago

Describe the bug The more functions I profile the more often I get a panic from puffin.

To Reproduce Unforutnatelly I do not have an reproducible example, I can share a game (15GB) and instructions...

Expected behavior No panic.

Device:

Additional context panic:

.cargo\registry\src\index.crates.io-1cd66030c949c28d\puffin-0.19.0\src\frame_data.rs:455:18: We should have an unpacked frame if we don't have a packed one

I suspect it might be related to the threading model I use, but I would still expect it to not panic. The game have two threading options:

domatinio commented 7 months ago

With the above information provided, depending on the game's architecture plus your implementation of this crate, I suggest you have a look at #shared_memory and #Atomic_types.

xNxExOx commented 7 months ago

@domatinio If you was trying to link some page/documentation github removed the links. I think there isn't much I can do as an user of the library. I call puffin::set_scopes_on(true) to start it, I have puffin_egui::GlobalProfilerUi in gui thread to call .ui on, I call puffin::GlobalProfiler::lock().new_frame(), and puffin::profile_scope("...") to mark scopes to be profiled. Or is there something else I can do?

Why should "game's architecture" have any impact on this? Why is unpacker frame supposed to always exist, when packed one does not? I was not been able to figure that out from the code.

I am not sure if you was pointing to shared memory and atomic, to explain why it is panicking, or to point out, that I can do something about it, can you elaborate please?

domatinio commented 7 months ago

What are the reasons puffin can panic for?

xNxExOx commented 7 months ago

I have no idea, I can find the line https://github.com/EmbarkStudios/puffin/blob/main/puffin/src/frame_data.rs#L455 but I do not understand, why it should always pass.

domatinio commented 7 months ago

Use pseudocode to represent the whole profiler. It will help you better understand the overall flow. I do not think i can help you any further. Good luck.

xNxExOx commented 7 months ago

@domatinio why would I try to represent the profiler with pseudocode when the source code is available? Can you explain what exactly did you mean in more detail?

v0x0g commented 5 months ago

Hey @xNxExOx I'd be willing to give you a hand with debugging this one if you don't telling me what you need.

It would also be helpful to have the source along with it so I can debug, but I fully understand if you are concerned about stealing and don't wish to share it (since you've clearly put a lot of time and effort into it).

xNxExOx commented 5 months ago

@v0x0g you can download the game here: https://skylords.eu/ and we do not have source code of the game itself, we replaced a DLL, to add profiling events to the game. If you would like to help with improving (and fixing) the game help would be welcome too :)