Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Upgraded volume calculations to preserve relative positions when hitting the min or max setting via source volume bar
* Update our spotify provider `go-librespot` to `0.7.3`
* Upgrade from Logitech Media Server 8.5.2 to Lyrion Music Server 9.0.3
* Fixed LMS stream shutdown force-killing the wrong process group

# 0.4.11
* System
Expand Down
14 changes: 10 additions & 4 deletions amplipi/streams/lms.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ def _activate(self, vsrc: int):
meta_args.extend(["--server", f"{self.server}"])
if self.port is not None:
meta_args.extend(["--port", f"{self.port}"])
self.meta_proc = subprocess.Popen(args=meta_args, stdout=sys.stdout, stderr=sys.stderr)
self.meta_proc = subprocess.Popen(args=meta_args, stdout=sys.stdout, stderr=sys.stderr, preexec_fn=os.setpgrp)

self.proc = subprocess.Popen(args=lms_args)
self.proc = subprocess.Popen(args=lms_args, preexec_fn=os.setpgrp)
except Exception as exc:
logger.exception(f'error starting lms: {exc}')

Expand All @@ -106,7 +106,10 @@ def _deactivate(self):
except Exception as e:
logger.exception(f"failed to gracefully terminate LMS stream {self.name}: {e}")
logger.warning(f"forcefully killing LMS stream {self.name}")
os.killpg(self.proc.pid, signal.SIGKILL)
try:
os.killpg(os.getpgid(self.proc.pid), signal.SIGKILL)
except ProcessLookupError:
pass
self.proc.communicate(timeout=3)

if self.meta_proc is not None:
Expand All @@ -116,7 +119,10 @@ def _deactivate(self):
except Exception as e:
logger.exception(f"failed to gracefully terminate LMS meta proc for {self.name}: {e}")
logger.warning(f"forcefully killing LMS meta proc for {self.name}")
os.killpg(self.meta_proc.pid, signal.SIGKILL)
try:
os.killpg(os.getpgid(self.meta_proc.pid), signal.SIGKILL)
except ProcessLookupError:
pass
self.meta_proc.communicate(timeout=3)

self.proc = None
Expand Down