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

fix zombie processes #673

Merged
merged 2 commits into from
May 14, 2024
Merged
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
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ require (
gopkg.in/yaml.v3 v3.0.1
)

replace github.com/chromedp/chromedp => github.com/livekit/chromedp v0.0.0-20240514210859-ca7d75d3511c

require (
cloud.google.com/go v0.112.1 // indirect
cloud.google.com/go/auth v0.3.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL
github.com/chromedp/cdproto v0.0.0-20240202021202-6d0b6a386732/go.mod h1:GKljq0VrfU4D5yc+2qA6OVr8pmO/MBbPEWqWQ/oqGEs=
github.com/chromedp/cdproto v0.0.0-20240421230201-ab917191657d h1:x9d0XwRV3aWw1gAZtv0LrI39U+Efjp0mtyXRyikGb9Y=
github.com/chromedp/cdproto v0.0.0-20240421230201-ab917191657d/go.mod h1:GKljq0VrfU4D5yc+2qA6OVr8pmO/MBbPEWqWQ/oqGEs=
github.com/chromedp/chromedp v0.9.5 h1:viASzruPJOiThk7c5bueOUY91jGLJVximoEMGoH93rg=
github.com/chromedp/chromedp v0.9.5/go.mod h1:D4I2qONslauw/C7INoCir1BJkSwBYMyZgx8X276z3+Y=
github.com/chromedp/sysutil v1.0.0 h1:+ZxhTpfpZlmchB58ih/LBHX52ky7w2VhQVKQMucy3Ic=
github.com/chromedp/sysutil v1.0.0/go.mod h1:kgWmDdq8fTzXYcKIBqIYvRRTnYb9aNS9moAV0xufSww=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
Expand Down Expand Up @@ -162,6 +160,8 @@ github.com/ledongthuc/pdf v0.0.0-20220302134840-0c2507a12d80 h1:6Yzfa6GP0rIo/kUL
github.com/ledongthuc/pdf v0.0.0-20220302134840-0c2507a12d80/go.mod h1:imJHygn/1yfhB7XSJJKlFZKl/J+dCPAknuiaGOshXAs=
github.com/lithammer/shortuuid/v4 v4.0.0 h1:QRbbVkfgNippHOS8PXDkti4NaWeyYfcBTHtw7k08o4c=
github.com/lithammer/shortuuid/v4 v4.0.0/go.mod h1:Zs8puNcrvf2rV9rTH51ZLLcj7ZXqQI3lv67aw4KiB1Y=
github.com/livekit/chromedp v0.0.0-20240514210859-ca7d75d3511c h1:kMZgToGvX3ud9Dr8cvh7HCZ8zBk8SoYVI46HaC3YYjo=
github.com/livekit/chromedp v0.0.0-20240514210859-ca7d75d3511c/go.mod h1:D4I2qONslauw/C7INoCir1BJkSwBYMyZgx8X276z3+Y=
github.com/livekit/livekit-server v1.6.0 h1:GyswI3nkC7/tmIJacSUZY2xG6Dbe11K6RjWrrt7nGG4=
github.com/livekit/livekit-server v1.6.0/go.mod h1:VwBD+Lh20wd8amnAmvsUBTmyVZwILKagsHfiaSkmyRE=
github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1 h1:jm09419p0lqTkDaKb5iXdynYrzB84ErPPO4LbRASk58=
Expand Down
10 changes: 3 additions & 7 deletions pkg/pipeline/source/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"fmt"
"math/rand"
"net/url"
"os"
"os/exec"
"strings"
"time"
Expand Down Expand Up @@ -116,17 +115,14 @@ func (s *WebSource) Close() {

if s.xvfb != nil {
logger.Debugw("closing X display")
err := s.xvfb.Process.Signal(os.Interrupt)
if err != nil {
logger.Errorw("failed to kill xvfb", err)
}
_ = s.xvfb.Process.Kill()
_ = s.xvfb.Wait()
s.xvfb = nil
}

if s.pulseSink != "" {
logger.Debugw("unloading pulse module")
err := exec.Command("pactl", "unload-module", s.pulseSink).Run()
if err != nil {
if err := exec.Command("pactl", "unload-module", s.pulseSink).Run(); err != nil {
logger.Errorw("failed to unload pulse sink", err)
}
}
Expand Down
1 change: 1 addition & 0 deletions pkg/service/service_rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ func (s *Service) AddHandler(egressID string, p *Process) error {
case <-time.After(10 * time.Second):
logger.Warnw("no response from handler", nil, "egressID", egressID)
_ = p.cmd.Process.Kill()
_ = p.cmd.Wait()
s.processEnded(p, errors.ErrEgressNotFound)
}

Expand Down