Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New version to test - 1.0.7 #109

Closed
dodgyrabbit opened this issue Mar 30, 2021 · 15 comments
Closed

New version to test - 1.0.7 #109

dodgyrabbit opened this issue Mar 30, 2021 · 15 comments

Comments

@dodgyrabbit
Copy link
Collaborator

dodgyrabbit commented Mar 30, 2021

The currently released version is 1.0.2.

I've published a test version 1.0.7 on test.pypi.org for those of you interested to give it a run and provide provide feedback before it's published on the main repository.

The change log is here

How to upgrade

This assumes you have version 1.0.2 already working on your system. You can confirm your installed version with:

$ pip3 show streamdeck-ui
Name: streamdeck-ui
Version: 1.0.2

Uninstall your current version

$ pip3 uninstall streamdeck-ui 

You will need to explicitly install the following dependencies first:

$ pip3 install streamdeck==0.8.4 pynput==1.7.3 pyside2==5.15.2 python3-xlib==0.15 pillow==8.2.0

Next, install the latest version from the test.pypi.org server.

$ pip3 install -i https://test.pypi.org/simple/ streamdeck-ui==1.0.7

If all went well, you can confirm with:

$ pip3 show streamdeck-ui
Name: streamdeck-ui
Version: 1.0.7 🎉

Launch with

$ streamdeck

You can also confirm visually with these differences:
image

How to downgrade

$ pip3 uninstall streamdeck-ui

Install 1.0.2 from the main repository. It will automatically downgrade the dependencies for 1.0.2

$ pip3 install streamdeck-ui

USB interface

You probably don't need to do this, if it was working before.
For Debian/Ubuntu/Mint you need:

$ sudo apt install python3-pip libhidapi-libusb0

For Fedora you need:

$ sudo dnf install hidapi

If you are running into issues, please open a separate issue and provide as much detail as possible. Steps you took, output, your operating system version, streamdeck version, screenshots - whatever can help. Thanks!

@dodgyrabbit dodgyrabbit pinned this issue Mar 30, 2021
@dodgyrabbit dodgyrabbit changed the title New version to test - 1.0.3 New version to test - 1.0.4 Mar 31, 2021
@tylerjw
Copy link
Collaborator

tylerjw commented Mar 31, 2021

Tested 1.0.4 locally and these instructions work for me.

@delpes
Copy link

delpes commented Apr 2, 2021

The version works fine so far:

  • Previous Config (1.0.2) was loaded with no problems
  • Configured new Button (command, press keys) with Image and Image+Text

The 3 items in the changelog do work.

I found a minor issue - however this might be related to my setup (arch + bspwm) - perhabs i'm missing some icons:
There is no icon on the remove image button

streamdeck_ui_image_remove_icon_missing

During the upgrade to version 1.0.4 the command

pip3 install streamdeck==0.8.3 pynput==1.7.3 pyside2==5.15.2 python3-xlib==0.15 pillow==8.1.2

produced the following error at the end ( but completed successfully):

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
streamdeck-ui 1.0.2 requires pillow<7.0,>=6.1, but you have pillow 8.1.2 which is incompatible.
streamdeck-ui 1.0.2 requires streamdeck<0.7.0,>=0.6.3, but you have streamdeck 0.8.3 which is incompatible.
Successfully installed pillow-8.1.2 python3-xlib-0.15 streamdeck-0.8.3

The install command proceeded without an error

@tylerjw
Copy link
Collaborator

tylerjw commented Apr 2, 2021

The install command proceeded without an error

I had to do a pip3 uninstall streamdeck-ui to get around the error you saw.

@t3838d4
Copy link

t3838d4 commented Apr 2, 2021

1.0.4 install went as expected (with the same error as noted above) and at first everything seemed to work, but then
it started to crash a lot (in fact, so often, that it is not usable for me at all), mostly with buttons that switch to another streamdeck page but sometimes it could not start even a simple command like "gnome-calculator".

sometimes icon images could not be loaded (garbage was shown on buttons) and it crashed, sometimes pages that did not contain icons, only text, also crashed streamdeck ui.

it is very easy for me to reproduce these issues and can provide additional information if needed.

all these issues disappeared when downgraded back to 1.0.2 and came back when reupgraded to 1.0.4

i'm running Stream Deck XL (CL08K1A03082) on Fedora 33 (Gnome/Wayland)


Here are just a few examples is encountered:

corrupted size vs. prev_size
Aborted (core dumped)
Traceback (most recent call last):
  File "/usr/lib64/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.9/threading.py", line 892, in run
    self._target(*self._args, **self._kwargs)
  File "/home/*USER*/.local/lib/python3.9/site-packages/StreamDeck/Devices/StreamDeck.py", line 116, in _read
    self.key_callback(self, k, new)
  File "/home/*USER*/.local/lib/python3.9/site-packages/streamdeck_ui/api.py", line 94, in _key_change_callback
    set_page(deck_id, switch_page - 1)
  File "/home/*USER*/.local/lib/python3.9/site-packages/streamdeck_ui/api.py", line 322, in set_page
    _save_state()
  File "/home/*USER*/.local/lib/python3.9/site-packages/streamdeck_ui/api.py", line 98, in _save_state
    export_config(STATE_FILE)
  File "/home/*USER*/.local/lib/python3.9/site-packages/streamdeck_ui/api.py", line 143, in export_config
    os.replace(output_file + ".tmp", output_file)
FileNotFoundError: [Errno 2] No such file or directory: '/home/*USER*/.streamdeck_ui.json.tmp' -> '/home/*USER*/.streamdeck_ui.json'
Segmentation fault (core dumped)

Process 2419385 (streamdeck) of user 1000 dumped core.
                                                          
Stack trace of thread 2419385:
#0  0x00007f8a2cc4ce81 malloc_consolidate (libc.so.6 + 0x88e81)
#1  0x00007f8a2cc4edc3 _int_malloc (libc.so.6 + 0x8adc3)
#2  0x00007f8a2cc50a41 malloc (libc.so.6 + 0x8ca41)
#3  0x00007f8a1ead9959 _Znwm (libstdc++.so.6 + 0xaa959)
#4  0x00007f89dc356efa n/a (/home/*USER*/.local/lib/python3.9/site-packages/PySide2/Qt/lib/libQt5Gui.so.5 + 0x3cbefa)
munmap_chunk(): invalid pointer
Aborted (core dumped)

Process 2419523 (streamdeck) of user 1000 dumped core.
                                                          
Stack trace of thread 2419539:
#0  0x00007fd6c0e519d5 raise (libc.so.6 + 0x3d9d5)
#1  0x00007fd6c0e3a8a4 abort (libc.so.6 + 0x268a4)
#2  0x00007fd6c0e94177 __libc_message (libc.so.6 + 0x80177)
#3  0x00007fd6c0e9be6c malloc_printerr (libc.so.6 + 0x87e6c)
#4  0x00007fd6c0e9c29c munmap_chunk (libc.so.6 + 0x8829c)
#5  0x00007fd66946c497 hb_face_destroy (libharfbuzz.so.0 + 0x29497)
#6  0x00007fd66946c828 hb_font_destroy (libharfbuzz.so.0 + 0x29828)
#7  0x00007fd67326a629 raqm_destroy (libraqm.so.0 + 0x2629)
#8  0x00007fd669b1c7a1 n/a (/home/*USER*/.local/lib/python3.9/site-packages/PIL/_imagingft.cpython-39-x86_64-linux-gnu.so + 0x37a1)
free(): invalid size
Aborted (core dumped)

Process 2419819 (streamdeck) of user 1000 dumped core.
                                                          
Stack trace of thread 2419835:
#0  0x00007f36502a49d5 raise (libc.so.6 + 0x3d9d5)
#1  0x00007f365028d8a4 abort (libc.so.6 + 0x268a4)
#2  0x00007f36502e7177 __libc_message (libc.so.6 + 0x80177)
#3  0x00007f36502eee6c malloc_printerr (libc.so.6 + 0x87e6c)
#4  0x00007f36502f024c _int_free (libc.so.6 + 0x8924c)
#5  0x00007f36026be0f4 raqm_layout (libraqm.so.0 + 0x30f4)
#6  0x00007f35f8f6f9bf n/a (/home/*USER*/.local/lib/python3.9/site-packages/PIL/_imagingft.cpython-39-x86_64-linux-gnu.so + 0x39bf)

@dodgyrabbit
Copy link
Collaborator Author

dodgyrabbit commented Apr 2, 2021

Thank you for the feedback!
@tylerjw and @delpes - looks like the icon does not always load properly from the OS "theme" using Qt. I've switched to using a resource file, so it should always work. Change is committed, want to test it myself first and will post an update later.

@t3838d4 Updated

You hit two separate issues.

  1. Update Pillow to 8.2.0 (should fix the core dump)
  2. Update streamdeck-ui to 1.0.5 (should fix race condition and scrambled button images)

I've managed to reproduce it from time to time and it is a race condition where multiple threads try update the buttons at the same time. The same issue is evident from the saving of the settings file (two threads running that code would result in the error you see. I suspect the reason is that the new streamdeck library (8.x) has changed the way it dispatches key press events. I don't have a stream deck XL - but I suspect it's just more likely to happen because it has more buttons to update.

@dodgyrabbit dodgyrabbit changed the title New version to test - 1.0.4 New version to test - 1.0.5 Apr 2, 2021
@dodgyrabbit
Copy link
Collaborator Author

@tylerjw @delpes @t3838d4 Could you please give version 1.0.5 a try and post back your findings. Thanks!

@tylerjw
Copy link
Collaborator

tylerjw commented Apr 2, 2021

I installed the new version and now the remove X icon is there. 👍

I've discovered a new issue that's present on opening the application it looks like this:
20210402_125147

It is missing the icons for the buttons, I can get them back simply by navigating to another page. When I return to page 4 I see this:
20210402_125202

If you can't reproduce this let me know and I can provide more of my local setup.

@delpes
Copy link

delpes commented Apr 2, 2021

I got a core dump that was caused by an issue with pillow < 8.2.0
python-pillow/Pillow#4225

This caused streamdeck to crash whenever there was text for a button.
It crashed at the following line:
ImageFont.py(430): size, offset = self.font.getsize(text, "L", direction, features, language)

You can resolve this by upgrading pillow to 8.2.0

I successfully upgraded to 1.0.5.
The icon is there.

I couldn't reproduce the issue @tylerjw had.
Might this be related to pages? Currently i only have the first page (page: 0) filled with buttons.

I had a core dump on clicking Exit in the Menu. But it doesn't seem to break anything:

api.py(167):             deck.close()
 --- modulename: StreamDeck, funcname: close
StreamDeck.py(159):         self.device.close()
 --- modulename: LibUSBHIDAPI, funcname: close
LibUSBHIDAPI.py(357):             if self.device_handle:
LibUSBHIDAPI.py(358):                 self.hidapi.close_device(self.device_handle)
 --- modulename: LibUSBHIDAPI, funcname: close_device
LibUSBHIDAPI.py(193):             if handle:
LibUSBHIDAPI.py(194):                 with self.mutex:
LibUSBHIDAPI.py(195):                     self.hidapi.hid_close(handle)
LibUSBHIDAPI.py(359):                 self.device_handle = None
api.py(165):     for _deck_serial, deck in decks.items():
gui.py(379):         sys.exit()
[1]    26839 segmentation fault (core dumped)  python -u -m trace -t 

Edit: Removed unnecessary traces for the pillow issue and added info on that problem

@dodgyrabbit
Copy link
Collaborator Author

@tylerjw OK after messing around a bit, I managed to recreate the problem.

It will only happen if the last tab you're on has a button in the top left without a Text value.
You can work around it for now by just adding some text there.

I'll open a specific issue and fix it. Thanks for reporting it!

image

@dodgyrabbit
Copy link
Collaborator Author

@delpes Glad you tracked down the Pillow issue. I'll create a new build with version 8.2.0.

If I understand correctly, the core dump is happening when you click Exit, regardless of the Pillow update.
The original version core dumped every time on exit - but adding the deck.close() to gracefully shut down before exiting the app fixed it for me. Strange that it's still happening.

Any particular details you could share? Do you have just one Stream Deck attached? What kind? OS Version? You mention "arch + bspwm" - can you expand a bit, I'm not familiar with it but can set it up in a VM and try reproduce.

@dodgyrabbit dodgyrabbit changed the title New version to test - 1.0.5 New version to test - 1.0.6 Apr 3, 2021
@dodgyrabbit
Copy link
Collaborator Author

Version 1.0.6 has been published. Requires Pillow 8.2 (core dump fix) and fixes startup icon issue @tylerjw mentioned.

Still need to try reproduce core dump on Exit mentioned by @delpes

@t3838d4
Copy link

t3838d4 commented Apr 3, 2021

I upgraded to 1.0.6 and haven't seen a crash as of yet - with 1.0.5 (pillow 8.1.2) it was a matter of 2-3 button presses. I will leave it installed and report back, if anything comes up.
Thanks!

@delpes
Copy link

delpes commented Apr 3, 2021

@dodgyrabbit

My System:
Manjaro 21.0 XFCE but modified to run with bspwm.
There is a Manjaro bspwm 20.0.1 community edition: https://manjaro.org/download/#bspwm
Unfortunately i had no time spinning up a clean install of either to try. (Perhaps i'll get to this later today)

I have a Stream Deck Original (V2) - it's the only one attached through a USB Hub.

Below 3 more logs:
python -u -m trace -t on the up2date master branch:

api.py(167):             deck.close()
 --- modulename: StreamDeck, funcname: close
StreamDeck.py(159):         self.device.close()
 --- modulename: LibUSBHIDAPI, funcname: close
LibUSBHIDAPI.py(357):             if self.device_handle:
LibUSBHIDAPI.py(358):                 self.hidapi.close_device(self.device_handle)
 --- modulename: LibUSBHIDAPI, funcname: close_device
LibUSBHIDAPI.py(193):             if handle:
LibUSBHIDAPI.py(194):                 with self.mutex:
LibUSBHIDAPI.py(195):                     self.hidapi.hid_close(handle)
StreamDeck.py(111):                     continue
StreamDeck.py(106):         while self.run_read_thread:
StreamDeck.py(107):             try:
StreamDeck.py(108):                 new_key_states = self._read_key_states()
 --- modulename: StreamDeckOriginalV2, funcname: _read_key_states
StreamDeckOriginalV2.py(84):         states = self.device.read(4 + self.KEY_COUNT)
 --- modulename: LibUSBHIDAPI, funcname: read
LibUSBHIDAPI.py(436):             return self.hidapi.read(self.device_handle, length)
 --- modulename: LibUSBHIDAPI, funcname: read
LibUSBHIDAPI.py(295):             if not handle:
LibUSBHIDAPI.py(298):             data = ctypes.create_string_buffer(length)
 --- modulename: __init__, funcname: create_string_buffer
__init__.py(53):     if isinstance(init, bytes):
__init__.py(61):     elif isinstance(init, int):
__init__.py(62):         _sys.audit("ctypes.create_string_buffer", None, init)
__init__.py(63):         buftype = c_char * init
__init__.py(64):         buf = buftype()
__init__.py(65):         return buf
LibUSBHIDAPI.py(300):             with self.mutex:
LibUSBHIDAPI.py(359):                 self.device_handle = None
api.py(165):     for _deck_serial, deck in decks.items():
gui.py(390):         sys.exit()
LibUSBHIDAPI.py(301):                 result = self.hidapi.hid_read(handle, data, len(data))
LibUSBHIDAPI.py(303):             if result < 0:
LibUSBHIDAPI.py(304):                 raise TransportError("Failed to read in report (%d)" % result)
StreamDeck.py(119):             except (TransportError):
StreamDeck.py(120):                 self.run_read_thread = False
StreamDeck.py(106):         while self.run_read_thread:
threading.py(896):             del self._target, self._args, self._kwargs
[1]    40469 segmentation fault (core dumped)  python -u -m trace -t 

and

LibUSBHIDAPI.py(300):             with self.mutex:
LibUSBHIDAPI.py(359):                 self.device_handle = None
LibUSBHIDAPI.py(301):                 result = self.hidapi.hid_read(handle, data, len(data))
LibUSBHIDAPI.py(303):             if result < 0:
LibUSBHIDAPI.py(304):                 raise TransportError("Failed to read in report (%d)" % result)
StreamDeck.py(119):             except (TransportError):
StreamDeck.py(120):                 self.run_read_thread = False
StreamDeck.py(106):         while self.run_read_thread:
threading.py(896):             del self._target, self._args, self._kwargs
api.py(165):     for _deck_serial, deck in decks.items():
gui.py(390):         sys.exit()

strace streamdeck on 1.0.6 installed via pip3

munmap(0x7fca700cf000, 5034400)         = 0
poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])
writev(3, [{iov_base="<\0\2\0\30\0\240\0006\0\2\0\27\0\240\0\206\6\2\0\20\0\240\0\4\0\2\0\17\0\240\0"..., iov_len=68}], 1) = 68
futex(0x560914560df8, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x7fff709548d8, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, FUTEX_BITSET_MATCH_ANY) = 0
futex(0x560914560df8, FUTEX_WAKE_PRIVATE, 1) = 0
munmap(0x7fcaafaa6000, 1024)            = 0
futex(0x5609147331c4, FUTEX_WAKE_PRIVATE, 2147483647) = 1
futex(0x560914733170, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x560914725930, FUTEX_WAKE_PRIVATE, 2147483647) = 1
futex(0x5609147258e0, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x56091475eed4, FUTEX_WAKE_PRIVATE, 2147483647) = 1
futex(0x56091475ee80, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x560914930644, FUTEX_WAKE_PRIVATE, 2147483647) = 1
futex(0x5609149305f0, FUTEX_WAKE_PRIVATE, 1) = 1
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x8} ---
+++ killed by SIGSEGV (core dumped) +++
[1]    40688 segmentation fault (core dumped)  strace streamdeck

Related to the TransportError?

Thanks btw for all the updates!

@tylerjw
Copy link
Collaborator

tylerjw commented Apr 3, 2021

Installed 1.0.6 and the issue with the missing icons is fixed. 😀

@dodgyrabbit dodgyrabbit changed the title New version to test - 1.0.6 New version to test - 1.0.7 Apr 5, 2021
@dodgyrabbit
Copy link
Collaborator Author

Thank you to everyone who tried it out. I've published 1.0.7.
https://pypi.org/project/streamdeck-ui/

@dodgyrabbit dodgyrabbit unpinned this issue Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants