Re: Segment fault when using wireless (adhoc mode)



Hi Dan,
    I've tried NM-0.7.1-rc3, and got a log about this problem (see attachment: adhoc_crash.log), maybe it will be helpful.
    BTW, this adhoc_crash.log contains some log entries printed by the code in the attachment debug.patch.
NetworkManager: <info>  starting...
/sbin/ifup: interface lo already configured
NetworkManager: <info>  (eth0): new Ethernet device (driver: '8139too')
NetworkManager: <info>  (eth0): exported as /org/freedesktop/Hal/devices/net_00_1e_68_a7_37_05
NetworkManager: <info>  (wlan0): driver supports SSID scans (scan_capa 0x01).
NetworkManager: <info>  (wlan0): new 802.11 WiFi device (driver: 'rtl8187')
NetworkManager: <info>  (wlan0): exported as /org/freedesktop/Hal/devices/net_00_17_c4_4d_c8_fd
NetworkManager: <WARN>  udevadm_get_modem_capabilities(): could not run udevadm to get modem capabilities for '/sys/class/tty/ttyS0': Failed to execute child process "/sbin/udevadm" (No such file or directory)
NetworkManager: <info>  Trying to start the system settings daemon...
NetworkManager: <info>  (eth0): device state change: 1 -> 2
NetworkManager: <info>  (eth0): bringing up device.
NetworkManager: <info>  (eth0): preparing device.
NetworkManager: <info>  (eth0): deactivating device (reason: 2).
NetworkManager: <debug> [1236221723.019163] nm_device_set_ip4_config(): Got passed in new NMIP4Config, addr: 0x0
NetworkManager: <debug> [1236221723.019674] nm_device_set_ip4_config(): Got old NMIP4Config from NMDevice > private > "ip4_config", addr: 0x0
NetworkManager: <info>  (wlan0): device state change: 1 -> 2
NetworkManager: <info>  (wlan0): bringing up device.
NetworkManager: <info>  (wlan0): preparing device.
NetworkManager: <info>  (wlan0): deactivating device (reason: 2).
NetworkManager: <debug> [1236221727.715364] nm_device_set_ip4_config(): Got passed in new NMIP4Config, addr: 0x0
NetworkManager: <debug> [1236221727.718092] nm_device_set_ip4_config(): Got old NMIP4Config from NMDevice > private > "ip4_config", addr: 0x0
NetworkManager: <info>  (wlan0): device state change: 2 -> 3
NetworkManager: <info>  (wlan0): supplicant interface state:  starting -> ready
NetworkManager: <info>  Activation (wlan0) starting connection 'Wireless connection 3'
NetworkManager: <info>  (wlan0): device state change: 3 -> 4
NetworkManager: <info>  Activation (wlan0) Stage 1 of 5 (Device Prepare) scheduled...
NetworkManager: <info>  Activation (wlan0) Stage 1 of 5 (Device Prepare) started...
NetworkManager: <info>  Activation (wlan0) Stage 2 of 5 (Device Configure) scheduled...
NetworkManager: <info>  Activation (wlan0) Stage 1 of 5 (Device Prepare) complete.
NetworkManager: <info>  Activation (wlan0) Stage 2 of 5 (Device Configure) starting...
NetworkManager: <info>  (wlan0): device state change: 4 -> 5
NetworkManager: <info>  Activation (wlan0/wireless): connection 'Wireless connection 3' requires no security.  No secrets needed.
NetworkManager: <info>  Config: added 'ssid' value 'qicq'
NetworkManager: <info>  Config: added 'mode' value '1'
NetworkManager: <info>  Config: added 'key_mgmt' value 'NONE'
NetworkManager: <info>  Activation (wlan0) Stage 2 of 5 (Device Configure) complete.
NetworkManager: <info>  Config: set interface ap_scan to 2
NetworkManager: <info>  (wlan0): supplicant connection state:  scanning -> disconnected
NetworkManager: <info>  (wlan0): supplicant connection state:  disconnected -> scanning
NetworkManager: <info>  (wlan0): supplicant connection state:  scanning -> associating
NetworkManager: <info>  (wlan0): supplicant connection state:  associating -> associated
NetworkManager: <info>  (wlan0): supplicant connection state:  associated -> completed
NetworkManager: <info>  Activation (wlan0/wireless) Stage 2 of 5 (Device Configure) successful.  Connected to wireless network 'qicq'.
NetworkManager: <info>  Activation (wlan0) Stage 3 of 5 (IP Configure Start) scheduled.
NetworkManager: <info>  (wlan0): supplicant connection state:  completed -> associated
NetworkManager: <info>  (wlan0): supplicant connection state:  associated -> completed
NetworkManager: <info>  Activation (wlan0/wireless) Stage 2 of 5 (Device Configure) successful.  Connected to wireless network 'qicq'.
NetworkManager: <info>  Activation (wlan0) Stage 3 of 5 (IP Configure Start) scheduled.
NetworkManager: <info>  (wlan0): supplicant connection state:  completed -> associated
NetworkManager: <info>  (wlan0): supplicant connection state:  associated -> completed
NetworkManager: <info>  Activation (wlan0/wireless) Stage 2 of 5 (Device Configure) successful.  Connected to wireless network 'qicq'.
NetworkManager: <info>  Activation (wlan0) Stage 3 of 5 (IP Configure Start) scheduled.
NetworkManager: <info>  Activation (wlan0) Stage 3 of 5 (IP Configure Start) started...
NetworkManager: <info>  (wlan0): device state change: 5 -> 7
NetworkManager: <info>  Activation (wlan0) Stage 4 of 5 (IP Configure Get) scheduled...
NetworkManager: <info>  Activation (wlan0) Stage 3 of 5 (IP Configure Start) complete.
NetworkManager: <info>  Activation (wlan0) Stage 3 of 5 (IP Configure Start) started...
NetworkManager: <info>  Activation (wlan0) Stage 4 of 5 (IP Configure Get) scheduled...
NetworkManager: <info>  Activation (wlan0) Stage 3 of 5 (IP Configure Start) complete.
NetworkManager: <info>  Activation (wlan0) Stage 3 of 5 (IP Configure Start) started...
NetworkManager: <info>  Activation (wlan0) Stage 4 of 5 (IP Configure Get) scheduled...
NetworkManager: <info>  Activation (wlan0) Stage 3 of 5 (IP Configure Start) complete.
NetworkManager: <info>  Activation (wlan0) Stage 4 of 5 (IP Configure Get) started...
NetworkManager: <info>  Activation (wlan0) Stage 5 of 5 (IP Configure Commit) scheduled...
NetworkManager: <info>  Activation (wlan0) Stage 4 of 5 (IP Configure Get) complete.
NetworkManager: <info>  Activation (wlan0) Stage 4 of 5 (IP Configure Get) started...
NetworkManager: <info>  Activation (wlan0) Stage 5 of 5 (IP Configure Commit) scheduled...
NetworkManager: <info>  Activation (wlan0) Stage 4 of 5 (IP Configure Get) complete.
NetworkManager: <info>  Activation (wlan0) Stage 4 of 5 (IP Configure Get) started...
NetworkManager: <info>  Activation (wlan0) Stage 5 of 5 (IP Configure Commit) scheduled...
NetworkManager: <info>  Activation (wlan0) Stage 4 of 5 (IP Configure Get) complete.
NetworkManager: <info>  Activation (wlan0) Stage 5 of 5 (IP Configure Commit) started...
NetworkManager: <debug> [1236221729.688814] nm_device_set_ip4_config(): Got passed in new NMIP4Config, addr: 0x4a2210, vaild
NetworkManager: <debug> [1236221729.689415] nm_device_set_ip4_config(): Got old NMIP4Config from NMDevice > private > "ip4_config", addr: 0x0
NetworkManager: <debug> [1236221729.690135] nm_device_set_ip4_config(): add a weak ref to NMIP4Config(addr: 0x4a2210)
NetworkManager: <debug> [1236221729.690803] nm_device_set_ip4_config(): ref new NMIP4Config(addr: 0x4a2210), refcnt: 2
NetworkManager: <debug> [1236221730.700113] nm_device_set_ip4_config(): called nm_name_manager_add_ip4_config, NMIP4Config(addr: 0x4a2210) ref_cnt: 2 -> 3
NetworkManager: <debug> [1236221730.701805] nm_device_activate_stage5_ip_config_commit(): succeed to set ip4 configuration
NetworkManager: <info>  (wlan0): device state change: 7 -> 8
NetworkManager: <info>  Activation (wlan0) successful, device activated.
NetworkManager: <debug> [1236221730.756309] nm_device_activate_stage5_ip_config_commit(): unref ip4_config(addr: 0x4a2210), vaild
NetworkManager: <debug> [1236221730.759208] nm_device_activate_stage5_ip_config_commit(): after unref ip4_config(addr: 0x4a2210), refcnt: 3 -> 2
NetworkManager: <info>  Activation (wlan0) Stage 5 of 5 (IP Configure Commit) complete.
NetworkManager: <info>  Activation (wlan0) Stage 5 of 5 (IP Configure Commit) started...
NetworkManager: <debug> [1236221730.765545] nm_device_set_ip4_config(): Got passed in new NMIP4Config, addr: 0x4a2210, vaild
NetworkManager: <debug> [1236221730.767713] nm_device_set_ip4_config(): Got old NMIP4Config from NMDevice > private > "ip4_config", addr: 0x4a2210, vaild
NetworkManager: <debug> [1236221730.768184] nm_device_set_ip4_config(): NMIP4Config typeid 4892656, old_config typeid 4892656 (class 0x4abff8), new_config typeid 4892656 (class 0x4abff8)
NetworkManager: <debug> [1236221730.768672] nm_device_set_ip4_config(): call nm_ip4_config_diff: result 0x0
NetworkManager: <debug> [1236221730.769044] nm_device_activate_stage5_ip_config_commit(): succeed to set ip4 configuration
NetworkManager: <debug> [1236221730.769572] nm_device_activate_stage5_ip_config_commit(): unref ip4_config(addr: 0x4a2210), vaild
NetworkManager: <debug> [1236221730.769992] nm_device_activate_stage5_ip_config_commit(): after unref ip4_config(addr: 0x4a2210), refcnt: 2 -> 1
NetworkManager: <info>  Activation (wlan0) Stage 5 of 5 (IP Configure Commit) complete.
NetworkManager: <info>  Activation (wlan0) Stage 5 of 5 (IP Configure Commit) started...
NetworkManager: <debug> [1236221730.792455] nm_device_set_ip4_config(): Got passed in new NMIP4Config, addr: 0x4a2210, vaild
NetworkManager: <debug> [1236221730.793093] nm_device_set_ip4_config(): Got old NMIP4Config from NMDevice > private > "ip4_config", addr: 0x4a2210, vaild
NetworkManager: <debug> [1236221730.793732] nm_device_set_ip4_config(): NMIP4Config typeid 4892656, old_config typeid 4892656 (class 0x4abff8), new_config typeid 4892656 (class 0x4abff8)
NetworkManager: <debug> [1236221730.794308] nm_device_set_ip4_config(): call nm_ip4_config_diff: result 0x0
NetworkManager: <debug> [1236221730.794959] nm_device_activate_stage5_ip_config_commit(): succeed to set ip4 configuration
NetworkManager: <debug> [1236221730.795533] nm_device_activate_stage5_ip_config_commit(): unref ip4_config(addr: 0x4a2210), vaild
NetworkManager: <debug> [1236221730.796142] notify_destroy_nm_ip4_config(): NMIP4Config 0x4a2210 will be destroy, class(0x4abff8) typeid 4892656 (real typeid 4892656)
NetworkManager: <debug> [1236221730.796877] nm_device_activate_stage5_ip_config_commit(): after unref ip4_config(addr: 0x4a2210), refcnt: 1 -> 0
NetworkManager: <info>  Activation (wlan0) Stage 5 of 5 (IP Configure Commit) complete.
NetworkManager: <info>  (wlan0): supplicant connection state:  completed -> associated
NetworkManager: <info>  (wlan0): supplicant connection state:  associated -> completed
NetworkManager: nm_ip4_config_get_dbus_path: assertion `NM_IS_IP4_CONFIG (config)' failed
NetworkManager: <WARN>  nm_signal_handler(): Caught signal 11.  Generating backtrace...
NetworkManager: ******************* START **********************************
NetworkManager: [Thread debugging using libthread_db enabled]
NetworkManager: [New Thread 0x2aad0cd0 (LWP 4256)]
NetworkManager: 0x2ae32a0c in waitpid () from /lib/libpthread.so.0
NetworkManager: #0  0x2ae32a0c in waitpid () from /lib/libpthread.so.0
NetworkManager: #1  0x00437654 in nm_logging_backtrace () at nm-logging.c:70
NetworkManager: #2  0x0042f944 in nm_signal_handler (signo=<value optimized out>)
NetworkManager:     at NetworkManager.c:162
NetworkManager: #3  <signal handler called>
NetworkManager: #4  0x2b0d4d28 in strlen () from /lib/libc.so.6
NetworkManager: #5  0x2aeb5cec in ?? () from /usr/lib/libdbus-1.so.3
warning: GDB can't find the start of the function at 0x2aeb5ceb.
NetworkManager: 
NetworkManager:     GDB is unable to find the start of the function at 0x2aeb5ceb
NetworkManager: and thus can't determine the size of that function's stack frame.
NetworkManager: This means that GDB may be unable to access that stack frame, or
NetworkManager: the frames below it.
NetworkManager: ed by an invalid program counter or
NetworkManager: stack pointer.
NetworkManager:     However, if you think GDB should simply search farther back
NetworkManager: from 0x2aeb5ceb for code which looks like the beginning of a
NetworkManager: function, you can increase the range of the search using the `set
NetworkManager: ce-post' command.
NetworkManager: Backtrace stopped: previous frame inner to this frame (corrupt stack?)
NetworkManager: 
NetworkManager: Thread 1 (Thread 0x2aad0cd0 (LWP 4256)):
NetworkManager: #0  0x2ae32a0c in waitpid () from /lib/libpthread.so.0
NetworkManager: No symbol table info available.
NetworkManager: #1  0x00437654 in nm_logging_backtrace () at nm-logging.c:70
NetworkManager: st_ino = 305046, 
NetworkManager: st_rdev = 0, 
NetworkManager: st_pad3 = 0, st_atim = {
NetworkManager: tv_sec = 1236221533, 
NetworkManager: tv_nsec = 0}, 
NetworkManager: 0 <repeats 14 times>}}
NetworkManager: #2  0x0042f944 in nm_signal_handler (signo=<value optimized out>)
NetworkManager:     at NetworkManager.c:162
NetworkManager: 
NetworkManager: 
NetworkManager: #3  <signal handler called>
NetworkManager: No symbol table info available.
NetworkManager: #4  0x2b0d4d28 in strlen () from /lib/libc.so.6
NetworkManager: No symbol table info available.
NetworkManager: #5  0x2aeb5cec in ?? () from /usr/lib/libdbus-1.so.3
NetworkManager: No symbol table info available.
warning: GDB can't find the start of the function at 0x2aeb5ceb.
NetworkManager: Backtrace stopped: previous frame inner to this frame (corrupt stack?)
NetworkManager: #0  0x2ae32a0c in waitpid () from /lib/libpthread.so.0
NetworkManager: The program is running.  Quit anyway (and detach it)? (y or n) [answered Y; input not from terminal]
NetworkManager: ******************* END **********************************
diff --git a/src/nm-device.c b/src/nm-device.c
index bb24b8b..53171a0 100644
--- a/src/nm-device.c
+++ b/src/nm-device.c
@@ -123,6 +123,8 @@ static gboolean nm_device_is_up (NMDevice *self);
 
 static gboolean nm_device_set_ip4_config (NMDevice *dev, NMIP4Config *config, NMDeviceStateReason *reason);
 
+static void notify_destroy_nm_ip4_config (gpointer data, GObject *gobj);
+
 static void
 device_interface_init (NMDeviceInterface *device_interface_class)
 {
@@ -1397,6 +1399,7 @@ nm_device_activate_stage5_ip_config_commit (gpointer user_data)
 	NMConnection *connection;
 	NMSettingIP4Config *s_ip4;
 	NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE;
+	gint old_cnt, new_cnt;
 
 	ip4_config = g_object_get_data (G_OBJECT (nm_device_get_act_request (self)),
 									NM_ACT_REQUEST_IP4_CONFIG);
@@ -1407,14 +1410,15 @@ nm_device_activate_stage5_ip_config_commit (gpointer user_data)
 		priv->act_source_id = 0;
 
 	iface = nm_device_get_iface (self);
-	nm_info ("Activation (%s) Stage 5 of 5 (IP Configure Commit) started...",
-	         iface);
-
+	nm_info ("Activation (%s) Stage 5 of 5 (IP Configure Commit) started...", iface);
+		
 	if (!nm_device_set_ip4_config (self, ip4_config, &reason)) {
 		nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason);
 		goto out;
 	}
 
+	nm_debug ("succeed to set ip4 configuration");
+
 	connection = nm_act_request_get_connection (nm_device_get_act_request (self));
 	s_ip4 = (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
 	if (s_ip4)
@@ -1431,11 +1435,19 @@ nm_device_activate_stage5_ip_config_commit (gpointer user_data)
 	nm_device_state_changed (self, NM_DEVICE_STATE_ACTIVATED, NM_DEVICE_STATE_REASON_NONE);
 
 out:
-	nm_info ("Activation (%s) Stage 5 of 5 (IP Configure Commit) complete.",
-	         iface);
-
 	/* Balance IP4Config creation; device takes ownership in set_ip4_config() */
+	old_cnt = ((GObject *) ip4_config)->ref_count;
+	
+	nm_debug ("unref ip4_config(addr: 0x%x)%s", (unsigned int) ip4_config, (!ip4_config) ? "" : NM_IS_IP4_CONFIG (ip4_config) ? ", vaild" : ", invaild");
 	g_object_unref (ip4_config);
+	
+	new_cnt = ((GObject *) ip4_config)->ref_count;
+
+	nm_debug ("after unref ip4_config(addr: 0x%x), refcnt: %d -> %d",
+		(unsigned int) ip4_config, old_cnt, new_cnt);
+
+	nm_info ("Activation (%s) Stage 5 of 5 (IP Configure Commit) complete.",
+	         iface);
 
 	return FALSE;
 }
@@ -1923,7 +1935,15 @@ nm_device_get_ip4_config (NMDevice *self)
 
 	return NM_DEVICE_GET_PRIVATE (self)->ip4_config;
 }
-
+static void notify_destroy_nm_ip4_config (gpointer data, GObject *gobj)
+{
+	GTypeClass *cls = ((GTypeInstance *) gobj)->g_class;
+	nm_debug ("NMIP4Config 0x%x will be destroy, class(0x%x) typeid %d (real typeid %d)", 
+		(unsigned int) gobj,
+		(unsigned int) cls,
+		(unsigned int) cls->g_type,
+		NM_TYPE_IP4_CONFIG);
+}
 
 static gboolean
 nm_device_set_ip4_config (NMDevice *self,
@@ -1936,18 +1956,31 @@ nm_device_set_ip4_config (NMDevice *self,
 	gboolean success = TRUE;
 	NMIP4ConfigCompareFlags diff = NM_IP4_COMPARE_FLAG_ALL;
 	NMNamedManager *named_mgr;
+	int old_cnt, new_cnt;
 
 	g_return_val_if_fail (NM_IS_DEVICE (self), FALSE);
 	g_return_val_if_fail (reason != NULL, FALSE);
+	
+	nm_debug ("Got passed in new NMIP4Config, addr: 0x%x%s", (unsigned int) new_config, (!new_config) ? "" : NM_IS_IP4_CONFIG (new_config) ? ", vaild" : ", invaild");
 
 	priv = NM_DEVICE_GET_PRIVATE (self);
 	ip_iface = nm_device_get_ip_iface (self);
 
 	old_config = priv->ip4_config;
+	nm_debug ("Got old NMIP4Config from NMDevice > private > \"ip4_config\", addr: 0x%x%s", (unsigned int) old_config, (!old_config) ? "" : NM_IS_IP4_CONFIG (old_config) ? ", vaild" : ", invaild");
+	
 
-	if (new_config && old_config)
-		diff = nm_ip4_config_diff (new_config, old_config);
+	if (new_config && old_config) {
+		GTypeClass *cls_old, *cls_new;
+		
+		cls_old = ((GTypeInstance *) old_config)->g_class;
+		cls_new = ((GTypeInstance *) new_config)->g_class;
 
+		nm_debug ("NMIP4Config typeid %d, old_config typeid %d (class 0x%x), new_config typeid %d (class 0x%x)", NM_TYPE_IP4_CONFIG, cls_old ? (unsigned int) cls_old->g_type : 0, (unsigned int) cls_old, cls_new ? (unsigned int) cls_new->g_type : 0, (unsigned int) cls_new);
+		diff = nm_ip4_config_diff (new_config, old_config);
+		nm_debug ("call nm_ip4_config_diff: result 0x%x", diff);
+	}
+	
 	/* No actual change, do nothing */
 	if (diff == NM_IP4_COMPARE_FLAG_NONE)
 		return TRUE;
@@ -1955,6 +1988,7 @@ nm_device_set_ip4_config (NMDevice *self,
 	named_mgr = nm_named_manager_get ();
 	if (old_config) {
 		/* Remove any previous IP4 Config from the named manager */
+		nm_debug ("remove old NMIP4Config(addr: 0x%x) from the named manager", (unsigned int) old_config);
 		nm_named_manager_remove_ip4_config (named_mgr, ip_iface, old_config);
 		g_object_unref (old_config);
 		priv->ip4_config = NULL;
@@ -1962,16 +1996,26 @@ nm_device_set_ip4_config (NMDevice *self,
 
 	if (new_config) {
 		priv->ip4_config = g_object_ref (new_config);
-
+		nm_debug ("add a weak ref to NMIP4Config(addr: 0x%x)", (unsigned int) new_config);
+		
+		g_object_weak_ref (G_OBJECT (new_config), notify_destroy_nm_ip4_config, NULL);
+		nm_debug ("ref new NMIP4Config(addr: 0x%x), refcnt: %d",
+			(unsigned int) new_config,
+			((GObject *) new_config)->ref_count);
+		
 		success = nm_system_apply_ip4_config (ip_iface, new_config, nm_device_get_priority (self), diff);
 		if (success) {
 			/* Export over D-Bus */
 			if (!nm_ip4_config_get_dbus_path (new_config))
 				nm_ip4_config_export (new_config);
-
+			
 			/* Add the DNS information to the named manager */
+			old_cnt = ((GObject *) new_config)->ref_count;
 			nm_named_manager_add_ip4_config (named_mgr, ip_iface, new_config, NM_NAMED_IP_CONFIG_TYPE_DEFAULT);
-
+			new_cnt = ((GObject *) new_config)->ref_count;
+		
+			nm_debug ("called nm_name_manager_add_ip4_config, NMIP4Config(addr: 0x%x) ref_cnt: %d -> %d", (unsigned int) new_config, old_cnt, new_cnt);
+			
 			nm_device_update_ip4_address (self);
 		}
 	}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]