Skip to content

Commit

Permalink
enable leakless
Browse files Browse the repository at this point in the history
  • Loading branch information
dogancanbakir committed Mar 29, 2024
1 parent 664f886 commit 5ba0714
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions pkg/engine/hybrid/hybrid.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,21 @@ import (
"github.com/projectdiscovery/katana/pkg/engine/common"
"github.com/projectdiscovery/katana/pkg/types"
errorutil "github.com/projectdiscovery/utils/errors"
processutil "github.com/projectdiscovery/utils/process"
urlutil "github.com/projectdiscovery/utils/url"
)

// Crawler is a standard crawler instance
type Crawler struct {
*common.Shared

browser *rod.Browser
previousPIDs map[int32]struct{} // track already running PIDs
tempDir string
browser *rod.Browser
// TODO: Remove the Chrome PID kill code in favor of using Leakless(true).
// This change will be made if there are no complaints about zombie Chrome processes.
// References:
// https://github.com/projectdiscovery/katana/issues/632
// https://github.com/projectdiscovery/httpx/issues/1425
// previousPIDs map[int32]struct{} // track already running PIDs
tempDir string
}

// New returns a new standard crawler instance
Expand All @@ -37,7 +41,7 @@ func New(options *types.CrawlerOptions) (*Crawler, error) {
}
}

previousPIDs := processutil.FindProcesses(processutil.IsChromeProcess)
// previousPIDs := processutil.FindProcesses(processutil.IsChromeProcess)

var launcherURL string
var chromeLauncher *launcher.Launcher
Expand Down Expand Up @@ -81,10 +85,10 @@ func New(options *types.CrawlerOptions) (*Crawler, error) {
}

crawler := &Crawler{
Shared: shared,
browser: browser,
previousPIDs: previousPIDs,
tempDir: dataStore,
Shared: shared,
browser: browser,
// previousPIDs: previousPIDs,
tempDir: dataStore,
}

return crawler, nil
Expand All @@ -102,7 +106,7 @@ func (c *Crawler) Close() error {
return err
}
}
processutil.CloseProcesses(processutil.IsChromeProcess, c.previousPIDs)
// processutil.CloseProcesses(processutil.IsChromeProcess, c.previousPIDs)
return nil
}

Expand All @@ -125,7 +129,7 @@ func (c *Crawler) Crawl(rootURL string) error {
// buildChromeLauncher builds a new chrome launcher instance
func buildChromeLauncher(options *types.CrawlerOptions, dataStore string) (*launcher.Launcher, error) {
chromeLauncher := launcher.New().
Leakless(false).
Leakless(true).
Set("disable-gpu", "true").
Set("ignore-certificate-errors", "true").
Set("ignore-certificate-errors", "1").
Expand Down

0 comments on commit 5ba0714

Please sign in to comment.