ESP8266: one AsyncServer calling another?

Again PlatformIO Community seems to be my last resort, as the guys over at Github seem to be occupied elsewhere :wink:

I got a couple of ESP8285-driven smart sockets here, on which I have deployed my own firmware. I am developing on PlatformIO with the Arduino core.

I am using the Fauxmo lib that emulates a Philips Hue V1 bridge, my very own eModbus lib and currently am trying to add a Telnet log server, since the sockets do not provide any Serial at all.

All three components (Fauxmo, eModbus and Telnet log) are using an ESPAsyncTCP AsyncServer internally.

While everything is running smoothly while the three components are held separate, I am getting constant reboots as soon as I am trying to call Telnet Server output functions while in an eModbus AsyncServer callback (onData() mostly).

Since there is no Serial, I can not see what might be put out when the reboot is happening. Unfortunately I do not even have a spare GPIO I could use to debug. I am suspecting some kind of WDT reset, but that is pure intuition. I threw in some yield(); at spots I thought could take more time than the WDT would bear, but to no avail.

I tried to find any references in the Net to two AsyncServers misbehaving, but was not successful yet. So it looks like I am at a dead end currently.

Do you have some hints or suggestions what to try?

In case someone will trip over this: I now know what was happening.

  • the external request to the Modbus AsyncTCP triggered the onData callback of that server
  • now running in the LWIP thread, the callback called another function in the system domain.
  • this function again called the Telnet AsyncTCP server to send data to connected clients
  • a client was not able to take the complete data, so the Telnet send function called yield() to give it more time
  • since we were running in LWIP already, that tried to yield to itself and would have waited forever, if not the WDT had struck

The workaround is to shove the Telnet data to an intermediate buffer and have it sent later in the onPoll() and onAck() callbacks.