Commit Graph

8835 Commits

Author SHA1 Message Date
jackpoz
7228bd3664 Revert "Core/Logging: Use logger cache for speed up logger filter search"
This reverts commit 39331ea7b9.
This is required to fix a race condition introduced with the logger cache. Adding a locking mechanism might make worthless the speed gain added by the cache itself, push a proper thread-safe implementation if it's worth it.

Helgrind log:
Possible data race during write of size 8 at 0x736F428 by thread #1
Locks held: none
   at 0x11872DF: std::_Hashtable<std::string, std::pair<std::string const, Logger const*>, std::allocator<std::pair<std::string const, Logger const*> >, std::__detail::_Select1st, std::equal_to<std::string>, std::hash<std::string>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_insert_bucket_begin(unsigned long, std::__detail::_Hash_node<std::pair<std::string const, Logger const*>, true>*) (hashtable.h:1196)
   by 0x11865A1: std::_Hashtable<std::string, std::pair<std::string const, Logger const*>, std::allocator<std::pair<std::string const, Logger const*> >, std::__detail::_Select1st, std::equal_to<std::string>, std::hash<std::string>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_insert_unique_node(unsigned long, unsigned long, std::__detail::_Hash_node<std::pair<std::string const, Logger const*>, true>*) (hashtable.h:1342)
   by 0x1185A48: std::__detail::_Map_base<std::string, std::pair<std::string const, Logger const*>, std::allocator<std::pair<std::string const, Logger const*> >, std::__detail::_Select1st, std::equal_to<std::string>, std::hash<std::string>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true>, true>::operator[](std::string const&) (hashtable_policy.h:496)
   by 0x1184F3A: std::unordered_map<std::string, Logger const*, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, Logger const*> > >::operator[](std::string const&) (unordered_map.h:596)
   by 0x1184495: Log::GetLoggerByType(std::string const&) (Log.h:106)
   by 0x1184527: Log::ShouldLog(std::string const&, LogLevel) (Log.h:112)
   by 0x16E7121: World::LoadConfigSettings(bool) (World.cpp:909)
   by 0x16EB623: World::SetInitialWorldSettings() (World.cpp:1276)
   by 0x118F0EC: Master::Run() (Master.cpp:169)
   by 0x1196AFF: main (Main.cpp:142)

This conflicts with a previous read of size 8 by thread #3
Locks held: none
   at 0x1186EA6: std::_Hashtable<std::string, std::pair<std::string const, Logger const*>, std::allocator<std::pair<std::string const, Logger const*> >, std::__detail::_Select1st, std::equal_to<std::string>, std::hash<std::string>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_find_before_node(unsigned long, std::string const&, unsigned long) const (hashtable.h:1162)
   by 0x1186263: std::_Hashtable<std::string, std::pair<std::string const, Logger const*>, std::allocator<std::pair<std::string const, Logger const*> >, std::__detail::_Select1st, std::equal_to<std::string>, std::hash<std::string>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_find_node(unsigned long, std::string const&, unsigned long) const (hashtable.h:604)
   by 0x11857B9: std::_Hashtable<std::string, std::pair<std::string const, Logger const*>, std::allocator<std::pair<std::string const, Logger const*> >, std::__detail::_Select1st, std::equal_to<std::string>, std::hash<std::string>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::find(std::string const&) (hashtable.h:1025)
   by 0x1184DE2: std::unordered_map<std::string, Logger const*, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, Logger const*> > >::find(std::string const&) (unordered_map.h:543)
   by 0x11842EF: Log::GetLoggerByType(std::string const&) (Log.h:84)
   by 0x1184527: Log::ShouldLog(std::string const&, LogLevel) (Log.h:112)
   by 0x189AACA: MySQLConnection::Execute(char const*) (MySQLConnection.cpp:175)
   by 0x18A3225: BasicStatementTask::Execute() (AdhocStatement.cpp:56)

Address 0x736F428 is 120 bytes inside a block of size 184 alloc'd
   at 0x4C2AE3A: operator new(unsigned long, std::nothrow_t const&) (vg_replace_malloc.c:350)
   by 0x1185046: ACE_Singleton<Log, ACE_Thread_Mutex>::instance() (Singleton.cpp:91)
   by 0x11968E2: main (Main.cpp:135)
2014-05-18 16:53:29 +02:00
jackpoz
0904858624 Revert "Core/Logging: store loggers in cache correctly"
This reverts commit c6a4d5a1de.
2014-05-18 16:04:59 +02:00
jackpoz
a83c315771 Core/Calendar: Fix warning
Fix warning added b6048f89f7 about signed/unsigned comparison mismatch
2014-05-18 14:41:11 +02:00
Shauren
f9c7bb4171 Partially revert f296095191 "Fix various warnings. The core, the scripts and the tools now compile without warnings with -Wall -Wextra -pedantic."
Visual studio does not support constexpr
Made semicolon after "Prepare*Script" mandatory - workaround for dumb IDEs inserting extra indentation level after newline
2014-05-18 12:50:10 +02:00
Sebastian Valle Herrera
b70edf7bca Merge pull request #12071 from Praetonus/warnings
Fix various warnings.
2014-05-17 18:40:23 -05:00
Sebastian Valle Herrera
d76da63a5a Merge pull request #12070 from Trisjdc/more_sai
Core/SAI: Prevent nullifying damage, because of player damage requirements
2014-05-17 18:37:50 -05:00
jackpoz
5e86dea0b0 Shared/Packets: Handle crash by throwing an exception instead
Throw a ByteBufferException when trying to access the first element of an empty ByteBuffer class
2014-05-18 00:51:40 +02:00
jackpoz
c200d2c8cc Core/Warden: Fix crash
Fix crash with empty CMSG_WARDEN_DATA packets
2014-05-18 00:29:00 +02:00
jackpoz
03f16d2e90 Shared/Database: Increase Database Worker Pool queue size
Increase DatabaseWorkerPool queue size from the default 16KB to 8MB to avoid blocking the caller thread when queuing an async statement/transaction.
2014-05-17 23:48:32 +02:00
Shauren
8eeec647d1 Fixed build without pch 2014-05-17 21:35:39 +02:00
jackpoz
b6048f89f7 Core/Calendar: Align max amount of Players to be invited to Client limits
Limit the max amount of Players to be invited to a Calendar event to 100, same limit as the one in the Client
2014-05-17 21:22:28 +02:00
Shauren
a62f95e4c2 Core/Calendar: Use single database transaction for adding multiple invites when creating new event 2014-05-17 21:02:01 +02:00
joschiwald
1dbc943297 Core/GameObjects: fixed instant reset of gameobjects after activation 2014-05-17 20:05:43 +02:00
Praetonus
f296095191 Fix various warnings. The core, the scripts and the tools now compile without warnings with -Wall -Wextra -pedantic.
-Fix warnings from -Woverflow on implicit constant conversion.
-Fix warnings from -pedantic.
-Fix warnings from -pedantic.
-Fix warnings from -Wformat.

Two minor changes in addition :

-Replace a defined value equal to 2^31 - 1 by std::numeric_limits<int>::max().
-Remove useless null-check on pointer returned by new. New doesn't returns nullptr on failure, it throws std::bad_alloc.
2014-05-15 21:32:47 +02:00
Trisjdc
50336af1c7 Core/SAI: Prevent nullifying damage, because of player damage requirements 2014-05-15 17:05:02 +01:00
jackpoz
9d760098a5 Core/Misc: Fix crash in ticket creation
Fix a crash happening with malicious CMSG_GMTICKET_CREATE packets.
2014-05-14 22:07:20 +02:00
jackpoz
32386be8e7 Merge pull request #12021 from Trisjdc/spell_target_dest
Core/Spells: Replace MovePosition by MovePositionToFirstCollision in spell dest target handling.
2014-05-13 21:02:07 +02:00
jackpoz
d32180df17 Merge pull request #12058 from Trisjdc/sunwell
Scripts/SWP: Sathrovarr will no longer cause player teleports on grid load
2014-05-13 20:48:23 +02:00
Trisjdc
593fb9b68a Scripts/SWP: Sathrovarr will no longer cause player teleports on grid load 2014-05-13 11:32:56 +01:00
jackpoz
db2593f41d Core/Arena: Fix exploit in arena team
Fix exploit that allowed anyone to add a target Player to any arena team.
2014-05-12 22:40:55 +02:00
jackpoz
b17e3246fe Core/Misc: Fix static analysis issues
Fix uninitialized values spotted by coverity.
Remove unused "dynamic analysis" code, use Valgrind or another dynamic analysis tool instead if needed.
2014-05-12 21:18:59 +02:00
Discover-
da50b92cdf Merge pull request #12050 from Trisjdc/u_liek_fish_questionmark
Core/Spells: Fix fishing on areas with liquid data but no valid height
2014-05-12 06:34:52 +02:00
joschiwald
de6eddaa35 Scripts/HoR: fixed conflict between multiple classes with same name
Closes #12051
2014-05-11 18:13:02 +02:00
Trisjdc
11f6eb91c0 Core/Spells: Fix fishing on areas with liquid data but no valid height 2014-05-11 14:43:12 +01:00
Gacko
b76bcad46e Script/ICC: Use existing method for getting GO auto-close-time 2014-05-11 15:15:43 +02:00
Gacko
39410b35a4 Merge branch 'master' of github.com:TrinityCore/TrinityCore 2014-05-11 12:37:29 +02:00
Gacko
dabbe38022 Core/GameObject: Set trap type 0 back to GO_READY after activation.
Otherwise it would be activated again on every update. My fault, moving the activation code to GO_ACTIVATED skips the cooldown check.

Closes #12047
2014-05-11 12:35:40 +02:00
Kinzcool
392e045bda DB: Changed WDBVerified startdard to VerifiedBuild 2014-05-11 03:15:31 -04:00
MitchesD
8e7cf15dd1 Scripts/HallsOfReflection: Major changes
* corrections to Intro Event (Falric, Marwyn etc.)
* fixed issues with Frostsworn General
* improved the whole Wrath of the Lich King event
* implemented outro gunship
* optimalization code and cleanup and fixed some typos
* Big thanks to @joschiwald, he is author too ;-)
2014-05-10 21:37:33 +02:00
Discover-
71795bf977 Core/Trade: It's no longer possible to fake the amount of gold put into the trade window. It's only visual but still an exploit, allowing scamming. 2014-05-09 17:58:04 +02:00
MitchesD
eabec73d98 Scripts/Duskwood: prevention to spawn multiple Twilight Corrupter and fixed some issues there 2014-05-09 16:59:55 +02:00
Trisjdc
cb7668ab5a Core/Spells: Replace MovePosition by MovePositionToFirstCollision in spell dest target handling.
- Solves issues such as being able to summon creatures inside terrain/gameobjects, being able to fall through terrain by using Shadowstep/Feral Charge (Cat), and much more
2014-05-07 11:58:08 +01:00
Gacko
111bbb3620 Remove unnecessary check in previous fix 2014-05-06 19:06:59 +02:00
Gacko
41d9364b16 Core/GameObject: Fix crash added in c6bf7e0b1d
Thanks @jackpoz
2014-05-06 18:46:08 +02:00
Gacko
b48879ab79 Core/GameObject: Finish moving activation code of traps to GO_ACTIVATED
Fixing #6388 should be easier now...
2014-05-05 22:28:45 +02:00
jackpoz
2878b0d105 Core/Misc: Fix enchants broken in 3aca9e64b3
Compare cast item entry instead of checking cast item spells to fix the exploit mentioned in 3aca9e64b3 without breaking any functionality.
2014-05-05 20:05:33 +02:00
Gacko
3ac4e3033c Core/GameObject: Add missing initialization of m_lootStateUnit 2014-05-05 18:59:56 +02:00
Gacko
c6bf7e0b1d Core/GameObject: Store unit in GameObject::SetLootState - required for trap activation. 2014-05-05 18:39:53 +02:00
Gacko
d0e6693266 Core/GameObject: Format comments and apply rename of previous commit. 2014-05-05 12:35:41 +02:00
Vincent-Michael
b6bf83589c Core/Gameobject: Added missing break in 24ef7dbdf4 2014-05-05 10:06:44 +02:00
Gacko
99e04ddaf6 Fix indention from changes in previous commit. 2014-05-04 22:32:24 +02:00
Gacko
24ef7dbdf4 Core/GameObject: Solve some TODOs related to traps in GameObject::Update and improve logic.
Some more changes, TODO solutions and a fix for traps like those in #1359 or #6388 will follow.
2014-05-04 22:18:12 +02:00
Dehravor
109495ac9b Scripts/Ulduar: Fix crash when Algalon's Big Bang is casted by player 2014-05-04 20:30:19 +02:00
jackpoz
1c0c163485 Core/Misc: Fix warning 2014-05-04 14:03:42 +02:00
jackpoz
3aca9e64b3 Core/Misc: Fix exploit
Fix exploit that allowed to learn spells from recipes without consuming them.
2014-05-04 13:41:07 +02:00
jackpoz
720c3cbbd0 Core/Misc: Fix exploit
Fix exploit that allowed to duplicate stackable splitable items. If the item that cast the spell can't be found anymore, the spell is cancelled.

Fixes https://github.com/TrinityCore/TrinityCore/issues/11977
2014-05-03 21:22:12 +02:00
Aokromes
d7b1405725 Merge pull request #11968 from Dehravor/cpp11
Core/Misc: Remove remaining COMPILER_HAS_CPP11_SUPPORT related macros
2014-05-03 19:25:36 +02:00
Lucas
065207b1b8 Core/Spells: Correct a mistake in HOT aura procs
A crash fix was added in 3e0d2e4944
but the usage of spellProcEvent itself was incorrect, we should instead use spellProto of aura to be procced
2014-05-03 02:28:49 +02:00
Aokromes
0c8df80415 Core/Auth: Add support for build 13930 of china
By phoenixfight closes #11978
2014-05-03 02:11:37 +02:00
jackpoz
3e0d2e4944 Core/Misc: Fix static analysis issues 2014-05-02 23:21:37 +02:00