Mesh stack does not work correctly when using the scheduler

Mesh SDK 5.0, SoftDevice S140 v7.2.0, NRF52840, SEGGER
------------------------------------------------------------------------------------
Hi,
I'm using the mesh with the scheduler. The main loop looks like this:

for(;;){
    app_sched_execute();
    if (nrf_mesh_process()){
        sd_app_evt_wait();
    }
}

Also, following the recommendations, I added the following configuration:
#define APP_TIMER_ENABLED 1
#define APP_SCHEDULER_ENABLED 1
#define APP_TIMER_CONFIG_USE_SCHEDULER 1

I have a simple model that takes a message and responds with a status message. The problem is that status messages often don't reach the sender, causing the sender to retransmit, and the whole process slows down a lot. I have found that status messages reach the sender of the request just fine when there is any loop timer with a short timeout (allowing the main loop to wake up more often) or if sd_app_evt_wait() is not called at all. It looks like going to sleep is preventing the stack from working properly, maybe nrf is not waking up on some events, or going to sleep is preventing the status packet from being sent.
Let me know if you have any ideas, thanks!

Related