diff --git a/internal_filesystem/lib/mpos/apps.py b/internal_filesystem/lib/mpos/apps.py index d5ba10d4..7dc38441 100644 --- a/internal_filesystem/lib/mpos/apps.py +++ b/internal_filesystem/lib/mpos/apps.py @@ -76,13 +76,9 @@ def execute_script_new_thread(scriptname, is_file, is_launcher, is_graphical): print("Starting camera with extra stack size!") stack=32*1024 else: - print("\n\n\nWHAAAAAAAAAAAAAAAAAA\n\n\n") - #stack=16*1024 # somehow, on desktop, this causes a segfault... but the code isn't executed even!!! - # [DEBUG 471155623] Connecting to wss://relay.damus.io - # [DEBUG 471155623] Using SSL with no certificate verification - stack=32*1024 + stack=16*1024 _thread.stack_size(stack) - print(f"app.py set stack size to {stack}") + print(f"app.py set stack size for script to {stack}") _thread.start_new_thread(execute_script, (scriptname, is_file, is_launcher, is_graphical)) except Exception as e: print("main.py: execute_script_new_thread(): error starting new thread thread: ", e) diff --git a/internal_filesystem/lib/websocket_nostr_receive.py b/internal_filesystem/lib/websocket_nostr_receive.py index f2ac0c27..1cd9326d 100644 --- a/internal_filesystem/lib/websocket_nostr_receive.py +++ b/internal_filesystem/lib/websocket_nostr_receive.py @@ -43,7 +43,8 @@ def printevents(): time.sleep(3) #relay_manager.add_relay("wss://nostr-pub.wellorder.net") print("relaymanager adding") - relay_manager.add_relay("wss://relay.damus.io") + #relay_manager.add_relay("wss://relay.damus.io") + relay_manager.add_relay("wss://relay.primal.net") time.sleep(3) print("relaymanager subscribing") relay_manager.add_subscription(subscription_id, filters) @@ -82,9 +83,10 @@ def printevents(): # 24KB is fine # somehow, if I run this in a thread, I get: can't create thread" at File "/lib/nostr/relay_manager.py", line 48, in open_connections # tried stack sizes from 18KB up to 32KB -#_thread.stack_size(16*1024) -#_thread.start_new_thread(printevents, ()) -printevents() +# on unix/desktop, 24KB crashes, 26KB is fine +_thread.stack_size(26*1024) +_thread.start_new_thread(printevents, ()) +#printevents() #import gc diff --git a/internal_filesystem/main.py b/internal_filesystem/main.py index a27aa0da..54878e8b 100644 --- a/internal_filesystem/main.py +++ b/internal_filesystem/main.py @@ -15,17 +15,18 @@ except Exception as e: from mpos import apps apps.execute_script("builtin/system/button.py", True, False, False) # Install button handler through IRQ +def dummy(): + pass + import sys if sys.platform == "esp32": apps.auto_connect() else: - pass - #import _thread - #import time + # On unix/desktop, at least 24KB of stack size is needed in the REPL to make nostr work there + import _thread + _thread.stack_size(24*1024) # on unix/desktop, at least 24KB is needed for doing nostr connections from the REPL + _thread.start_new_thread(dummy, ()) # not just setting the stack_size but actually starting a thread to apply this globally -#_thread.stack_size(32*1024) -#time.sleep(1) -apps.auto_connect() apps.restart_launcher() # If we got this far without crashing, then no need to rollback the update: