Thanks to visit codestin.com
Credit goes to github.com

Skip to content

_thread module freezing whole device (RPI_PICO_W) #12980

Closed
@innatecuriosity

Description

@innatecuriosity

Summary

When using firmware built from the master branch calling _thread.start_new_thread freezes the whole machine. v1.22.0-preview and earlier works as expected.

Using Raspberry Pi Pico W.

I went back to find the commit where it breaks, and i found the breaking point: bcbdee2

Scenario

Im using a Raspberry Pi Pico W with firmware built from the repository (make etc.) In my application, right at the start of boot.py I started a process on the second thread that constantly measured the orientation, then continued as normal, but yesterday the whole program started freezing.

After some testing I found out that calling _thread.start_new_thread(test_function, ()) freezes the machine, it cannot be stopped with ctrl-c or any other method.

I tested with this file, then importing and running test()

import _thread

def test1():
    for i in  range(4):
        print(f"test1-{i}")

def test2():
    for i in  range(4):
        print(f"test2-{i}")

def test():
    print("Main thread:")
    test1()

    print("In second thread:")
    _thread.start_new_thread(test2, ())
    print("Main thread again:")
    test1()

With 2d363a2 and earlier I get the expected:

Main thread:
test1-0
test1-1
test1-2
test1-3
In second thread:
Main thread again:
test2-0
test1-0
test2-1
test1-1
test2-2
test1-2
test2-3
test1-3

But after bcbdee2 I get:
image
image

then freezes completely. Power cycling does make the device responsive again.

Sorry about the format, first time creating an issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions