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

[pull] main from JustArchiNET:main #378

Open
wants to merge 236 commits into
base: main
Choose a base branch
from
Open

Conversation

pull[bot]
Copy link

@pull pull bot commented Aug 3, 2024

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

JustArchi-ArchiBot and others added 30 commits October 8, 2024 02:21
…onnect logic

Address @ezhevita findings in regards to race conditions:

- NRE in this lambda function: https://github.com/JustArchiNET/ArchiSteamFarm/blob/1a9f2a23c45f35a969c4c9ec77a4eaa28a7136a3/ArchiSteamFarm/Steam/Bot.cs#L1962
- NRE in the ArchiSteamFarm.Steam.Bot.StopHandlingCallbacks (probably race condition?)

In general, both are caused by race conditions which can happen if user attempts to start/stop bot while critical section of handling callbacks loop is going. The code is overly complex unfortunately, so debugging it/guarantee of safety is problematic.

This commit therefore attempts to fix the underlying issue by synchronizing the code that starts/stops the underlying callbacks handling loop. While the loop itself is already thread-safe, the code that starts/stops it was not before. Now Start() as well as Stop() can not occur concurrently. On top of that, the only other place which has potential to stop the loop - final disconnect, is also guarded with additional condition that it can fire only if we're NOT set to KeepRunning at the time of calling, which should fix the situation where late disconnected callback could potentially stop already triggered new loop.

As usual in such complex situations, time will tell if this fixes all the issues we have.
Don't force reconnect if we're somehow already connected during Start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants