[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-server-cvs
Subject:    [Server-cvs] common/util trace.c,1.26,1.26.32.1
From:       mingda () helixcommunity ! org
Date:       2013-06-28 6:43:45
[Download RAW message or body]

Update of /cvsroot/server/common/util
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv26609

Modified Files:
      Tag: SERVER_15_0_3_LR
	trace.c 
Log Message:
Committed to: HEAD, SERVER_15_1_0_RN, SERVER_15_0_3_LR

Reviewed by: Richard Yuan


Synopsis
========
Fixes fixed uptime CA (brcv, tmplgpln, trace)
Branches: HEAD, SERVER_15_1_0_RN, SERVER_15_0_3_LR

Reviewer: Anyone

Description
===========
1. BroadcastReceiverFeed::DoesExist is running in worker thread and it is not a \
thread safe function. 2. session manager and security manager called \
CTBaseLog::FormOutputString in streamer thead and it cause thread safe problem. 3, \
add extra protection for szTrace in get_trace().

        
Files Affected
==============
server-restricted/broadcast/transport/bcng/recv/brcvplin.cpp
server-restricted/broadcast/transport/bcng/recv/pub/brcvplin.h
sds/session/daucplin.cpp
sds/security/daucplin.cpp
server/log/tmplgpln/base_log.cpp
server/log/tmplgpln/base_log.h
server/log/tmplgpln/clientstats_log.cpp
server/log/tmplgpln/clientstats_log.h
server/log/tmplgpln/iLogTemplate.h
server/log/tmplgpln/tmplgpln.h
server/common/util/trace.c
server/common/util/pub/trace.h

Testing Performed
=================
Integration Tests
None


Index: trace.c
===================================================================
RCS file: /cvsroot/server/common/util/trace.c,v
retrieving revision 1.26
retrieving revision 1.26.32.1
diff -u -d -r1.26 -r1.26.32.1
--- trace.c	28 Jan 2011 19:53:51 -0000	1.26
+++ trace.c	28 Jun 2013 06:43:38 -0000	1.26.32.1
@@ -41,6 +41,7 @@
  *
  * Note: This uses libunwind: http://www.nongnu.org/libunwind/
  */
+#define TraceLen  32768
 #if defined(_LINUX) && defined(_LONG_IS_64)
 #define __USE_GNU
 #include <dlfcn.h>
@@ -126,13 +127,13 @@
 
     char* pszFrame = NULL;
     int nFrameCount = 0;
-    static char szTrace[32768];
+    static char szTrace[TraceLen];
     szTrace[0] = 0;
     pszFrame = szTrace;
 
     unw_getcontext(&uc);
     unw_init_local(&cursor, &uc);
-    while (unw_step(&cursor) > 0 && nFrameCount < FRAME_LIMIT)
+    while (unw_step(&cursor) > 0 && nFrameCount < FRAME_LIMIT && (pszFrame - \
szTrace) < (TraceLen - 1024))  {
         unw_get_reg(&cursor, UNW_REG_IP, &ip);
         unw_get_reg(&cursor, UNW_REG_SP, &sp);
@@ -149,7 +150,7 @@
 get_stack(int* pSize)
 {
     int nFrameCount = 0;
-    static void* stack[32768];
+    static void* stack[TraceLen];
 
     stack[0] = 0;
 
@@ -301,7 +302,7 @@
     void* pIP = (void*)u->uc_mcontext.gregs[REGISTER_IP];
     char* pszFrame = NULL;
     int nFrameCount = 0;
-    static char szTrace[32768];
+    static char szTrace[TraceLen];
 
     szTrace[0] = 0;
     pszFrame = szTrace;
@@ -309,7 +310,7 @@
     pszFrame += find(pIP, pCurrentFrame, pszFrame);
     pIP = pCurrentFrame ? pCurrentFrame[1] : NULL;
 
-    while (pCurrentFrame && pIP && nFrameCount < FRAME_LIMIT)
+    while (pCurrentFrame && pIP && nFrameCount < FRAME_LIMIT && (pszFrame - szTrace) \
< (TraceLen - 1024))  {
         pszFrame += find(pIP, pCurrentFrame, pszFrame);
 
@@ -338,7 +339,7 @@
     volatile void* pIP = NULL;
     char* pszFrame = NULL;
     int nFrameCount = 0;
-    static char szTrace[32768];
+    static char szTrace[TraceLen];
 
     szTrace[0] = 0;
     pszFrame = szTrace;
@@ -351,7 +352,7 @@
 
     pIP = pCurrentFrame ? pCurrentFrame[1] : NULL;
 
-    while (pCurrentFrame && pIP && nFrameCount < FRAME_LIMIT)
+    while (pCurrentFrame && pIP && nFrameCount < FRAME_LIMIT && (pszFrame - szTrace) \
< (TraceLen - 1024))  {
         pszFrame += find(pIP, pCurrentFrame, pszFrame);
 


_______________________________________________
Server-cvs mailing list
Server-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/server-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic