jackpoz f23b5fb96d Core/Socket: Fix race condition in WorldSocket
ReactorRunnable::svc() checks the status of WorldSockets while WorldRunnable::run() updates them, causing a race condition.

Helgrind log:
Possible data race during write of size 8 at 0x49961810 by thread #9
Locks held: 1, at address 0x4367A620
   at 0x51781F7: ACE_Message_Block::copy(char const*, unsigned long) (Message_Block.inl:372)
   by 0x15D048F: WorldSocket::SendPacket(WorldPacket const&) (WorldSocket.cpp:180)
   by 0x141C45E: WorldSession::SendPacket(WorldPacket const*) (WorldSession.cpp:223)
   by 0x15C49C4: WorldSession::SendAuthResponse(unsigned char, bool, unsigned int) (AuthHandler.cpp:37)
   by 0x14DA71C: World::AddSession_(WorldSession*) (World.cpp:278)
   by 0x14E601E: World::UpdateSessions(unsigned int) (World.cpp:2617)
   by 0x14E3E67: World::Update(unsigned int) (World.cpp:1986)
   by 0x100EAFA: WorldRunnable::run() (WorldRunnable.cpp:60)
   by 0x163A626: ACE_Based::Thread::ThreadTask(void*) (Threading.cpp:186)
   by 0x518F555: ACE_OS_Thread_Adapter::invoke() (OS_Thread_Adapter.cpp:103)
   by 0x4C2B5AD: mythread_wrapper (hg_intercepts.c:219)
   by 0x61DAB4F: start_thread (pthread_create.c:304)

This conflicts with a previous read of size 8 by thread #14
Locks held: none
   at 0x1008414: ACE_Message_Block::length() const (Message_Block.inl:131)
   by 0x15D1207: WorldSocket::Update() (WorldSocket.cpp:448)
   by 0x1427CA3: ReactorRunnable::svc() (WorldSocketMgr.cpp:177)
   by 0x51CBB16: ACE_Task_Base::svc_run(void*) (Task.cpp:271)
   by 0x51CD3BC: ACE_Thread_Adapter::invoke_i() (Thread_Adapter.cpp:161)
   by 0x51CD4D4: ACE_Thread_Adapter::invoke() (Thread_Adapter.cpp:96)
   by 0x4C2B5AD: mythread_wrapper (hg_intercepts.c:219)
   by 0x61DAB4F: start_thread (pthread_create.c:304)

Address 0x49961810 is 16 bytes inside a block of size 80 alloc'd
   at 0x4C286BB: operator new(unsigned long, std::nothrow_t const&) (vg_replace_malloc.c:316)
   by 0x15D0818: WorldSocket::open(void*) (WorldSocket.cpp:237)
   by 0x1429560: ACE_Acceptor<WorldSocket, ACE_SOCK_Acceptor>::activate_svc_handler(WorldSocket*) (Acceptor.cpp:347)
   by 0x142916D: ACE_Acceptor<WorldSocket, ACE_SOCK_Acceptor>::handle_input(int) (Acceptor.cpp:429)
   by 0x515F48D: ACE_Dev_Poll_Reactor::dispatch_io_event(ACE_Dev_Poll_Reactor::Token_Guard&) (Dev_Poll_Reactor.inl:86)
   by 0x5161653: ACE_Dev_Poll_Reactor::handle_events(ACE_Time_Value*) (Dev_Poll_Reactor.cpp:1015)
   by 0x51ACCFC: ACE_Reactor::run_reactor_event_loop(ACE_Time_Value&, int (*)(ACE_Reactor*)) (Reactor.cpp:267)
   by 0x1427C57: ReactorRunnable::svc() (WorldSocketMgr.cpp:170)
   by 0x51CBB16: ACE_Task_Base::svc_run(void*) (Task.cpp:271)
   by 0x51CD3BC: ACE_Thread_Adapter::invoke_i() (Thread_Adapter.cpp:161)
   by 0x51CD4D4: ACE_Thread_Adapter::invoke() (Thread_Adapter.cpp:96)
   by 0x4C2B5AD: mythread_wrapper (hg_intercepts.c:219)
2013-09-01 21:32:34 +02:00
2013-01-01 00:41:01 +01:00
2013-01-21 02:47:51 +00:00
2013-08-18 20:11:24 +02:00
2012-10-13 03:47:14 +03:00

logo TrinityCore

Introduction

TrinityCore is a MMORPG Framework based mostly in C++.

It is derived from MaNGOS, the Massive Network Game Object Server, and is based on the code of that project with extensive changes over time to optimize, improve and cleanup the codebase at the same time as improving the in-game mechanics and functionality.

It is completely open source; community involvement is highly encouraged.

If you wish to contribute ideas or code please visit our site linked below or make pull requests to our Github repository.

For further information on the TrinityCore project, please visit our project website at TrinityCore.org.

Requirements

  • Platform: Linux, Windows or Mac
  • Processor with SSE2 support
  • ACE ≥ 5.8.3 (included for Windows)
  • MySQL ≥ 5.1.0 (included for Windows)
  • CMake ≥ 2.8.0
  • OpenSSL ≥ 1.0.0
  • GCC ≥ 4.3 (Linux only)
  • MS Visual Studio ≥ 9 (2008) (Windows only)

Install

Detailed installation guides are available in the wiki for Windows, Linux and Mac OSX.

Reporting issues

Issues can be reported via the Github issue tracker.

Please take the time to review existing issues before submitting your own to prevent duplicates.

In addition, thoroughly read through the issue tracker guide to ensure your report contains the required information. Incorrect or poorly formed reports are wasteful and are subject to deletion.

Submitting fixes

Fixes are submitted as pull requests via Github. For more information on how to properly submit a pull request, read the how-to: maintain a remote fork.

License: GPL 2.0

Read file COPYING

Authors & Contributors

Read file THANKS

Site

Wiki

Documentation (powered by Doxygen)

Forums

Description
Server emulator for World of Warcraft 3.3.5.12340 and other versions
Readme 10 GiB
Languages
C++ 89%
C 10.4%
CMake 0.4%