Send Linux-ha-cvs mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
or, via email, send a message with subject or body 'help' to
[EMAIL PROTECTED]
You can reach the person managing the list at
[EMAIL PROTECTED]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Linux-ha-cvs digest..."
Today's Topics:
1. Linux-HA CVS: lib by andrew from
([email protected])
2. Linux-HA CVS: crm by andrew from
([email protected])
----------------------------------------------------------------------
Message: 1
Date: Thu, 6 Jul 2006 03:30:28 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: lib by andrew from
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>
linux-ha CVS committal
Author : andrew
Host :
Project : linux-ha
Module : lib
Dir : linux-ha/lib/crm/transition
Modified Files:
actions.c
Log Message:
Dont delete messages in the send_(ipc|ha)_helpers to make memory leak
checking easier
Compensate for CIB configuration growth
- enables tracking of almost all memory (de)allocations in the CIB
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/crm/transition/actions.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- actions.c 31 Mar 2006 11:50:24 -0000 1.3
+++ actions.c 6 Jul 2006 09:30:27 -0000 1.4
@@ -1,4 +1,4 @@
-/* $Id: actions.c,v 1.3 2006/03/31 11:50:24 andrew Exp $ */
+/* $Id: actions.c,v 1.4 2006/07/06 09:30:27 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -190,6 +190,7 @@
crm_xml_add(cmd, XML_ATTR_TRANSITION_KEY, counter);
ret = send_ipc_message(crm_ch, cmd);
crm_free(counter);
+ crm_msg_del(cmd);
value = g_hash_table_lookup(action->params, XML_ATTR_TE_NOWAIT);
if(ret == FALSE) {
@@ -354,6 +355,7 @@
ha_msg_add(cmd, F_CRM_SYS_FROM, CRM_SYSTEM_TENGINE);
ha_msg_addstruct(cmd, crm_element_name(state), state);
send_ipc_message(crm_ch, cmd);
+ crm_msg_del(cmd);
}
#endif
free_xml(fragment);
@@ -432,6 +434,7 @@
#else
crm_log_message(LOG_INFO, cmd);
#endif
+ crm_msg_del(cmd);
action->invoked = TRUE;
value = g_hash_table_lookup(action->params, XML_ATTR_TE_NOWAIT);
------------------------------
Message: 2
Date: Thu, 6 Jul 2006 03:30:28 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: crm by andrew from
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>
linux-ha CVS committal
Author : andrew
Host :
Project : linux-ha
Module : crm
Dir : linux-ha/crm/cib
Modified Files:
callbacks.c io.c main.c messages.c notify.c
Log Message:
Dont delete messages in the send_(ipc|ha)_helpers to make memory leak
checking easier
Compensate for CIB configuration growth
- enables tracking of almost all memory (de)allocations in the CIB
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/cib/callbacks.c,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -3 -r1.128 -r1.129
--- callbacks.c 5 Jul 2006 15:11:16 -0000 1.128
+++ callbacks.c 6 Jul 2006 09:30:28 -0000 1.129
@@ -1,4 +1,4 @@
-/* $Id: callbacks.c,v 1.128 2006/07/05 15:11:16 andrew Exp $ */
+/* $Id: callbacks.c,v 1.129 2006/07/06 09:30:28 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -282,6 +282,7 @@
enum cib_errors cib_get_operation_id(const HA_Message * msg, int *operation);
gboolean cib_process_disconnect(IPC_Channel *channel, cib_client_t
*cib_client);
+int num_clients = 0;
static void
cib_ipc_connection_destroy(gpointer user_data)
@@ -303,10 +304,14 @@
}
crm_debug_3("Destroying %s (%p)", cib_client->name, user_data);
+ num_clients--;
+ crm_debug("Num unfree'd clients: %d", num_clients);
+ START_stat_free_op();
crm_free(cib_client->name);
crm_free(cib_client->callback_id);
crm_free(cib_client->id);
crm_free(cib_client);
+ END_stat_free_op();
crm_debug_4("Freed the cib client");
return;
@@ -342,7 +347,10 @@
return NULL;
} else {
+ START_stat_free_op();
crm_malloc0(new_client, sizeof(cib_client_t));
+ END_stat_free_op();
+ num_clients++;
new_client->channel = channel;
new_client->channel_name = channel_name;
@@ -368,8 +376,13 @@
gboolean
cib_client_connect_rw_synch(IPC_Channel *channel, gpointer user_data)
{
- cib_client_t *new_client = cib_client_connect_common(
+ cl_mem_stats_t saved_stats;
+ cib_client_t *new_client = NULL;
+ crm_save_mem_stats(__PRETTY_FUNCTION__, &saved_stats);
+ new_client = cib_client_connect_common(
channel, cib_channel_ro_synchronous,
cib_rw_synchronous_callback);
+
+ crm_diff_mem_stats(LOG_ERR, __PRETTY_FUNCTION__, &saved_stats);
if(new_client == NULL) {
return FALSE;
}
@@ -379,8 +392,13 @@
gboolean
cib_client_connect_ro_synch(IPC_Channel *channel, gpointer user_data)
{
- cib_client_t *new_client = cib_client_connect_common(
+ cl_mem_stats_t saved_stats;
+ cib_client_t *new_client = NULL;
+ crm_save_mem_stats(__PRETTY_FUNCTION__, &saved_stats);
+ new_client = cib_client_connect_common(
channel, cib_channel_ro_synchronous,
cib_ro_synchronous_callback);
+
+ crm_diff_mem_stats(LOG_ERR, __PRETTY_FUNCTION__, &saved_stats);
if(new_client == NULL) {
return FALSE;
}
@@ -395,6 +413,8 @@
cib_client_t *new_client = NULL;
char uuid_str[UU_UNPARSE_SIZEOF];
gboolean (*callback)(IPC_Channel *channel, gpointer user_data);
+ cl_mem_stats_t saved_stats;
+ crm_save_mem_stats(__PRETTY_FUNCTION__, &saved_stats);
callback = cib_ro_callback;
if(safe_str_eq(user_data, cib_channel_rw)) {
@@ -412,18 +432,28 @@
cl_uuid_generate(&client_id);
cl_uuid_unparse(&client_id, uuid_str);
+
+ START_stat_free_op();
+ CRM_CHECK(new_client->id == NULL, crm_free(new_client->id));
new_client->id = crm_strdup(uuid_str);
+ END_stat_free_op();
cl_uuid_generate(&client_id);
cl_uuid_unparse(&client_id, uuid_str);
+
+ START_stat_free_op();
+ CRM_CHECK(new_client->callback_id == NULL,
crm_free(new_client->callback_id));
new_client->callback_id = crm_strdup(uuid_str);
+ END_stat_free_op();
/* make sure we can find ourselves later for sync calls
* redirected to the master instance
*/
+ START_stat_free_op();
g_hash_table_insert(
client_list, new_client->id, new_client);
-
+ END_stat_free_op();
+
reg_msg = ha_msg_new(3);
ha_msg_add(reg_msg, F_CIB_OPERATION, CRM_OP_REGISTER);
ha_msg_add(reg_msg, F_CIB_CLIENTID, new_client->id);
@@ -431,15 +461,22 @@
reg_msg, F_CIB_CALLBACK_TOKEN, new_client->callback_id);
send_ipc_message(channel, reg_msg);
+ crm_msg_del(reg_msg);
+ crm_diff_mem_stats(LOG_ERR, __PRETTY_FUNCTION__, &saved_stats);
return TRUE;
}
gboolean
cib_client_connect_null(IPC_Channel *channel, gpointer user_data)
{
- cib_client_t *new_client = cib_client_connect_common(
+ cl_mem_stats_t saved_stats;
+ cib_client_t *new_client = NULL;
+ crm_save_mem_stats(__PRETTY_FUNCTION__, &saved_stats);
+ new_client = cib_client_connect_common(
channel, cib_channel_callback, cib_null_callback);
+
+ crm_diff_mem_stats(LOG_ERR, __PRETTY_FUNCTION__, &saved_stats);
if(new_client == NULL) {
return FALSE;
}
@@ -450,7 +487,10 @@
cib_rw_callback(IPC_Channel *channel, gpointer user_data)
{
gboolean result = FALSE;
+ cl_mem_stats_t saved_stats;
+ crm_save_mem_stats(__PRETTY_FUNCTION__, &saved_stats);
result = cib_common_callback(channel, user_data, FALSE, TRUE);
+ crm_diff_mem_stats(LOG_ERR, __PRETTY_FUNCTION__, &saved_stats);
return result;
}
@@ -459,7 +499,10 @@
cib_ro_synchronous_callback(IPC_Channel *channel, gpointer user_data)
{
gboolean result = FALSE;
+ cl_mem_stats_t saved_stats;
+ crm_save_mem_stats(__PRETTY_FUNCTION__, &saved_stats);
result = cib_common_callback(channel, user_data, TRUE, FALSE);
+ crm_diff_mem_stats(LOG_ERR, __PRETTY_FUNCTION__, &saved_stats);
return result;
}
@@ -467,7 +510,10 @@
cib_rw_synchronous_callback(IPC_Channel *channel, gpointer user_data)
{
gboolean result = FALSE;
+ cl_mem_stats_t saved_stats;
+ crm_save_mem_stats(__PRETTY_FUNCTION__, &saved_stats);
result = cib_common_callback(channel, user_data, TRUE, TRUE);
+ crm_diff_mem_stats(LOG_ERR, __PRETTY_FUNCTION__, &saved_stats);
return result;
}
@@ -475,7 +521,10 @@
cib_ro_callback(IPC_Channel *channel, gpointer user_data)
{
gboolean result = FALSE;
+ cl_mem_stats_t saved_stats;
+ crm_save_mem_stats(__PRETTY_FUNCTION__, &saved_stats);
result = cib_common_callback(channel, user_data, FALSE, FALSE);
+ crm_diff_mem_stats(LOG_ERR, __PRETTY_FUNCTION__, &saved_stats);
return result;
}
@@ -484,12 +533,15 @@
{
gboolean keep_connection = TRUE;
HA_Message *op_request = NULL;
+ HA_Message *registered = NULL;
cib_client_t *cib_client = user_data;
cib_client_t *hash_client = NULL;
const char *type = NULL;
const char *uuid_ticket = NULL;
const char *client_name = NULL;
gboolean register_failed = FALSE;
+ cl_mem_stats_t saved_stats;
+ crm_save_mem_stats(__PRETTY_FUNCTION__, &saved_stats);
if(cib_client == NULL) {
crm_err("Discarding IPC message from unknown source"
@@ -498,6 +550,8 @@
}
while(IPC_ISRCONN(channel)) {
+ crm_msg_del(op_request);
+
if(channel->ops->is_message_pending(channel) == 0) {
break;
}
@@ -539,7 +593,6 @@
} else if(safe_str_neq(type, CRM_OP_REGISTER) ) {
crm_warn("Discarding IPC message from %s on callback
channel",
cib_client->id);
- crm_msg_del(op_request);
continue;
}
@@ -571,10 +624,14 @@
return FALSE;
}
+ START_stat_free_op();
+ CRM_CHECK(cib_client->id == NULL, crm_free(cib_client->id));
+ CRM_CHECK(cib_client->name == NULL, crm_free(cib_client->name));
cib_client->id = crm_strdup(uuid_ticket);
cib_client->name = crm_strdup(client_name);
-
g_hash_table_insert(client_list, cib_client->id, cib_client);
+ END_stat_free_op();
+
crm_debug_2("Registered %s on %s channel",
cib_client->id, cib_client->channel_name);
@@ -583,26 +640,27 @@
* Enable now to avoid timing issues
*/
cib_client->diffs = TRUE;
- }
-
- crm_msg_del(op_request);
+ }
- op_request = ha_msg_new(2);
- ha_msg_add(op_request, F_CIB_OPERATION, CRM_OP_REGISTER);
- ha_msg_add(op_request, F_CIB_CLIENTID, cib_client->id);
+ registered = ha_msg_new(2);
+ ha_msg_add(registered, F_CIB_OPERATION, CRM_OP_REGISTER);
+ ha_msg_add(registered, F_CIB_CLIENTID, cib_client->id);
- send_ipc_message(channel, op_request);
+ send_ipc_message(channel, registered);
+ crm_msg_del(registered);
if(channel->ch_status == IPC_CONNECT) {
break;
}
}
+ crm_msg_del(op_request);
if(channel->ch_status != IPC_CONNECT) {
crm_debug_2("Client disconnected");
keep_connection = cib_process_disconnect(channel, cib_client);
}
+ crm_diff_mem_stats(LOG_ERR, __PRETTY_FUNCTION__, &saved_stats);
return keep_connection;
}
@@ -646,7 +704,7 @@
call_stop = time_longclock();
cib_call_time += (call_stop - call_start);
- crm_diff_mem_stats(LOG_WARNING, __PRETTY_FUNCTION__, &saved_stats);
+ crm_diff_mem_stats(LOG_ERR, __PRETTY_FUNCTION__, &saved_stats);
}
gboolean
@@ -655,8 +713,9 @@
{
int lpc = 0;
HA_Message *op_request = NULL;
-
gboolean keep_channel = TRUE;
+ cl_mem_stats_t saved_stats;
+ crm_save_mem_stats(__PRETTY_FUNCTION__, &saved_stats);
if(cib_client == NULL) {
@@ -664,6 +723,7 @@
return FALSE;
}
+ START_stat_free_op();
if(cib_client->name == NULL) {
cib_client->name = crm_itoa(channel->farside_pid);
}
@@ -671,6 +731,7 @@
cib_client->id = crm_strdup(cib_client->name);
g_hash_table_insert(client_list, cib_client->id, cib_client);
}
+ END_stat_free_op();
crm_debug_2("Callback for %s on %s channel",
cib_client->id, cib_client->channel_name);
@@ -696,9 +757,7 @@
cib_common_callback_worker(
op_request, cib_client, force_synchronous, privileged);
- crm_debug_3("Cleaning up request");
crm_msg_del(op_request);
- op_request = NULL;
if(channel->ch_status == IPC_CONNECT) {
break;
@@ -712,7 +771,7 @@
keep_channel = cib_process_disconnect(channel, cib_client);
}
-
+ crm_diff_mem_stats(LOG_ERR, __PRETTY_FUNCTION__, &saved_stats);
return keep_channel;
}
@@ -741,7 +800,6 @@
crm_debug_3("Sending callback to request originator");
if(client_obj == NULL) {
local_rc = cib_reply_failed;
- ha_msg_del(client_reply);
} else {
const char *client_id = client_obj->callback_id;
@@ -754,9 +812,8 @@
client_id = client_obj->id;
}
local_rc = send_via_callback_channel(client_reply, client_id);
-
- client_reply = NULL;
}
+ ha_msg_del(client_reply);
if(local_rc != cib_ok) {
crm_warn("%sSync reply to %s failed: %s",
@@ -915,7 +972,8 @@
}
static void
-send_peer_reply(HA_Message *msg, crm_data_t *result_diff, const char
*originator, gboolean broadcast)
+send_peer_reply(
+ HA_Message *msg, crm_data_t *result_diff, const char *originator,
gboolean broadcast)
{
cl_mem_stats_t saved_stats;
HA_Message *reply_copy = NULL;
@@ -988,6 +1046,9 @@
const char *host = cl_get_string(request, F_CIB_HOST);
const char *update = cl_get_string(request, F_CIB_GLOBAL_UPDATE);
+ cl_mem_stats_t saved_stats;
+ crm_save_mem_stats(__PRETTY_FUNCTION__, &saved_stats);
+
crm_debug_4("%s Processing msg %s",
cib_our_uname, cl_get_string(request, F_SEQ));
@@ -1126,6 +1187,8 @@
crm_msg_del(op_reply);
free_xml(result_diff);
+ crm_diff_mem_stats(LOG_ERR, __PRETTY_FUNCTION__, &saved_stats);
+
return;
}
@@ -1232,9 +1295,7 @@
}
if(rc == cib_ok) {
- START_stat_free_op();
result_cib = copy_xml(current_cib);
- END_stat_free_op();
rc = cib_server_ops[call_type].fn(
op, call_options, section, input,
@@ -1269,9 +1330,7 @@
}
if(rc != cib_ok) {
- START_stat_free_op();
free_xml(result_cib);
- END_stat_free_op();
} else if(activateCibXml(result_cib, CIB_FILENAME) != 0){
crm_warn("Activation failed");
@@ -1316,6 +1375,8 @@
cib_client_t *hash_client = NULL;
GList *list_item = NULL;
enum cib_errors rc = cib_ok;
+ cl_mem_stats_t saved_stats;
+ crm_save_mem_stats(__PRETTY_FUNCTION__, &saved_stats);
crm_debug_3("Delivering msg %p to client %s", msg, token);
@@ -1374,15 +1435,9 @@
hash_client->name, token);
rc = cib_reply_failed;
}
-
- } else {
- /* be consistent...
- * send_ipc_message() will free the message, so we should do
- * so manually if we dont try to send it.
- */
- crm_msg_del(msg);
}
+ crm_diff_mem_stats(LOG_ERR, __PRETTY_FUNCTION__, &saved_stats);
return rc;
}
@@ -1472,12 +1527,16 @@
client->delegated_calls, msg);
crm_msg_del(msg);
+ crm_msg_del(reply);
}
}
gboolean
cib_process_disconnect(IPC_Channel *channel, cib_client_t *cib_client)
{
+ cl_mem_stats_t saved_stats;
+ crm_save_mem_stats(__PRETTY_FUNCTION__, &saved_stats);
+
if (channel == NULL) {
CRM_DEV_ASSERT(cib_client == NULL);
@@ -1492,10 +1551,12 @@
cib_client->id);
if(cib_client->id != NULL) {
+ START_stat_free_op();
if(!g_hash_table_remove(client_list, cib_client->id)) {
crm_err("Client %s not found in the hashtable",
cib_client->name);
}
+ END_stat_free_op();
}
}
@@ -1504,6 +1565,7 @@
initiate_exit();
}
+ crm_diff_mem_stats(LOG_ERR, __PRETTY_FUNCTION__, &saved_stats);
return FALSE;
}
@@ -1511,6 +1573,8 @@
cib_ha_dispatch(IPC_Channel *channel, gpointer user_data)
{
ll_cluster_t *hb_cluster = (ll_cluster_t*)user_data;
+ cl_mem_stats_t saved_stats;
+ crm_save_mem_stats(__PRETTY_FUNCTION__, &saved_stats);
crm_debug_3("Invoked");
if(IPC_ISRCONN(channel)) {
@@ -1521,11 +1585,8 @@
hb_cluster->llc_ops->rcvmsg(hb_cluster, 0);
}
- if (channel->ch_status != IPC_CONNECT) {
- return FALSE;
- }
-
- return TRUE;
+ crm_diff_mem_stats(LOG_ERR, __PRETTY_FUNCTION__, &saved_stats);
+ return (channel->ch_status == IPC_CONNECT);
}
void
@@ -1536,6 +1597,8 @@
const char *originator = cl_get_string(msg, F_ORIG);
const char *seq = cl_get_string(msg, F_SEQ);
const char *op = cl_get_string(msg, F_CIB_OPERATION);
+ cl_mem_stats_t saved_stats;
+ crm_save_mem_stats(__PRETTY_FUNCTION__, &saved_stats);
crm_log_message_adv(LOG_MSG, "Peer[inbound]", msg);
crm_debug_2("Peer %s message (%s) from %s", op, seq, originator);
@@ -1571,6 +1634,7 @@
cib_process_request(msg, FALSE, TRUE, TRUE, NULL);
+ crm_diff_mem_stats(LOG_ERR, __PRETTY_FUNCTION__, &saved_stats);
return;
}
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/cib/io.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -3 -r1.72 -r1.73
--- io.c 4 Jul 2006 14:07:42 -0000 1.72
+++ io.c 6 Jul 2006 09:30:28 -0000 1.73
@@ -1,4 +1,4 @@
-/* $Id: io.c,v 1.72 2006/07/04 14:07:42 andrew Exp $ */
+/* $Id: io.c,v 1.73 2006/07/06 09:30:28 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -36,6 +36,7 @@
#include <cibio.h>
#include <crm/cib.h>
+#include <crm/common/util.h>
#include <crm/msg_xml.h>
#include <crm/common/xml.h>
#include <crm/common/util.h>
@@ -508,6 +509,9 @@
crm_data_t *saved_cib = get_the_CIB();
const char *ignore_dtd = NULL;
+ long new_bytes, new_allocs, new_frees;
+ long old_bytes, old_allocs, old_frees;
+
crm_log_xml_debug_4(new_cib, "Attempting to activate CIB");
CRM_ASSERT(new_cib != saved_cib);
@@ -550,14 +554,22 @@
} else if(cib_writes_enabled && cib_status == cib_ok) {
crm_debug_2("Triggering CIB write");
G_main_set_trigger(cib_writer);
+
+ crm_xml_nbytes(new_cib, &new_bytes, &new_allocs, &new_frees);
+ crm_xml_nbytes(saved_cib, &old_bytes, &old_allocs, &old_frees);
+
+ if(new_bytes != old_bytes) {
+ crm_info("CIB size is %ld bytes (was %ld)", new_bytes,
old_bytes);
+ }
+ crm_adjust_mem_stats(
+ new_bytes - old_bytes, new_allocs - old_allocs,
new_frees - old_frees);
}
if(the_cib != saved_cib && the_cib != new_cib) {
CRM_DEV_ASSERT(error_code != cib_ok);
CRM_DEV_ASSERT(the_cib == NULL);
}
-
- START_stat_free_op();
+
if(the_cib != new_cib) {
free_xml(new_cib);
CRM_DEV_ASSERT(error_code != cib_ok);
@@ -566,7 +578,6 @@
if(the_cib != saved_cib) {
free_xml(saved_cib);
}
- END_stat_free_op();
return error_code;
@@ -704,11 +715,9 @@
{
gboolean did_update = FALSE;
- START_stat_free_op();
did_update = did_update || update_quorum(xml_obj);
did_update = did_update || set_transition(xml_obj);
did_update = did_update || set_connected_peers(xml_obj);
- END_stat_free_op();
if(did_update) {
do_crm_log(LOG_DEBUG, file, fn, "Counters updated");
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/cib/main.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -3 -r1.46 -r1.47
--- main.c 23 Jun 2006 12:30:38 -0000 1.46
+++ main.c 6 Jul 2006 09:30:28 -0000 1.47
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.46 2006/06/23 12:30:38 andrew Exp $ */
+/* $Id: main.c,v 1.47 2006/07/06 09:30:28 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -371,7 +371,6 @@
exit(exit_status);
}
-
gboolean
cib_register_ha(ll_cluster_t *hb_cluster, const char *client_name)
{
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/cib/messages.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -3 -r1.83 -r1.84
--- messages.c 4 Jul 2006 14:07:42 -0000 1.83
+++ messages.c 6 Jul 2006 09:30:28 -0000 1.84
@@ -1,4 +1,4 @@
-/* $Id: messages.c,v 1.83 2006/07/04 14:07:42 andrew Exp $ */
+/* $Id: messages.c,v 1.84 2006/07/06 09:30:28 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -284,8 +284,6 @@
char *new_value = NULL;
char *old_value = NULL;
int int_value = -1;
-
- START_stat_free_op();
if(reset == FALSE && crm_element_value(xml_obj, field) != NULL) {
old_value = crm_element_value_copy(xml_obj, field);
@@ -301,10 +299,10 @@
crm_debug_4("%s %d(%s)->%s",
field, int_value, crm_str(old_value), crm_str(new_value));
crm_xml_add(xml_obj, field, new_value);
+
crm_free(new_value);
crm_free(old_value);
- END_stat_free_op();
return cib_ok;
}
@@ -551,16 +549,15 @@
}
sync_in_progress = 0;
free_xml(*result_cib);
- START_stat_free_op();
*result_cib = copy_xml(input);
- END_stat_free_op();
send_notify = TRUE;
} else {
crm_data_t *obj_root = NULL;
+ gboolean ok = TRUE;
obj_root = get_object_root(section, *result_cib);
- START_stat_free_op();
- if(replace_xml_child(NULL, obj_root, input, FALSE) == FALSE) {
+ ok = replace_xml_child(NULL, obj_root, input, FALSE);
+ if(ok == FALSE) {
crm_debug_2("No matching object to replace");
result = cib_NOTEXISTS;
@@ -570,7 +567,6 @@
} else if(safe_str_eq(section, XML_CIB_TAG_STATUS)) {
send_notify = TRUE;
}
- END_stat_free_op();
}
if(send_notify) {
@@ -601,11 +597,9 @@
crm_validate_data(input);
crm_validate_data(*result_cib);
- START_stat_free_op();
if(replace_xml_child(NULL, obj_root, input, TRUE) == FALSE) {
crm_debug_2("No matching object to delete");
}
- END_stat_free_op();
return cib_ok;
}
@@ -629,12 +623,9 @@
crm_validate_data(input);
crm_validate_data(*result_cib);
- START_stat_free_op();
if(update_xml_child(obj_root, input) == FALSE) {
- END_stat_free_op();
return cib_NOTEXISTS;
}
- END_stat_free_op();
return cib_ok;
}
@@ -700,9 +691,7 @@
XML_CIB_TAG_CRMCONFIG
};
- START_stat_free_op();
copy_in_properties(*result_cib, input);
- END_stat_free_op();
for(lpc = 0; lpc < DIMOF(type_list); lpc++) {
type = type_list[lpc];
@@ -735,7 +724,6 @@
}
#define cib_update_xml_macro(parent, xml_update) \
- START_stat_free_op(); \
if(operation == CIB_UPDATE_OP_DELETE) { \
rc = delete_cib_object(parent, xml_update); \
update_results(failed, xml_update, operation, rc); \
@@ -748,7 +736,6 @@
rc = add_cib_object(parent, xml_update); \
update_results(failed, xml_update, operation, rc); \
} \
- END_stat_free_op();
enum cib_errors
updateList(crm_data_t *local_cib, crm_data_t *xml_section, crm_data_t *failed,
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/crm/cib/notify.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -3 -r1.36 -r1.37
--- notify.c 17 Feb 2006 13:20:03 -0000 1.36
+++ notify.c 6 Jul 2006 09:30:28 -0000 1.37
@@ -1,4 +1,4 @@
-/* $Id: notify.c,v 1.36 2006/02/17 13:20:03 andrew Exp $ */
+/* $Id: notify.c,v 1.37 2006/07/06 09:30:28 andrew Exp $ */
/*
* Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
*
@@ -71,6 +71,8 @@
int qlen = 0;
int max_qlen = 0;
+ cl_mem_stats_t saved_stats;
+ crm_save_mem_stats(__PRETTY_FUNCTION__, &saved_stats);
CRM_DEV_ASSERT(client != NULL);
CRM_DEV_ASSERT(update_msg != NULL);
@@ -110,7 +112,11 @@
ipc_client = client->channel;
qlen = ipc_client->send_queue->current_qlen;
max_qlen = ipc_client->send_queue->max_qlen;
-
+
+#if 1
+ /* get_chan_status() causes memory to be allocated that isnt free'd
+ * until the message is read (which messes up the memory stats)
+ */
if(ipc_client->ops->get_chan_status(ipc_client) != IPC_CONNECT) {
crm_debug_2("Skipping notification to disconnected"
" client %s/%s", client->name, client->id);
@@ -134,7 +140,9 @@
}
/* these are critical */
- } else if(client->diffs && is_diff) {
+ } else
+#endif
+ if(client->diffs && is_diff) {
do_send = TRUE;
} else if(client->confirmations && is_confirm) {
@@ -145,7 +153,6 @@
}
if(do_send) {
-
crm_debug_2("Notifying client %s/%s of %s update (queue=%d)",
client->name, client->channel_name, type, qlen);
@@ -155,20 +162,16 @@
is_confirm?"Confirmation":is_post?"Post":"Pre",
client->name, client->id);
- } else {
- HA_Message *msg_copy = ha_msg_copy(update_msg);
-
- if(crm_send_ipc_message(
- ipc_client, msg_copy, TRUE) == FALSE) {
- crm_warn("Notification of client %s/%s failed",
- client->name, client->id);
- }
+ } else if(send_ipc_message(ipc_client, update_msg) == FALSE) {
+ crm_warn("Notification of client %s/%s failed",
+ client->name, client->id);
}
} else {
crm_debug_3("Client %s/%s not interested in %s notifications",
client->name, client->channel_name, type);
}
+ crm_diff_mem_stats(LOG_DEBUG, __PRETTY_FUNCTION__, &saved_stats);
}
void
@@ -178,6 +181,8 @@
HA_Message *update_msg = NULL;
const char *type = NULL;
const char *id = NULL;
+ cl_mem_stats_t saved_stats;
+ crm_save_mem_stats(__PRETTY_FUNCTION__, &saved_stats);
update_msg = ha_msg_new(6);
@@ -221,6 +226,7 @@
}
crm_msg_del(update_msg);
+ crm_diff_mem_stats(LOG_ERR, __PRETTY_FUNCTION__, &saved_stats);
}
void
@@ -245,6 +251,8 @@
int del_admin_epoch = 0;
int log_level = LOG_INFO;
+ cl_mem_stats_t saved_stats;
+ crm_save_mem_stats(__PRETTY_FUNCTION__, &saved_stats);
if(diff == NULL) {
return;
@@ -275,6 +283,7 @@
}
do_cib_notify(options, op, update, result, diff, T_CIB_DIFF_NOTIFY);
+ crm_diff_mem_stats(LOG_ERR, __PRETTY_FUNCTION__, &saved_stats);
}
void
@@ -382,6 +391,8 @@
int del_updates = 0;
int del_epoch = 0;
int del_admin_epoch = 0;
+ cl_mem_stats_t saved_stats;
+ crm_save_mem_stats(__PRETTY_FUNCTION__, &saved_stats);
if(diff == NULL) {
return;
@@ -413,4 +424,5 @@
g_hash_table_foreach(client_list, cib_notify_client, replace_msg);
crm_msg_del(replace_msg);
+ crm_diff_mem_stats(LOG_ERR, __PRETTY_FUNCTION__, &saved_stats);
}
------------------------------
_______________________________________________
Linux-ha-cvs mailing list
[email protected]
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
End of Linux-ha-cvs Digest, Vol 32, Issue 25
********************************************