ESP32 + W5500 + MQTT instability

Does anyone have any experience running ESP32 with W5500 (ethernet) for long running TCP connection (MQTT is an example)?
I am interested if it is working stable or you are experiencing instability issues.

I’ve got a problem with stability of TCP/MQTT connection and I am trying to understand if this is my setup or something is broken in firmware (or hardware).


Please find detailed description of the issue below if you are interested:

While using ESP32 with W5500 (ethernet), PubSubClient gets disconnected from MQTT broker from time to time (time periods differs significantly - from few minutes to couple of hours).

Looks like PubSubClient is sending malformed TCP/MQTT packet which looks like Disconnect Req, but with very high Msg Len. It causes messages afterwards to be treated as continuation of this message. That includes Ping Request message. After “keep alive” timeout (in my case 15sec x2) PubSubClient decides to disconnect as it has not received Ping Response message.

I am using DOIT Esp32 DevKit v1 and some regular size W5500 module.

Wiring between ESP32 and W5500:
GPIO23 <–> MOSI
GPIO19 <–> MISO
GPIO18 <–> SCLK
GPIO5 <–> SCS
GPIO13 <–> RESET

Code I am using for MQTT testing:
https://github.com/maniekq/ESP32_W5500_MQTT

It doesn’t look like it is MQTT related as I was able to reproduce similar issue with simple long-running TCP connection.
Code here: https://github.com/maniekq/ESP32_W5500_TCP