Execution Interrupted during event processing.

Posted on
  • Hi,

    I've got some code that is both hosting a webserver and polling sensors for data.

    The sensor polling uses timeouts to provide a wait time for the sensor to respond, and the webserver uses the standard pageRequest function to parse the request and serve information back to the client. html, js and css files are held in storage and are read out in chunks on request.

    I'm assuming its something to do with timers, and the storage module as I can disable the polling and it works fine.

    this was all working fine in version 2.8, but I tried version 2.10 yesterday and now if try and load the page served by the module whilst running the polling loop I get the error 'Execution Interrupted during event processing.' I get this lots of times.

    Any thoughts on what might have changed between v2.8 and v2.10 that might cause this and how one might resolve the issue.

    Thanks,

    Rob Smart

  • You might be able to solve this easily enough by setting a flag for when you are doing HTTP access and on the timer side. What seems to happen is that during a page request a timer is called and then you get this error.

    What I found solved it was if you set a flag like:

    function pageRequest(res, req) {
        servingPage=true;
    
        // all your code
    
        servingPage=false;
    
    }
    

    and then after in your setInterval function

    setInterval(function() {
        if (servingPage) return;
    
        // your code here
    
    },milliseconds)
    

    Then this generally resolves the problem.

    For some reason the timers for Espruino in the ESP32 port are very fussy and what I've learned is refactoring your code to use as few as possible really makes your app run more smoothly.

    G

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Execution Interrupted during event processing.

Posted by Avatar for Ruprect99 @Ruprect99

Actions