Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Code run _thread.start_new_thread, that includes AWS MQTT causes guru meditation

    Scheduled Pinned Locked Moved Issues & Bugs
    threadmqttaws
    2 Posts 2 Posters 764 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T Offline
      timh
      last edited by

      Hi

      I have FiPy/GPY running with LTE-CAT-M1 or Wifi connections for a while.

      I wanted to look at including pybytes.

      However I find that if I run my code inside a new thread. _thread.start_new_thread
      LTE and WLAN can be setup in this thread, however as soon as I try to create an MQTT connection using the underlying AWS library I get a guru meditation error.

      Connected <WLAN>
      WDT enabled
      Connecting to mqtt
      Guru Meditation Error: Core  0 panic'ed (LoadProhibited)
      . Exception was unhandled.
      Register dump:
      PC      : 0x4008aa9d  PS      : 0x00060033  A0      : 0x4008c117  A1      : 0x3ffd54f0
      A2      : 0x3ffc513c  A3      : 0x00050023  A4      : 0x3ffc4fb4  A5      : 0x00000000
      A6      : 0x00000000  A7      : 0x00000000  A8      : 0x00000002  A9      : 0x3ffc4fac
      A10     : 0x00000000  A11     : 0x00000001  A12     : 0x3ffb7cdc  A13     : 0x00000000
      A14     : 0x00000005  A15     : 0x7fffffff  SAR     : 0x0000001f  EXCCAUSE: 0x0000001c
      EXCVADDR: 0x0000000c  LBEG    : 0x400e67e4  LEND    : 0x400e6820  LCOUNT  : 0x00000000
      
      Backtrace: 0x4008aa9d:0x3ffd54f0 0x4008c114:0x3ffd5520 0x4008c0ca:0x3ffc5ca0
      

      The AWS mqtt library creates it's own threads to handle connection and inbound messages.

      Not sure if this is a restriction of the platform or my approach.

      Thanks

      Tim

      1 Reply Last reply Reply Quote 0
      • J Offline
        james
        last edited by james

        I have the same problem using this library or simple mqtt in another thread with version (1.18/1.19 Pybytes)

        rst:0x7 (TG0WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
        configsip: 0, SPIWP:0xee
        clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
        mode:DIO, clock div:1
        load:0x3fff8028,len:8
        load:0x3fff8030,len:1984
        load:0x4009fa00,len:0
        load:0x4009fa00,len:19112
        entry 0x400a05e4
        Initializing filesystem as FatFS!
        Guru Meditation Error: Core  0 panic'ed (Cache disabled but cached memory region accessed)
        Core 0 register dump:
        PC      : 0x401f27e8  PS      : 0x00060c34  A0      : 0x8005582c  A1      : 0x3ffc0970
        A2      : 0x00000000  A3      : 0x00000001  A4      : 0x800995d1  A5      : 0x3ffea5f0
        A6      : 0x0000b030  A7      : 0x3ffea6a4  A8      : 0x8008cc86  A9      : 0x01000000
        A10     : 0x07040000  A11     : 0x00000000  A12     : 0x00000013  A13     : 0x00000000
        A14     : 0x3ffae270  A15     : 0x00000000  SAR     : 0x0000000e  EXCCAUSE: 0x00000007
        EXCVADDR: 0x00000000  LBEG    : 0x40099276  LEND    : 0x40099285  LCOUNT  : 0x00000000
        Core 0 was running in ISR context:
        EPC1    : 0x40092e5f  EPC2    : 0x00000000  EPC3    : 0x00000000  EPC4    : 0x401f27e8
        

        with the old version (1.17.3.b1 or 1.18.0) the error was different but there was.

        Connecting to MQTT broker....
        1
        2
        3
        4
        ***ERROR*** A stack overflow in task MPThread has been detected.
        abort() was called at PC 0x4008e66c on core 1
        

        the mqtt library is:
        https://github.com/yutter/micropython-mqtt

        Furthermore
        after updating to the 1.18.0 or 1.19.4.b4 to try to understand if the problem related to the threads and mqtt had been solved I had another problem, I can not load some files ...
        example of what happens that did not happen before; I added the size of the files in which I have problems

        Reading file status
        Failed to read project status, uploading all files
        Creating dir lib
        Creating dir www
        Creating dir www/bootstrap
        Creating dir www/bootstrap/css
        Creating dir www/bootstrap/fonts
        Creating dir www/bootstrap/js
        Creating dir www/js
        [1/18] Writing file SI7006A20.py
        [2/18] Writing file boot.py
        [3/18] Writing file hal.py
        [4/18] Writing file lib/mqttserver.pub.pem
        [5/18] Writing file main.py
        [6/18] Writing file mqtt.py
        [7/18] Writing file umqtt.py
        [8/18] Writing file www/bootstrap/css/bootstrap.min.css  "filesize (121.3kb)"
        Failed to write file, trying again...
        Failed to write file, trying again...
        Filecheck failed
        [9/18] Writing file www/bootstrap/js/bootstrap.min.js "filesize (36.9kb)"
        Failed to write file, trying again...
        [10/18] Writing file www/index.html
        [11/18] Writing file www/js/angular.min.js "filesize (99.0kb)"
        Failed to write file, trying again...
        Failed to write file, trying again...
        Filecheck failed
        [12/18] Writing file www/js/app.js
        [13/18] Writing file www/js/jquery-1.11.1.js "filesize (282.8kb)"
        Failed to write file, trying again...
        Failed to write file, trying again...
        Filecheck failed
        [14/18] Writing file xApp.py
        Failed to write file, trying again...
        [15/18] Writing file xConfigureFile.py
        [16/18] Writing file xHTTPConfigure.py
        [17/18] Writing file xWebServer.py
        [18/18] Writing file xWebSocket.py
        

        why?

        waiting for a quick reply
        best regards

        Giacomo

        1 Reply Last reply Reply Quote 0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • 1 / 1
        • First post
          Last post

        Pycom on Twitter

        Pycom