POST result depends on debug level

Dear all,

I make POST requests to a HTTPS server with W5500 and STM32F405. I have done the developement in 2021.July. with “#define DEBUG_LEVEL 5”
It has worked fine, but now I have just reduced the debugg level to 1 and to 2, and it failes.

For example this is the log when it stoppes, and after about 2 minutes continues with failing. in log level 1:

    [ Ciphersuite is TLS-RSA-WITH-AES-128-GCM-SHA256 ]
Successfully finished TSL connection with the server!
Start sending data to the server
written byte number: 2063 bytes
//here is the 2 minutes long waiting.........................
mbedtls_ssl_fetch_input() returned -7 (-0x0007)

mbedtls_ssl_read_record_layer() returned -7 (-0x0007)

mbedtls_ssl_read_record() returned -7 (-0x0007)

0. Received bytes number : -7
receive TLS error
Failed to send data to the server
SSL close error = -7
Unable to close the conenction

Maybe I can see some connections between the size of the request I want to send, and the succeeding.
Is there any possibility of the bug is based in any timing?
For example the sending of the log message of DEBUG_LEVEL 5 takes more time and this factor modifies something?

I have configured SSL in this way: (some key lines:)
#define MBEDTLS_SHA256_C

Do you have any suggessions?
I can attach the log of the failings on level 1, level 2 and the successful posts log on level 5 if it would help.

It works in level 5, but I would be happy if this bug would be solved.

Thank you so much,