MbedTLS mutual authentication failed if adding a task

Hi
I’m suffering a weird problem:
I’d connected my board to my own Mosquitto broker over MBedTLS 2-way authentication, and pub/sub works.
After adding a FreeRTOS timer to send keepAlive messages to broker by timer’s callback, I found my mutual auth failed. But 1-way auth still works.
I removed that software timer, the 2-way auth works again.
I then try to add an empty user task, the 2-way auth can’t work again. Even it is only priority 0.
Did anyone ever meet this similar problem?
What could cause this?
The memory seems sufficient for malloc
The board is based on STM32F2, and my project is created by CubeMX STM32F2 v1.9.0
Its FreeRTOS: V10.0.1
mbed TLS 2.14.1

Hmm, really it is going to be very difficult to say with so little insight into the code.
Which TCP stack are you using?
Why is the authentication failing (what is the cause of the failure)?
Is the task performing the calculation timing out because its being starved of higher priority timers or tasks are consuming too much CPU time?
Have you followed all the items here: https://www.freertos.org/FAQHelp.html regarding ensuring configASSERT() is defined, stack overflow detection is on, etc.

Hi All,
I found the problem and resolved.
The root cause is still the insufficient memory.
The memory size to create a new thread is just making the 2-way auth connection can’t get sufficient memory.
But MbedTLS debug log didn’t express any malloc failed :frowning:
After releasing more memory from others, it can work fine now