MicroWebSrv2 icon indicating copy to clipboard operation
MicroWebSrv2 copied to clipboard

XAsyncTCPServerException: OnClientAccepted event: timeoutSec is incorrect to set timeout expire

Open meghadeep-com opened this issue 4 years ago • 2 comments

There's a weird issue with timeoutSec that's happening on every new connection.

This is my code:

from MicroWebSrv2 import *
mws2 = MicroWebSrv2()
mws2.StartManaged(parllProcCount=1, procStackSize=4)

@WebRoute(GET, '/data-test')
def dataSend(microWebSrv2, request):
	request.Response.ReturnOk(None)

@WebRoute(GET, '/data')
def dataSend(microWebSrv2, request):
	request.Response.ReturnOk(ujson.dumps(payload_maker()))
	#request.Response.ReturnOkJSON(payload_maker())

This is the error I am getting: image

meghadeep-com avatar Sep 20 '21 00:09 meghadeep-com

I tried this dirty thing:

def _setExpireTimeout(self, timeoutSec) :
    try :
        if timeoutSec and timeoutSec > 0 :
            self._expireTimeSec = perf_counter() + timeoutSec
    except :
        self._expireTimeSec = perf_counter() + 3
        # raise XAsyncSocketException('"timeoutSec" is incorrect to set expire timeout.')

But it raises yet another image

This happens any time I try to send a GET request to one of the routes. I have changed the regex routing rule already to accommodate for ESP32.

meghadeep-com avatar Sep 20 '21 14:09 meghadeep-com

save problem here on esp32 board,

>>> mws2.StartManaged(procStackSize=4*1024)
MWS2-INFO> Server listening on 0.0.0.0:80.
MWS2-INFO> Starts the managed pool to wait for I/O events.
>>> Unhandled exception in thread started by 
Traceback (most recent call last):
  File "MicroWebSrv2/libs/XAsyncSockets.py", line 131, in _processWaitEvents
  File "MicroWebSrv2/libs/XAsyncSockets.py", line 425, in OnReadyForReading
XAsyncTCPServerException: Error when handling the "OnClientAccepted" event : "timeoutSec" is incorrect to set expire timeout.

xlla avatar Nov 22 '21 17:11 xlla