Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic -> crash #199

Open
xNxExOx opened this issue Mar 9, 2024 · 8 comments
Open

Panic -> crash #199

xNxExOx opened this issue Mar 9, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@xNxExOx
Copy link

xNxExOx commented Mar 9, 2024

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:

  • OS: Windows 11

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:

  • Do most things on main thread
    • this panic only very rarely
    • in this mode I call new_frame in main thread
    • and majority of profiling events happen in main thread too
    • egui::profiler_ui have its own thread, there is 32 threads, that have few profiling event
  • Rendering and game logic separated
    • the panic happens relatively often
    • in this mode I call new_frame in main thread again
    • but majority of profiling events happen in other threads
    • egui::profiler_ui have its own thread, there is 30 threads, that have few profiling event
@xNxExOx xNxExOx added the bug Something isn't working label Mar 9, 2024
@domatinio
Copy link

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
Copy link
Author

xNxExOx commented Mar 23, 2024

@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
Copy link

What are the reasons puffin can panic for?

@xNxExOx
Copy link
Author

xNxExOx commented Mar 23, 2024

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
Copy link

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
Copy link
Author

xNxExOx commented Mar 23, 2024

@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
Copy link
Contributor

v0x0g commented May 18, 2024

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
Copy link
Author

xNxExOx commented May 18, 2024

@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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants