We don't won't the ability to trace 1024 long DNs! We should fix the bug 
instead and truncate at a reasonable line length, 256 bytes?
/Hans

From: Neelakanta Reddy [mailto:[email protected]]
Sent: den 5 september 2014 15:41
To: [email protected]
Subject: [tickets] [opensaf:tickets] #970 logtrace: increase max message length 
of 1024 bytes for trace, syslog (and make it configurable) for printing longDN


Tried with the following patch, logs got truncated to 1024 and no garbage 
information is seen

diff --git a/osaf/libs/core/common/logtrace.c b/osaf/libs/core/common/logtrace.c
--- a/osaf/libs/core/common/logtrace.c
+++ b/osaf/libs/core/common/logtrace.c
@@ -105,10 +105,16 @@ static void output(const char *file, uns
i = vsnprintf(log_string, sizeof(log_string), preamble, ap);

/* Add line feed if not there already */

  *   if (log_string[i - 1] != '\n') {
  *   log_string[i] = '\n';
  *   log_string[i + 1] = '\0';
  *   i++;
  *   if(i >= 1023) {
  *   log_string[1022] = '\n';
  *   log_string[1023] = '\0';
  *   syslog(LOG_ERR, "logtrace: NEEL1 i=%d \n", i);
  *   } else {
  *   if (log_string[i - 1] != '\n') {
  *   log_string[i] = '\n';
  *   log_string[i + 1] = '\0';
  *   i++;

*      }
}

/ If we got here without a file descriptor, trace was enabled in runtime, open 
the file /
@@ -121,7 +127,7 @@ static void output(const char *file, uns
}

write_retry:
- i = write(trace_fd, log_string, i);
+ i = write(trace_fd, log_string, strlen(log_string));
if (i == -1) {
if (errno == EAGAIN)
goto write_retry;

________________________________

[tickets:#970]<http://sourceforge.net/p/opensaf/tickets/970> logtrace: increase 
max message length of 1024 bytes for trace, syslog (and make it configurable) 
for printing longDN

Status: accepted
Milestone: 4.5.0
Created: Fri Jul 25, 2014 01:38 PM UTC by surender khetavath
Last Updated: Fri Sep 05, 2014 11:31 AM UTC
Owner: Mathi Naickan

gcc 4.9
setup : 1 controller
changeset : 5454 and included patches for longDns
Test:
1) Create a object A with longDN value
2) Create a object B(not longDn) with parent A ie [B,A]
3) Delete the object created in step 2 ie [B,A]

Logs attached.full bt attached with the logs tar.
IMMND log time stamp
Jul 25 18:53:59.392355 osafimmnd [2285:ImmModel.cc:5069]

GDB output:

(gdb) bt

0 std::_Rb_tree_increment(std::_Rb_tree_node_base*) ()

at ../../../../../gcc-4.9.0/libstdc++-v3/src/c++98/tree.cc:84

1 0x000000000046a58f in std::_Rb_tree_iterator<std::pair<std::string const,="" 
ObjectMutation*=""> >::operator++()

() at /usr/include/c++/4.9.0/bits/stl_tree.h:203

2 0x000000000043c10d in ImmModel::ccbCommit(unsigned int, std::vector<unsigned 
int,="" std::allocator<unsigned="" int=""> >&) () at ImmModel.cc:5154
3 0x000000000042d95e in immModel_ccbCommit () at ImmModel.cc:1254
4 0x0000000000418da9 in immnd_evt_proc_ccb_apply ()
5 0x0000000000419974 in immnd_evt_proc_fevs_dispatch ()
6 0x000000000041c2a8 in immnd_evt_proc_fevs_rcv ()
7 0x00000000004065f9 in immnd_process_evt ()
8 0x000000000041fbba in main ()

(gdb) fr 2

2 0x000000000043c10d in ImmModel::ccbCommit(unsigned int, std::vector<unsigned 
int,="" std::allocator<unsigned="" int=""> >&) () at ImmModel.cc:5154

warning: Source file is more recent than executable.
5154 for(omit=ccb->mMutations.begin(); omit!=ccb->mMutations.end(); ++omit){
(gdb) l
5149 }
5150 ccb->mWaitStartTime = 0;
5151
5152 //Do the actual commit!
5153 ObjectMutationMap::iterator omit;
5154 for(omit=ccb->mMutations.begin(); omit!=ccb->mMutations.end(); ++omit){
5155 ccbNotEmpty=true;
5156 ObjectMutation* omut = omit->second;
5157 osafassert(!omut->mWaitForImplAck);
5158 switch(omut->mOpType){

________________________________

Sent from sourceforge.net because 
[email protected]<mailto:[email protected]>
 is subscribed to 
https://sourceforge.net/p/opensaf/tickets/<https://sourceforge.net/p/opensaf/tickets>

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/opensaf/admin/tickets/options. Or, if this is a 
mailing list, you can unsubscribe from the mailing list.
------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Opensaf-tickets mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-tickets

Reply via email to