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

Crash occurs when leaving level #43

Open
VitorOI opened this issue Jun 12, 2024 · 2 comments
Open

Crash occurs when leaving level #43

VitorOI opened this issue Jun 12, 2024 · 2 comments
Labels
awaiting replication bug Something isn't working

Comments

@VitorOI
Copy link

VitorOI commented Jun 12, 2024

We have a setup where we're constantly sending data at a 40ms rate, but the application occasionally crashes when we leave the level to our Main Menu level.

We found the culprit to be the lambda function bound to "OnDataReceived" in UDPComponent, line 270. Since this bind is not cleared on EndPlay, the lambda persists and is called constantly even while being destroyed, which causes the crash.

@getnamo getnamo added the bug Something isn't working label Jun 13, 2024
@getnamo
Copy link
Owner

getnamo commented Jun 13, 2024

The downstream callbacks are cleared here:

OnReceivedBytes = nullptr;

You can likely unbind the OnDataReceived somewhere here:

although it does get called with stop and deleted on Close so I don't quite see how it's being called after it's been cleared? Maybe a wait for a clean close might be needed?

My recommendation would be to close the connection before endplay, that should work as intended even if more data arrives.

@VitorOI
Copy link
Author

VitorOI commented Jun 18, 2024

We concluded it is the AsyncTask that somehow still runs when changing level. By setting Settings.bReceiveDataOnGameThread to false on the Actor that handles the UDP Component (this on BeginPlay), we are able to avoid the crash.

Still needs more testing but seems to be a working solution for now

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

No branches or pull requests

2 participants