aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMachiavelli <machiavelli.trinity@gmail.com>2012-03-27 13:33:02 +0300
committerMachiavelli <machiavelli.trinity@gmail.com>2012-03-27 13:33:02 +0300
commit1ee7196ec0bb5bbd81ca260146405b17fac32e30 (patch)
treef502c4f93079b0165e313dc71d7d103913942be0
parent88d81d27cfc863823cc2cd6c5a511bc78baa4414 (diff)
Core/DB Layer: Fix helgrind errors on some concurrent access to resultset auto pointers.
Example: ==8753== Possible data race during read of size 8 at 0x2e803e60 by thread #8 ==8753== at 0xDD0FFC: PreparedResultSet::operator[](unsigned int) const (QueryResult.h:83) ==8753== by 0x131D82D: WorldSession::HandleCharEnum(Trinity::AutoPtr<PreparedResultSet, ACE_Null_Mutex>) (CharacterHandler.cpp:217) ==8753== by 0x118F8C3: WorldSession::ProcessQueryCallbacks() (WorldSession.cpp:1087) {..} ==8753== Address 0x2e803e60 is 0 bytes inside a block of size 16 alloc'd ==8753== at 0x4C28B75: operator new(unsigned long) (vg_replace_malloc.c:261) ==8753== by 0x137D515: __gnu_cxx::new_allocator<Field*>::allocate(unsigned long, void const*) (new_allocator.h:92) ==8753== by 0x137D378: std::_Vector_base<Field*, std::allocator<Field*> >::_M_allocate(unsigned long) (in /home/aokromes/bin/bin/worldserver) ==8753== by 0x137CEC6: std::vector<Field*, std::allocator<Field*> >::_M_fill_insert(__gnu_cxx::__normal_iterator<Field**, std::vector<Field*, std::allocator<Field*> > >, unsigned long, Field* const&) (vector.tcc:416) ==8753== by 0x137CB27: std::vector<Field*, std::allocator<Field*> >::insert(__gnu_cxx::__normal_iterator<Field**, std::vector<Field*, std::allocator<Field*> > >, unsigned long, Field* const&) (stl_vector.h:944) ==8753== by 0x137C964: std::vector<Field*, std::allocator<Field*> >::resize(unsigned long, Field*) (stl_vector.h:632) ==8753== by 0x137BFCA: PreparedResultSet::PreparedResultSet(st_mysql_stmt*, st_mysql_res*, unsigned long, unsigned int) (QueryResult.cpp:98) ==8753== by 0x137A12B: MySQLConnection::Query(PreparedStatement*) (MySQLConnection.cpp:493) ==8753== by 0x137F663: PreparedStatementTask::Execute() (PreparedStatement.cpp:412) Have a feeling this is a false positive, though. Nevertheless good to get rid of.
-rwxr-xr-xsrc/server/shared/Database/QueryResult.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/server/shared/Database/QueryResult.h b/src/server/shared/Database/QueryResult.h
index 2c09cb19c81..e32b16555bc 100755
--- a/src/server/shared/Database/QueryResult.h
+++ b/src/server/shared/Database/QueryResult.h
@@ -58,7 +58,7 @@ class ResultSet
MYSQL_FIELD* _fields;
};
-typedef Trinity::AutoPtr<ResultSet, ACE_Null_Mutex> QueryResult;
+typedef Trinity::AutoPtr<ResultSet, ACE_Thread_Mutex> QueryResult;
class PreparedResultSet
{
@@ -103,7 +103,7 @@ class PreparedResultSet
};
-typedef Trinity::AutoPtr<PreparedResultSet, ACE_Null_Mutex> PreparedQueryResult;
+typedef Trinity::AutoPtr<PreparedResultSet, ACE_Thread_Mutex> PreparedQueryResult;
#endif