On Apr 9, 2011, at 1:02 PM, Grant Erickson wrote:
> FWIW and FYI, I am currently debugging an issue in which connman gets into an 
> inconsistent state with respect to technologies and devices. When there are 
> local connectivity problems, my application--for good or bad--periodically 
> attempts to bring down and back up the network interface by executing the 
> following connman .Manager methods:
> 
> ...
> 
> However, at times this results in a state in which the device and interface 
> are DOWN yet connman believes the technology to be active and enabled:
> 
> ...
> 
> While I haven't yet caught why connman gets into this state, with the 
> debugger, I can make a single variable change in which connman gets its state 
> normalized again, the device and interface come up and all is good again:
> 
> ...
> 
> Interactive debugging aside, the only other way to get out of this state is 
> to restart the system or connman, in particular.
> 
> From what I can see of the overall function trace flow for 
> net.connman.Manager.{Disable,Enable}Technology, writing "Powered=<state>" 
> early in the method handling could lead to a state in which the persistent 
> and internal states disagree:
> 
> ...

For those following this thread, I've distilled this down to a script that can 
reproduce this in about five minutes or so:

    #!/bin/sh

    log_info() {
        local stamp=`date "+%FT%T"`
        echo "${stamp}: $*"
        echo "${stamp}: `hostname`: $*" 2>&1 | nc -w 5 ubuntu.local 6845
    }

    enable_technology() {
        dbus-send --system --dest=net.connman --print-reply /
net.connman.Manager.EnableTechnology string:"wifi"
    }

    disable_technology() {
        dbus-send --system --dest=net.connman --print-reply /
net.connman.Manager.DisableTechnology string:"wifi"
    }

    check_profile() {
        grep -r '^Powered=' /var/lib/connman/
    }

    while [ 1 ]; do
        log_info "Enabling Wi-Fi."
        enable_technology
        check_profile
        sleep 5

        log_info "Starting ping test."
        ping ubuntu.local -c 10
        log_info "Ping test exited with status $?."

        log_info "Disabling Wi-Fi."
        disable_technology
        check_profile
        sleep 15
    done

Running this script, the failure seems to always be preceded by a timeout that 
follows the disable request:

    ...
    --- ubuntu.local ping statistics ---
    10 packets transmitted, 10 packets received, 0% packet loss
    round-trip min/avg/max = 105.133/163.327/215.850 ms
    Ping test exited with status 0.
    Disabling Wi-Fi.
    Error net.connman.Error.OperationTimeout: Operation timeout
    /var/lib/connman/default.profile:Powered=false
    Enabling Wi-Fi.
    nc: timed out
    Error net.connman.Error.AlreadyEnabled: Already enabled
    /var/lib/connman/default.profile:Powered=false
    Starting ping test.
    ...

    ...
    --- ubuntu.local ping statistics ---
    10 packets transmitted, 10 packets received, 0% packet loss
    round-trip min/avg/max = 31.555/118.661/307.220 ms
    Ping test exited with status 0.
    Disabling Wi-Fi.
    Error net.connman.Error.OperationTimeout: Operation timeout
    /var/lib/connman/default.profile:Powered=false
    Enabling Wi-Fi.
    nc: timed out
    Error net.connman.Error.AlreadyEnabled: Already enabled
    /var/lib/connman/default.profile:Powered=false
    Starting ping test.
    nc: timed out
    ADDRCONF(NETDEV_UP): wlan0: link is not ready
    ping: bad address 'ubuntu.local'
    Ping test exited with status 1.
    nc: timed out
    Disabling Wi-Fi.
    nc: timed out
    Error net.connman.Error.Failed: No such device
    /var/lib/connman/default.profile:Powered=false
    Enabling Wi-Fi.
    nc: timed out
    Error net.connman.Error.AlreadyEnabled: Already enabled
    ...

Regards,

Grant

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to