Skip to content

osSemaphoreAcquire hangs in LWIP with cellular #4739

Closed
@amq

Description

@amq

Description


Bug

Toolchain:
Tested with GCC_ARM

Toolchain version:
6-2017-q1-update

mbed-cli version:
1.1.1

mbed-os sha:
8828635

Similar behavior also observed with c9e63f1

Expected behavior
Can connect to the internet.

Actual behavior
The initial connection hangs with the following trace:

ossemaphoreacquire hang3

By pausing I get into the Default_Handler with this trace:

ossemaphoreacquire hang2

Relevant code:

lwip_stack.c

    if (!netif_is_link_up(&lwip_netif)) {
        if (sys_arch_sem_wait(&lwip_netif_linked, 15000) == SYS_ARCH_TIMEOUT) {
            if (ppp) {
                ppp_lwip_disconnect();
            }
            return NSAPI_ERROR_NO_CONNECTION;
        }
    }

lwip_sys_arch.c

u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout) {
    u32_t start = us_ticker_read();
    
    if (osSemaphoreAcquire(sem->id, (timeout != 0)?(timeout):(osWaitForever)) != osOK)
        return SYS_ARCH_TIMEOUT;
    
    return (us_ticker_read() - start) / 1000;
}

osSemaphoreAcquire is also called before that, and consistently works:

sys_arch_sem_wait(&lwip_tcpip_inited, 0)

This is the call that fails:

sys_arch_sem_wait(&lwip_netif_linked, 15000)

Sometimes I can get past it by stopping with a breakpoint and continuing manually.

I could always successfully connect using 5.4.3 and 5.4.6 with a manually applied #4119 pretty much at all stages of its development.

I'm using the configuration from https://github.com/ARMmbed/mbed-os-example-cellular

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions