[Home]

Summary:ASTERISK-21785: __ao2_ref_debug() logs to /tmp/refs when REF_DEBUG is not defined
Reporter:abelbeck (abelbeck)Labels:
Date Opened:2013-05-14 00:45:18Date Closed:2013-05-14 14:04:39
Priority:MajorRegression?
Status:Closed/CompleteComponents:Resources/res_xmpp
Versions:11.3.0 Frequency of
Occurrence
Related
Issues:
Environment:Embedded Linux - AstLinux 1.xAttachments:( 0) asterisk-11-disable-tmp-refs-logging.patch
( 1) jira_asterisk_21785_v11.patch
Description:When __ao2_ref_debug() is called, very often when res_xmpp is actively used, the /tmp/refs file grows to 9MB over the course of a few weeks.

In our embedded environment /tmp is RAM based and defaults to 10MB, the growing /tmp/refs file then causes problems.  We need a way to control this behavior.

A fix is to only log to /tmp/refs in __ao2_ref_debug() when REF_DEBUG is defined.  Possibly this is too simplistic of a test in general, but works for us.  Patch to follow.
Comments:By: abelbeck (abelbeck) 2013-05-14 00:47:59.185-0500

Require REF_DEBUG to be defined before __ao2_ref_debug() logs to /tmp/refs .

By: Richard Mudgett (rmudgett) 2013-05-14 10:21:36.720-0500

Are the debug messages indicating ao2_global_obj_xxx() calls?

By: abelbeck (abelbeck) 2013-05-14 10:47:32.644-0500

The /tmp/refs logs are of the form:
--
0x40950994 +1   res_xmpp.c:2405:xmpp_log_hook () [@2]
0x40950994 +1   res_xmpp.c:2405:xmpp_log_hook () [@1]
0x40950994 +1   res_xmpp.c:3295:xmpp_action_hook () [@1]
0x40950994 +1   res_xmpp.c:3575:xmpp_client_thread () [@1]
0x40950994 +1   res_xmpp.c:2405:xmpp_log_hook () [@2]
0x40950994 +1   res_xmpp.c:3575:xmpp_client_thread () [@1]
0x40950994 +1   res_xmpp.c:2405:xmpp_log_hook () [@2]
0x40950994 +1   res_xmpp.c:3575:xmpp_client_thread () [@1]
0x40950994 +1   res_xmpp.c:2405:xmpp_log_hook () [@2]
0x40950994 +1   res_xmpp.c:3575:xmpp_client_thread () [@1]
0x40950994 +1   res_xmpp.c:2405:xmpp_log_hook () [@2]
--
Yes it seems ao2_global_obj_xxx() is causing the logs by looking at the code, but that info is not in /tmp/refs.

This was touched on in ASTERISK-21046, as it is confusing to get only some of the /tmp/refs data when REF_DEBUG is not set.

By: Richard Mudgett (rmudgett) 2013-05-14 11:45:25.638-0500

[^jira_asterisk_21785_v11.patch] - Make ao2 global objects not always use the debug version of the ao2_ref() calls.

This should take care of the unexpected growth of the /tmp/refs file.

Please test and report back.

By: abelbeck (abelbeck) 2013-05-14 12:36:05.014-0500

Richard, your jira_asterisk_21785_v11.patch fixes the problem for us.  /tmp/refs is no longer created with res_xmpp .

Same results as with my original patch, but clearly your patch more elegantly solves it.

Thanks!