Public bug reported:

[Impact]

Users are unable to use sonic-pi as it crashes shortly after launch.
This puts sonic-pi in a completely unusable state.

[Test Case]

Install sonic-pi and launch it.

Expected: Application remains open expecting input.
Actual: Application crashes and closes

[What could go wrong]

When the GUI starts before scsynth has created the shared memory
segment, server_shared_memory_client's constructor throws
std::runtime_error. ResetConnection() did not catch it, causing
terminate() to be called and the application to abort immediately. The
patch wraps the construction in a try/catch so the audio processing
thread retries after one second, matching the existing retry logic for
an invalid reader.

The only behavioural change is that a failed server_shared_memory_client
construction no longer propagates out of ResetConnection(). The existing
run() loop already handles !m_shmReader.valid() by sleeping 1 second and
retrying, so the retry logic was already there. The patch just stops it
from being bypassed by the crash.

ResetConnection() is called from two places in run(): once in the "not
yet connected" branch at the top of the loop, and once in the "empty
frames" branch after 10 consecutive empty reads (line 372). In the
second case, scsynth was connected and then went quiet. With the patch,
if that reconnect attempt throws (e.g. scsynth restarted and the shared
memory was destroyed), the reader is reset to invalid and the next
iteration takes the 1-second-sleep path. Previously this would also have
crashed. So the patch actually fixes a second potential crash scenario
there as well.

With that, there's low risk of regression.

[Other Information]

It is expected that the upstream Debian Maintainer of this package will
be updating it to 4.6.0 soon (1-2 weeks from this writing), which is a
major bump and also bumps Qt5 dependencies to Qt6. I have been working
with them on this.

I expect that to be backportable via official Ubuntu Backports in the
future. Until then, this restores functionality.

** Affects: sonic-pi (Ubuntu)
     Importance: High
     Assignee: Erich Eickmeyer (eeickmeyer)
         Status: Fix Committed

** Affects: sonic-pi (Ubuntu Resolute)
     Importance: High
     Assignee: Erich Eickmeyer (eeickmeyer)
         Status: In Progress

** Affects: sonic-pi (Ubuntu Stonking)
     Importance: High
     Assignee: Erich Eickmeyer (eeickmeyer)
         Status: Fix Committed

** Also affects: sonic-pi (Ubuntu Resolute)
   Importance: Undecided
       Status: New

** Also affects: sonic-pi (Ubuntu Stonking)
   Importance: High
     Assignee: Erich Eickmeyer (eeickmeyer)
       Status: In Progress

** Changed in: sonic-pi (Ubuntu Resolute)
       Status: New => In Progress

** Changed in: sonic-pi (Ubuntu Resolute)
   Importance: Undecided => High

** Changed in: sonic-pi (Ubuntu Resolute)
     Assignee: (unassigned) => Erich Eickmeyer (eeickmeyer)

** Changed in: sonic-pi (Ubuntu Stonking)
       Status: In Progress => Fix Committed

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2155963

Title:
  [SRU] sonic-pi crashes at launch

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/sonic-pi/+bug/2155963/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to