Hey, I'm getting a stack overflow in LwIP after a while (generally after 10 - 30 minutes of handling ~100 byte messages that are sent to the device every two seconds). Trying to diagnose this, I turned on the system state checking, and get a system state violation (SV#10).
I had a look, and it turns out the problem is the call in sys_sem_signal_S(...) (in sys_arch.c), because the system doesn't go into a lock state unless LwIP's SYS_LIGHTWEIGHT_PROT option is switched on (setting that causes the sys_arch_protect() and sys_arch_unprotect() functions to get called).
And then, it seems like the stack overflow isn't happening. So should I just leave SYS_LIGHTWEIGHT_PROT on, or is there some disadvantage to doing that?
I have not tried yet changing the call from sys_sem_signal_S(...) to sys_sem_signal(...) in the socket code - but it would be good for that to be properly selected based on the configuration.
One other little thing - during debugging I upgraded from a 3.0 release to the latest 16.1 release and hit some errors - in os\hal\ports\STM32\LLD\SPIv1\spi_lld.c there are a bunch of calls to osalDgbAssert(...) that should be osalDbgAssert(...).
Thanks!
System state violation in LwIP sockets API
Moderator: RoccoMarco
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: System state violation in LwIP sockets API
Hi,
Please submit a patch regarding the lwIP issue, I will take care of the problem in SPIv1 before next release.
Giovanni
Please submit a patch regarding the lwIP issue, I will take care of the problem in SPIv1 before next release.
Giovanni
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: System state violation in LwIP sockets API
Hi,
Could you try this modified sockets.c? it should work in both modes now.
I think SYS_LIGHTWEIGHT_PROT should be fine anyway.
Giovanni
Could you try this modified sockets.c? it should work in both modes now.
I think SYS_LIGHTWEIGHT_PROT should be fine anyway.
Giovanni
Re: System state violation in LwIP sockets API
This patch is working well now.
I think I've resolved the stack overflow (which was in one of my threads) too, so all is well.
Thanks!
I think I've resolved the stack overflow (which was in one of my threads) too, so all is well.
Thanks!