Commit Graph

14 Commits

Author SHA1 Message Date
blinkysc
10213d8381 Add thread safety for group operations (#1816)
Fixes crashes and race conditions when bots perform group/guild/arena
operations by moving thread-unsafe code to world thread.

Potentially fixes #1124

## Changes

- Added operation queue system that runs in world thread
- Group operations (invite, remove, convert to raid, set leader) now
queued
- Arena formation refactored to use queue
- Guild operations changed to use packet queueing

## Testing

Set `MapUpdate.Threads` > 1 in worldserver.conf to enable multiple map
threads, then test:
- Group formation and disbanding
- Arena team formation
- Guild operations (invite, promote, demote, remove)

- Run with TSAN
cmake ../ \
  -DCMAKE_CXX_FLAGS="-fsanitize=thread -g -O1" \
  -DCMAKE_C_FLAGS="-fsanitize=thread -g -O1" \
  -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=thread" \
  -DCMAKE_INSTALL_PREFIX=/path/to/install \
  -DCMAKE_BUILD_TYPE=RelWithDebInfo

build

export
TSAN_OPTIONS="log_path=tsan_report:halt_on_error=0:second_deadlock_stack=1"
./worldserver

The crashes/race conditions should no longer occur with concurrent map
threads.

## New Files

- `PlayerbotOperation.h` - Base class defining the operation interface
(Execute, IsValid, GetPriority)
- `PlayerbotOperations.h` - Concrete implementations:
GroupInviteOperation, GroupRemoveMemberOperation,
GroupConvertToRaidOperation, GroupSetLeaderOperation,
ArenaGroupFormationOperation
- `PlayerbotWorldThreadProcessor.h/cpp` - Singleton processor with
mutex-protected queue, processes operations in WorldScript::OnUpdate
hook, handles batch processing and validation

---------

Co-authored-by: blinkysc <blinkysc@users.noreply.github.com>
Co-authored-by: SaW <swerkhoven@outlook.com>
Co-authored-by: bash <hermensb@gmail.com>
2025-11-21 21:55:55 +01:00
kadeshar
85c7009fe1 Codestyle fix (#1797)
Warning:
Dont change this PR as draft to make it testable


DONT REVIEW UNTIL Codestyle C++ workflow dont pass
2025-11-05 21:10:17 +01:00
bash
0cc15411c1 license update (#1674) 2025-09-30 15:19:44 +02:00
Revision
fcb956ec1b Removed unnecessary spaces 2025-09-19 22:43:50 +02:00
kadeshar
21de08baab Fixed cross faction guilds not allowed by config (#1631)
* - Fixed cross faction guilds not allowed by config

* - Fixed doubled method bug

* - Restored deleted method
2025-09-14 10:51:18 +02:00
Atidot3
4dc808ce25 removed unwanted changes because of branch merging 2024-08-04 21:42:53 +02:00
Atidot3
25b010dd1e Merge code line 2024-08-04 12:04:06 +02:00
Atidot3
7227211ddf Chat tweak, guild bots management tooggle 2024-08-04 10:14:07 +02:00
Yunfan Li
53611c9040 Run clang-format 2024-08-04 10:23:36 +08:00
antony
142f2ad212 Chat refactor quests and generic + suggest 2024-08-01 14:13:00 +02:00
郑佩茹
5600e94e55 Crash fix in GuildManagementActions 2022-09-23 13:31:04 -06:00
郑佩茹
88d81c7a31 Tweak automation 2022-09-22 17:22:19 -06:00
郑佩茹
afd2151769 Fix bots not able to invite nearby players to existing guild 2022-09-22 15:58:07 -06:00
UltraNix
b952636f0d Big update. 2022-03-12 22:27:09 +01:00