No description
Find a file
MadMax ec1053ecf4
Fix/iocp lifecycle hardening (#242)
* fix(net): harden the IOCP backend's shutdown and connection lifecycle

Removing ACE left the IOCP (Winsock proactor) backend without several invariants
the ACE reactor had provided, each of which corrupts memory or hangs under
concurrency:

- stop() force-deleted every ConnCtx after joining the workers, while pending
  recv/send overlapped operations could still complete into the freed, embedded
  OVERLAPPEDs -- a kernel write-after-free. It now closes sockets while the
  workers are still running, tears each connection down through the normal
  markDead()+refcount path, and waits on a condition variable until BOTH the live
  connection set and the pending-accept count have drained (true I/O quiescence)
  before it joins. The listen socket is closed first so no late connection is
  stranded.

- A single connection's session callbacks (onConnect/onData/onClose) could run on
  two worker threads at once, racing the session's non-atomic state and tearing a
  session down mid-delivery. A per-ConnCtx callback mutex now serialises them, and
  a completion for an already-dead ctx is dropped instead of delivered.

- Every Winsock call on a connection socket (WSARecv/WSASend/closesocket) is
  serialised by a per-ConnCtx socket mutex, and the listen socket by its own
  mutex -- Winsock forbids concurrent calls on one descriptor.

- handleAccept() holds an accept-handler reference across its whole body (so a
  concurrent completion cannot free the ctx under it), adopts the connection only
  while still running (under the connection lock, atomic against stop()'s scan),
  and checks CreateIoCompletionPort()'s result.

- A ConnCtx is removed from the live set only when it is actually freed (erase and
  delete under one lock), which is what makes an empty set a safe quiescence
  signal for stop().

Reviewed across four rounds of adversarial cross-model review. Follow-up: the
accept pool can still shrink under sustained WSASocketW failure (needs a
timer/backoff trigger); the change is reasoned and reviewed but not yet
stress-tested under connection churn.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(db): group leader-cleanup query orders by a nonexistent column

The startup query that repairs groups whose leader is no longer a member orders
the candidate members by `memberFlags`, but `group_member` has no such column --
the schema, and the rest of the core (GroupMemberState.cpp), use `assistant`.
Every boot logs "Unknown column 'memberFlags' in 'ORDER BY'" and the repair is
silently skipped. Order by `assistant` (preferring an assistant as the fallback
leader), the column that actually exists.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-22 12:55:20 +01:00
.github ACE is dead! (#240) 2026-07-21 20:38:54 +01:00
cmake ACE is dead! (#240) 2026-07-21 20:38:54 +01:00
dep@23bcbbf822 ACE is dead! (#240) 2026-07-21 20:38:54 +01:00
extra ACE is dead! (#240) 2026-07-21 20:38:54 +01:00
src Fix/iocp lifecycle hardening (#242) 2026-07-22 12:55:20 +01:00
.dockerignore Fix Docker build CMake version (#180) 2022-10-07 19:56:11 +01:00
.gitattributes Define source file line-ending attributes (#357) 2026-06-08 19:55:39 +01:00
.gitignore [CRITICAL] Restore the connection lock to a recursive mutex (#241) 2026-07-22 09:32:11 +01:00
.gitmodules ACE is dead! (#240) 2026-07-21 20:38:54 +01:00
CLAUDE.md ACE is dead! (#240) 2026-07-21 20:38:54 +01:00
CMakeLists.txt ACE is dead! (#240) 2026-07-21 20:38:54 +01:00
Doxyfile.in Adjust Docs to refer to MangosTwo 2026-05-11 00:17:56 +01:00
LICENSE Move the license file 2018-04-16 12:36:21 +01:00
README.md Update build status badge link in README 2026-02-24 23:35:48 +00:00

Latest GitHub release GitHub last commit Downloads on GitHub

         Build Status: Linux/MAC: Windows:
Repository Status:


MangosTwo - Wrath of the Lich King WoW server

Mangos is an open source project written in C++. It's fast, runs on multiple platforms and stores game data in MySQL or MariaDB. It also has optional support for SOAP.

If you liked the third incarnation of World of Warcraft and still want to play it, this is the branch for you. We provide an authentication server where you can manage your users, and a world server which serves game content just like the original did back then.

It aims to be 100% compatible with the final version of WotLK World of Warcraft, namely patch 3.3.5a.

On top of that each update is automatically built by Travis CI (Linux/MAC) and AppVeyor (Windows) as you can see by the images in the heading above! We do love green builds, and working things.

Requirements

The server supports a wide range of operating systems, and various compiler platforms. In order to do that, we use various free cross-platform libraries and use CMake (v3.12+) to provide a cross-platform build system which adapts to your chosen operating system and compiler.

Operating systems

Currently we support running the server on the following operating systems:

  • Windows, 32 bit and 64 bit. Windows Server 2008 (or newer) or Windows 8 (or newer) is recommended.
  • Linux, 32 bit and 64 bit. Debian 7 and Ubuntu 12.04 LTS are recommended. Other distributions with similar package versions will work, too.
  • BSD, 32 bit and 64 bit. FreeBSD, NetBSD, OpenBSD are recommended.

Of course, newer versions should work, too. In the case of Windows, matching server versions will work, too.

Compilers

Building the server is currently possible with these compilers:

  • Microsoft Visual Studio 32 bit and 64 bit. All editions of Visual Studio from 2015 upwards are officially supported (although support for 2015 and 2017 are end of life.)

  • Clang, 32 bit and 64 bit. The Clang compiler can be used on any supported operating system.

Dependencies

The server stands on the shoulders of several well-known Open Source libraries plus a few awesome, but less known libraries to prevent us from inventing the wheel again.

Please note that Linux and Mac OS X users should install packages using their systems package management instead of source packages.

  • Git / Github for Windows: This version control software allows you to get the source files in the first place.
  • MySQL / MariaDB: These databases are used to store content and user data.
  • ACE: aka Adaptive Communication Environment, provides us with a solid cross-platform framework for abstracting operating system specific details.
  • Recast: In order to create navigation data from the client's map files, Recast is used to do the dirty work. It provides functions for rendering, pathing, etc.
  • G3D: This engine provides the basic framework for handling 3D data and is used to handle basic map data.
  • Stormlib: Provides an abstraction layer for reading from the client's data files.
  • Zlib/Zlib for Windows provides compression algorithms used in both MPQ archive handling and the client/server protocol.
  • Bzip2/Bzip2 for Windows provides compression algorithms used in MPQ archives.
  • OpenSSL/OpenSSL for Windows provides encryption algorithms used when authenticating clients.

ACE, Recast, G3D, Stormlib, Zlib and Bzip2 are included in the standard distribution as we rely on specific versions.

Optional dependencies

  • Doxygen: If you want to export HTML or PDF formatted documentation for the Mangos API, you should install this.


We have a small, but extremely friendly and helpful community managed by MadMax and Antz.

Our discord/forum motto is:

'Be nice or Be somewhere else'

Any trolling or unpleasantness is swiftly dealt with !!

Official Website

We welcome anyone who is interested in enjoying older versions of wow or contributing and helping out !

Discord Server

We also have a Discord server where many of us hang out and discuss Mangos related stuff.

Main Wiki

The repository of as much information as we can pack in. Details regarding the Database, file type definitions, packet definitons etc.

Bug / Issue Tracker

Found an issue or something which doesn't seem right, please log it in the relevant section of the Bug Tracker.

Installation Guides

Installation instructions for various operation systems can be found here.

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

The full license is included in the file LICENSE.

We have all put in hundreds of hours of time for free to make the server what it is today.
All we ask is that if you modify the code and make improvements, please have the decency to feed those changes back to us.

In addition, as a special exception, permission is granted to link the code of Mangos with the OpenSSL project's OpenSSL library (or with modified versions of it that use the same license as the OpenSSL library), and distribute the linked executables. You must obey the GNU General Public License in all respects for all of the code used other than OpenSSL.

Acknowledgements

World of Warcraft, and all related art, images, and lore are copyright Blizzard Entertainment, Inc.