Skip to content

Commit

Permalink
asyncio: sql_db: maybe fix "no current event loop in thread"
Browse files Browse the repository at this point in the history
see #5376
crash report for electrum 4.2.1:
```
Traceback (most recent call last):
  File "/home/user/wspace/electrum/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/Electrum/kivy/base.py", line 347, in mainloop
  File "/home/user/wspace/electrum/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/Electrum/kivy/base.py", line 391, in idle
  File "/home/user/wspace/electrum/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/Electrum/kivy/base.py", line 342, in dispatch_input
  File "/home/user/wspace/electrum/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/Electrum/kivy/base.py", line 308, in post_dispatch_input
  File "kivy/_event.pyx", line 724, in kivy._event.EventDispatcher.dispatch
  File "/home/user/wspace/electrum/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/Electrum/kivy/uix/behaviors/button.py", line 179, in on_touch_up
  File "kivy/_event.pyx", line 720, in kivy._event.EventDispatcher.dispatch
  File "kivy/_event.pyx", line 1263, in kivy._event.EventObservers.dispatch
  File "kivy/_event.pyx", line 1147, in kivy._event.EventObservers._dispatch
  File "/home/user/wspace/electrum/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/Electrum/kivy/lang/builder.py", line 57, in custom_callback
  File "<string>", line 39, in <module>
  File "/home/user/wspace/electrum/.buildozer/android/app/electrum/gui/kivy/uix/dialogs/settings.py", line 173, in cb
  File "kivy/properties.pyx", line 498, in kivy.properties.Property.__set__
  File "kivy/properties.pyx", line 545, in kivy.properties.Property.set
  File "kivy/properties.pyx", line 600, in kivy.properties.Property.dispatch
  File "kivy/_event.pyx", line 1263, in kivy._event.EventObservers.dispatch
  File "kivy/_event.pyx", line 1169, in kivy._event.EventObservers._dispatch
  File "/home/user/wspace/electrum/.buildozer/android/app/electrum/gui/kivy/main_window.py", line 206, in on_use_gossip
  File "/home/user/wspace/electrum/.buildozer/android/app/electrum/network.py", line 368, in start_gossip
  File "/home/user/wspace/electrum/.buildozer/android/app/electrum/channel_db.py", line 308, in __init__
  File "/home/user/wspace/electrum/.buildozer/android/app/electrum/sql_db.py", line 30, in __init__
  File "/home/user/wspace/electrum/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/python3/armeabi-v7a__ndk_target_21/python3/Lib/asyncio/locks.py", line 260, in __init__
  File "/home/user/wspace/electrum/.buildozer/android/platform/build-armeabi-v7a/build/other_builds/python3/armeabi-v7a__ndk_target_21/python3/Lib/asyncio/events.py", line 639, in get_event_loop
RuntimeError: There is no current event loop in thread 'GUI'.
```
  • Loading branch information
SomberNight committed Apr 26, 2022
1 parent f10752b commit 1dd6a20
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions electrum/sql_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class SqlDB(Logger):
def __init__(self, asyncio_loop: asyncio.BaseEventLoop, path, commit_interval=None):
Logger.__init__(self)
self.asyncio_loop = asyncio_loop
asyncio.set_event_loop(asyncio_loop)
self.stopping = False
self.stopped_event = asyncio.Event()
self.path = path
Expand Down

0 comments on commit 1dd6a20

Please sign in to comment.