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

ReceiveMessagesOnConnection from a worker thread with delayed SteamNetworkingMessage_t::Release() #353

Open
bartwe opened this issue Dec 5, 2024 · 1 comment

Comments

@bartwe
Copy link

bartwe commented Dec 5, 2024

Using the SteamAPI.
I'm using a worker thread to read and process received messages from ReceiveMessagesOnConnection, this is done in such a way that the matching SteamNetworkingMessage_t::Release() may be a bit later.
At times the main thread calls RunCallbacks, when this triggers the SteamNetConnectionStatusChangedCallback_t callback to notify the connection has been closed, the worker thread may not have called release yet and may do so soon, i've had crashes in the native dll in this region and i'm wondering if there is a thread safety issue here where the connection getting closed on the main thread doesn't allow the worker thread to receive and release concurrently.

@zpostfacto
Copy link
Contributor

You should be able to call release from any thread at any time. Once the API gives a message to you, it is all yours. Release() should not need to take any expensive locks, although it may need to do heap operations.

Do you have a stack trace or dump I can look at?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants