cfangmeier / tuijam

A fancy TUI client for Google Play Music
MIT License
129 stars 9 forks source link

Tuijam crashes with address boundary error #38

Open emdash-ie opened 5 years ago

emdash-ie commented 5 years ago

I’ve installed tuijam on a raspberry pi, and I’m getting an error when I run it. The error seems to come from urwid somehow, but tuijam first fails to restore the queue and recently played, and I’m not sure why that is.

starting up.
logging in.
<string>:2: GmusicapiWarning: login is deprecated and may break unexpectedly; prefer Mobileclient.oauth_login
enabling external control.
restoring queue
failed to restore queue. :(
restoring history
failed to restore recently played. :(
/home/pi/.local/lib/python3.7/site-packages/urwid/main_loop.py:910: Warning: g_unix_signal_source_new: assertion 'signum == SIGHUP || signum == SIGINT || signum == SIGTERM || signum == SIGUSR1 || signum == SIGUSR2' failed
  source = self.GLib.unix_signal_add(self.GLib.PRIORITY_DEFAULT, signum, final_handler, signum)
/home/pi/.local/lib/python3.7/site-packages/urwid/main_loop.py:910: Warning: g_source_set_callback: assertion 'source != NULL' failed
  source = self.GLib.unix_signal_add(self.GLib.PRIORITY_DEFAULT, signum, final_handler, signum)
fish: “tuijam” terminated by signal SIGSEGV (Address boundary error)
cfangmeier commented 5 years ago

Hi @undergroundquizscene. Can you supply the log file from when the app fails to load properly? It should be

$HOME/.config/tuijam/log.txt

Also, it may be helpful to know a bit more about your system. What OS/Distro are you running and what terminal application?

emdash-ie commented 5 years ago

Sorry, I should have provided more info – I wasn’t sure what would be helpful.

The OS is Raspbian 9 (stretch). The shell is fish, but I’m connecting over ssh from a macbook (using Terminal).

The log file is below. Am I missing some dependencies?

WARNING:googleapiclient.discovery_cache:file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth
Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/googleapiclient/discovery_cache/__init__.py", line 36, in autodetect
    from google.appengine.api import memcache
ModuleNotFoundError: No module named 'google.appengine'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/googleapiclient/discovery_cache/file_cache.py", line 33, in <module>
    from oauth2client.contrib.locked_file import LockedFile
ModuleNotFoundError: No module named 'oauth2client.contrib.locked_file'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/googleapiclient/discovery_cache/file_cache.py", line 37, in <module>
    from oauth2client.locked_file import LockedFile
ModuleNotFoundError: No module named 'oauth2client.locked_file'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/googleapiclient/discovery_cache/__init__.py", line 41, in autodetect
    from . import file_cache
  File "/home/pi/.local/lib/python3.7/site-packages/googleapiclient/discovery_cache/file_cache.py", line 41, in <module>
    'file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth')
ImportError: file_cache is unavailable when using oauth2client >= 4.0.0 or google-auth
ERROR:root:[Errno 2] No such file or directory: '/home/pi/.config/tuijam/queue.json'
Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/tuijam/app.py", line 613, in restore_queue
    with open(QUEUE_FILE, "r") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/pi/.config/tuijam/queue.json'
ERROR:root:[Errno 2] No such file or directory: '/home/pi/.config/tuijam/hist.json'
Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/tuijam/app.py", line 627, in restore_history
    with open(HISTORY_FILE, "r") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/pi/.config/tuijam/hist.json'
cfangmeier commented 5 years ago

I don't see anything in the logs that indicates a missing dependency. The "failed to load queue/history" is expected since, presumably, you haven't been able to run the app to ever create the queue/history files. Also, the business with the ModuleNotFoundError in the googleapiclient is normal.

The warnings about the signal assertions failing is worrying, but I'm not certain how to address it. I wonder if Linux on the Raspberry PI somehow has different interrupts?

Could you try running it in either bash or zsh? Maybe fish is doing something a little wonky that urwid doesn't like.

Could you also try running some of the urwid examples to see if urwid itself is the issue or possibly the way I'm using it.

emdash-ie commented 5 years ago

Sorry for the delay getting back to you. Running under bash produces what seems to be the same error:

starting up.
logging in.
<string>:2: GmusicapiWarning: login is deprecated and may break unexpectedly; prefer Mobileclient.oauth_login
enabling external control.
restoring queue
failed to restore queue. :(
restoring history
failed to restore recently played. :(
/home/pi/.local/lib/python3.7/site-packages/urwid/main_loop.py:910: Warning: g_unix_signal_source_new: assertion 'signum == SIGHUP || signum == SIGINT || signum == SIGTERM || signum == SIGUSR1 || signum == SIGUSR2' failed
  source = self.GLib.unix_signal_add(self.GLib.PRIORITY_DEFAULT, signum, final_handler, signum)
/home/pi/.local/lib/python3.7/site-packages/urwid/main_loop.py:910: Warning: g_source_set_callback: assertion 'source != NULL' failed
  source = self.GLib.unix_signal_add(self.GLib.PRIORITY_DEFAULT, signum, final_handler, signum)
Segmentation fault

I tried about 10 of the urwid examples and they mostly worked correctly. In the palette_test.py example, selecting 24-bit colour crashed the program with a KeyError, but I don’t think that’s related.

cfangmeier commented 5 years ago

Hi @undergroundquizscene . I'll see if I can get my hands on a raspberry pi to see if I can reproduce this error, but in the meantime, you could try to disable the SIGINT interrupt handling here:

https://github.com/cfangmeier/tuijam/blob/master/tuijam/app.py#L684

You won't be able to exit tuijam (cleanly) with Ctrl-C, but it may fix your problem.

emdash-ie commented 5 years ago

No rush, thanks for looking in to it.

I tried disabling the interrupt handling as you suggested, and as far as I can see I'm getting the same error, unfortunately.