Open x4t-de opened 3 years ago
Sorry I don't know why the code snippet gets destroyed like that. I also attached the ZIP with the Python file.
I can't reproduce this. I tried for about an hour with different values RunThreadTestWithRestarts(20,1,1) or (20,20,2), (200,1,1), a and b. On a wipy and on a fipy.
Can you reproduce the reboot with just this script or does the reproduction require your confidential code? How quickly can you reproduce this?
Please include the following information when submitting a bug report:
The Pycom board you are using (e.g. WiPy 2.0, LoPy).
WiPy 3 as W01
The firmware version you are using. You can get it by executing the following Python code at the REPL: (sysname='WiPy', nodename='WiPy', release='1.20.2.r4', version='v1.20.1.r2-362-gffb0e1cf-dirty on 2021-01-12', machine='WiPy with ESP32')
Exact steps to cause this issue
see attached code. Use default settings for TEST_THREADFUNCTION and TEST_GCCOLLECT, and call RunThreadTestWithRestarts(20,1,1). After printing out "thread X will terminate" WiPy will freeze, and then reboot after a few seconds. This can also be achieved, but not as often, if TEST_THREADFUNCTION == "a" and TEST_GCCOLLECT == False. If TEST_GCCOLLECT == True, probability for reboot increases.
There is some other (unfortunately confidential) code running in threads on the WiPy, next to this test. threadTest1.zip
`import _thread import time
import random
import uos import gc
configTest = {}
def BuildConfig(Config): items = [[0,10],[1,20],[2,5]] layers = len(items) for i in range (0,layers): layerName = "layer{}".format(i) Config[layerName] = {} for j in range(0,items[i][1]): itemName = "item{}ofLayer{}".format(j,i)
Config[layerName][itemName] = random.randrange(100)
def ChangeConfig(Config): for key in Config: if key != "changeIterations": for item in Config[key]:
Config[key][item] = random.randrange(100)
variable0 = 0 variable1 = 0 variable2 = 0 variable3 = 0 variable4 = 0 variable5 = 0 variable6 = 0 variable7 = 0 variable8 = 0 variable9 = 0
TEST_THREADFUNCTION = "b" TEST_GCCOLLECT = False
lock = _thread.allocate_lock()
threadList = []
def ThreadFunction(Config, LifeTime, Id): global variable0 global variable1 global variable2 global variable3 global variable4 global variable5 global variable6 global variable7 global variable8 global variable9
def ThreadFunctionB(Config, LifeTime, Id): global variable0 global variable1 global variable2 global variable3 global variable4 global variable5 global variable6 global variable7 global variable8 global variable9
def ThreadCreator(NumberOfThreads, ThreadLifeTime, PrintMemFree = True): global configTest global threadList
def RunThreadTest(NumberOfThreads, ThreadLifeTime, PrintMemFree = True): BuildConfig(configTest)
def RunThreadTestWithRestarts(NumberOfRestarts, NumberOfThreads, ThreadLifeTime, PrintMemFree = True): BuildConfig(configTest) print("test config before thread start") print(configTest)
`
Thank you!