From: Daniel Wagner <[email protected]> Hi,
As Julien has reported there is something fishy going on when a ethernet cable is removed. What you see is basically: Service: ethernet_00219b1da0f4_cable state changed: idle and then Service: ethernet_00219b1da0f4_cable state changed: configuration I was able to reproduce this very easily. As it turns out, the network object is never destroyed. The reason for this is that the service state machine tries to reconnect to the network we want to destroy and then we get out of sync with the refcounting: attache cable: src/network.c:connman_network_ref_debug() 0x6ccb30 name Wired ref 2 by src/device.c:971:connman_device_add_network() src/network.c:connman_network_ref_debug() 0x6ccb30 name Wired ref 3 by src/service.c:5313:update_from_network() src/network.c:connman_network_ref_debug() 0x6ccb30 name Wired ref 4 by src/network.c:1158:autoconf_ipv6_set() src/network.c:connman_network_ref_debug() 0x6ccb30 name Wired ref 5 by src/dhcp.c:490:__connman_dhcp_start() detach cable: src/network.c:connman_network_unref_debug() 0x6ccb30 name Wired ref 3 by src/dhcp.c:505:__connman_dhcp_stop() src/network.c:connman_network_ref_debug() 0x6ccb30 name Wired ref 4 by src/network.c:1158:autoconf_ipv6_set() src/network.c:connman_network_ref_debug() 0x6ccb30 name Wired ref 5 by src/dhcp.c:490:__connman_dhcp_start() src/network.c:connman_network_unref_debug() 0x6ccb30 name Wired ref 4 by src/dhcp.c:505:__connman_dhcp_stop() src/network.c:connman_network_ref_debug() 0x6ccb30 name Wired ref 5 by src/network.c:1158:autoconf_ipv6_set() src/network.c:connman_network_ref_debug() 0x6ccb30 name Wired ref 6 by src/dhcp.c:490:__connman_dhcp_start() src/network.c:connman_network_unref_debug() 0x6ccb30 name Wired ref 5 by src/dhcp.c:505:__connman_dhcp_stop() src/network.c:connman_network_ref_debug() 0x6ccb30 name Wired ref 6 by src/network.c:1158:autoconf_ipv6_set() src/network.c:connman_network_ref_debug() 0x6ccb30 name Wired ref 7 by src/dhcp.c:490:__connman_dhcp_start() src/network.c:connman_network_unref_debug() 0x6ccb30 name Wired ref 6 by src/service.c:3496:service_free() src/network.c:connman_network_unref_debug() 0x6ccb30 name Wired ref 5 by src/device.c:449:free_network() src/network.c:connman_network_unref_debug() 0x6ccb30 name Wired ref 4 by plugins/ethernet.c:124:remove_network() src/network.c:connman_network_unref_debug() 0x6ccb30 name Wired ref 3 by src/network.c:1096:check_dhcpv6() src/network.c:connman_network_unref_debug() 0x6ccb30 name Wired ref 2 by src/network.c:1096:check_dhcpv6() src/network.c:connman_network_unref_debug() 0x6ccb30 name Wired ref 1 by src/network.c:1096:check_dhcpv6() Of course, there are several very strange state transistion when the cable is detached. This series fixes this with a simple trick. Patch three: as very first action when we destroy the network object, remove the device pointer. The service state machine will only select a network with a device pointer assigned. The first patch changes the __connman_service_lookup_from_network implemention. Instead using the ident to lookup the service we just maintain a network - service mapping. The second patch extents the is_ignored() helper function for the reconnect part of state machine so that services which do not have a proper network->device pointer will be ignored. I have sent this as RFC because I have tested this only lightly. Needs some more testing. Test reports are highly appricated (with logs :)) cheers, daniel Daniel Wagner (3): service: Use hash table for lookup_from_network service: Ignore network withouth device when reconnecting network: Remove device pointer in network_remove() src/network.c | 1 + src/service.c | 47 ++++++++++++++++------------------------------- 2 files changed, 17 insertions(+), 31 deletions(-) -- 1.7.10.rc3.1.gb3065 _______________________________________________ connman mailing list [email protected] http://lists.connman.net/listinfo/connman
