Error Message: Assertion failed: _readers == 0

What might that be:

++ MbedOS Error Info ++                                                                                                                                                      
Error Status: 0x80FF0144 Code: 324 Module: 255                                                                                                                               
Error Message: Assertion failed: _readers == 0                                                                                                                               
Location: 0x8011055                                                                                                                                                          
File: ./mbed-os/features/netsocket/TCPSocket.cpp+209                                                                                                                         
Error Value: 0x0                                                                                                                                                             
Current Thread: main Id: 0x20005A50 Entry: 0x8012253 StackSize: 0x1000 StackMem: 0x200085E8 SP: 0x200093C0                                                                   
For more i                                                                                                                                                                   
nfo, visit: https://mbed.com/s/error?error=0x80FF0144&tgt=NUCLEO_F767ZI                                                                                                      
-- MbedOS Error Info --                                                                                                                                                      
= System will be rebooted due to a fatal error =                                                                                                                             
= Reboot count(=1) reached maximum, system will halt after rebooting                              

Happend after a while running an mqtt client.

Thanks

I had connection management (reconnecting) and sending of messages in different threads.

Maybe that’s not threadsafe?

1 Like

Hi Florian,

looking at the file/line number where the assert failed, I find this comment:

// If this assert is hit then there are two threads
// performing a recv at the same time which is undefined
// behavior
    MBED_ASSERT(_readers == 0);
    _readers++;

So that would be a good place to start.

Regards
Anna

I know this topic is old (11 month) and I’m Late to the party…

But had to come and share some info on this. It is highly possible this is the cause of the problem as Scheintod described. Just tried similar situation using MQTT on a K64F. I tried to run same instance of MQTT client in two different threads. Got the same error message:

++ MbedOS Fault Handler ++

FaultType: HardFault

Context:
R   0: 1FFF45F8
R   1: 7FFFFFFE
R   2: 7FFFFFFF
R   3: FFFFFFF7
R   4: 00000000
R   5: 7FFFFFFE
R   6: 1FFF45F8
R   7: 1FFF45F8
R   8: 1FFF0633
R   9: 20004880
R  10: 00000012
R  11: 1FFF0632
R  12: 00000000
SP   : 20004830
LR   : 0001C475
PC   : 0001C882
xPSR : 81000000
PSP  : 20004810
MSP  : 2002FFD0
CPUID: 410FC241
HFSR : 40000000
MMFSR: 00000000
BFSR : 00000082
UFSR : 00000000
DFSR : 00000000
AFSR : 00000000
BFAR : FFFFFFF7
Mode : Thread
Priv : Privileged
Stack: PSP

-- MbedOS Fault Handler --



++ MbedOS Error Info ++
Error Status: 0x80FF013D Code: 317 Module: 255
Error Message: Fault exception
Location: 0x1C882
Error Value: 0x1FFF0400
Current Thread: application_unnamed_thread Id: 0x1FFF4770 Entry: 0x13BF1 StackSize: 0x1000 StackMem: 0x20                      003908 SP: 0x20004830
For more info, visit: https://mbed.com/s/error?error=0x80FF013D&tgt=K64F
-- MbedOS Error Info --

= System will be rebooted due to a fatal error =
= Reboot count(=5) reached maximum, system will halt after rebooting

So in case anyone else has this issue, this might be the source of the problem.

How that I’m thinking about it, could it be that Mbed-os doesn’t like to see a declared TCPsocket to be used at the same time in different Threads?