[OpenSER-Devel] [ openser-Patches-1728481 ] Debug level changeable during runtime

SourceForge.net noreply at sourceforge.net
Thu Jul 12 16:27:47 CEST 2007


Patches item #1728481, was opened at 2007-05-30 21:35
Message generated for change (Comment added) made by bogdan_iancu
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743022&aid=1728481&group_id=139143

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: core
Group: ver 1.2.x
Status: Open
Resolution: Accepted
Priority: 5
Private: No
Submitted By: Anatoly Pidruchny (apidruchny)
Assigned to: Bogdan (bogdan_iancu)
Summary: Debug level changeable during runtime

Initial Comment:
The proposed patch allows to change the debug level during runtime using the command:

openserctl unixsock debug <new level>

Just to get the current debug level, use the command:

openserctl unixsock debug


The feature is implemented by putting the debug level into the shared memory. The type of the global variable "debug" has been changed from int to a pointer to int.

This patch also has some improvements of the logging subsystem in the case when log_stderr logging is used:
1. Timestamp of each message is printed in the header.
2. The level of each log message is printed in the header.
3. C library functions fprintf, vfprintf and fflush are no longer used. The problem with these functions was that sometimes log messages from other openser processes were printed between a header and a body of a log message. If a lot of log messages are printed at the same time from different processes then this causes a hardly readable mess. The solution is to use our own buffer in dprint.c to construct the full log message, then print it as a whole thing using the write system call.

----------------------------------------------------------------------

>Comment By: Bogdan (bogdan_iancu)
Date: 2007-07-12 17:27

Message:
Logged In: YES 
user_id=1275325
Originator: NO

Got it - the problem is the debug pointer may be used after the shared
memory is destroyed. That is the cause of the crash you were refering at.
I made a 100% safe approach by switching the debug pointer just befor
destroing the shm memory, so it will never get to crash.

In the next days I will send on the lists an email regarding a bit of
refurbishing of the logging system/style and then we will see what to do
with the pending drpint() part.

Regards,
Bogdan

----------------------------------------------------------------------

Comment By: Anatoly Pidruchny (apidruchny)
Date: 2007-07-12 17:06

Message:
Logged In: YES 
user_id=1759384
Originator: YES

Hi Bogdan,

it was done a long time ago, but I as far as I remember, the code to move
the debug pointer to the local variable at shutdown was added to fix a
crash during shutdown. I can not tell for sure if OpenSER will crash during
shutdown without these lines, but we have these lines, we do not have
crashes during shutdown, and so I included them into the patch. Since I can
not tell for sure that these lines are really necessary, you can skip them
when you apply the patch to the SVN and then we will see how it goes. Have
you included these lines when you applied the patch to the SVN?

Regards,
Anatoly


----------------------------------------------------------------------

Comment By: Bogdan (bogdan_iancu)
Date: 2007-07-12 12:50

Message:
Logged In: YES 
user_id=1275325
Originator: NO

Hi Anatoly,

I commited the patch on SVN with the following notes:
   - extended to enable/disable at compile time the configurable debug
level.
   - proper MI integration
   - extension for dprint still not commited - I want to get a closer look
and see the impact of it.

Question: what is the purpose of :
  debug_init = *debug;
  debug = &debug_init;

at shutdown? I understand that you keep the value and move the pointer to
the local variable, but why?

Regards,
Bogdan

----------------------------------------------------------------------

Comment By: Bogdan (bogdan_iancu)
Date: 2007-07-06 14:41

Message:
Logged In: YES 
user_id=1275325
Originator: NO

Hi Anatoly,

I will review and integrate it with some idea I have regarding the debug
parameter.

Thanks and regards,
Bogdan

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=743022&aid=1728481&group_id=139143



More information about the Devel mailing list