bitfocus / companion

Bitfocus Companion enables the reasonably priced Elgato Stream Deck and other controllers to be a professional shotbox surface for an increasing amount of different presentation switchers, video playback software and broadcast equipment.
http://bitfocus.io/companion
Other
1.57k stars 499 forks source link

[BUG] Deleted button persists on page in some conditions #2897

Closed phillipivan closed 3 months ago

phillipivan commented 3 months ago

Is this a bug in companion itself or a module?

Is there an existing issue for this?

Describe the bug

A button with an very large font size persists on the page layout after being deleted.

Steps To Reproduce

  1. Create Button
  2. Set Button Text 'HI', Set Font Size to 166
  3. Delete Button
  4. Button remains on page but the Edit button tab shows an empty button
  5. Creating a new button in the same position with a new text string is not displayed.

Screen shot showing deleted button still displayed in page view:

image

Expected Behavior

Deleted button is removed from page view, and when a new button is created it is displayed in that position as expected.

Environment (please complete the following information)

- OS: Win 10.0.19045
- Browser: Chrome 120
- Companion Version: 3.3.1

Additional context

Replicated on multiple systems.

Companion restart clears the zombie button.

Julusian commented 3 months ago

oh wow, this isn't a good bug. After testing this, my companion vm has 'crashed' stuck with 100% cpu and memory usage image image

and a lot of disk read ~900MB (not sure on timescale) (but not write): image

phillipivan commented 3 months ago

We didn't observe outright crashing.

Obviously there is no sane reason for a font size like that - it came about from a typo when setting up a button.

Julusian commented 3 months ago

I have a fix for this, it was hitting an edge case in the code when trying to figure out where to force line breaks in the text. It was getting stuck in an infinite loop, finding each iteration that no characters fit on a line, so it created a line of 0 characters then kept on trying the remainder. So the fix is simple, if one char is too wide to draw, do it anyway instead of trying to see if zero chars is a better fit.

Unfortunately this is too late to get into 3.3.1, but the fix is in the betas and will be in a 3.3.2 when that happens

@phillipivan if you haven't restarted companion since you saw this, I highly recommend you do. One of the rendering threads will be stuck trying to complete that draw, consuming a core of cpu and as much memory as it can find.

phillipivan commented 3 months ago

Thanks for the quick response. Confirmed fixed for us in build 7040.