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

Defunct process playwright.sh #140

Closed
j-fuentes opened this issue Jul 5, 2021 · 0 comments · Fixed by #192
Closed

Defunct process playwright.sh #140

j-fuentes opened this issue Jul 5, 2021 · 0 comments · Fixed by #192
Assignees

Comments

@j-fuentes
Copy link

I have discovered that playwright.Stop() lefts behind a defunct process.

It is possible to reproduce the problem doing this:

Create this simple Go program:

package main

import (
	"fmt"
	"time"

	"github.com/mxschmitt/playwright-go"
)

func main() {
    runOpts := &playwright.RunOptions{
		SkipInstallBrowsers: true,
	}
	
	pw, err := playwright.Run(runOpts)
	if err != nil {
		panic(err)
	}

	pw.Dispose()
	fmt.Println("after dispose")
	err = pw.Stop()
	fmt.Println("after stop: ", err)
	
	fmt.Println("after cleanup. Waiting...")
	time.Sleep(20*time.Second)
}

As you can see, I have made it wait 20secs at the end, enough to run check the mentioned defunct process.

I build the program with go build . and then I mount the binary in a docker container with the playwright runtime to test it:

$ docker run --name=bugdemo -ti -v $PWD/bugdemo:/mnt/bugdemo mcr.microsoft.com/playwright:focal bash

# /mnt/bugdemo
after dispose
after stop:  <nil>
after cleanup. Waiting...

I open another shell in the container and check the running processes:

$ docker exec -ti bugdemo bash

# ps aux
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root           1  0.0  0.0   4236  3368 pts/0    Ss   14:14   0:00 bash
root         106  0.1  0.0   4240  3416 pts/1    Ss   14:27   0:00 bash
root         114  0.0  0.0 1078984 6112 pts/0    Sl+  14:27   0:00 ./bugdemo
root         130  0.0  0.0      0     0 pts/0    Z+   14:27   0:00 [playwright.sh] <defunct>
root         133  4.0  0.3 568364 53268 pts/0    Sl+  14:27   0:00 /root/.cache/ms-playwright-go/1.10.0/node /root/.cache/ms-playwright-go/1.10.0/package/lib/cli/cli.js run-driver
root         140  0.0  0.0   5896  2932 pts/1    R+   14:27   0:00 ps aux

After 20secs, once the bugdemo process has finished, the defunct process disappears:

# ps aux
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root           1  0.0  0.0   4236  3368 pts/0    Ss+  14:14   0:00 bash
root         106  0.0  0.0   4240  3532 pts/1    Ss   14:27   0:00 bash
root         141  0.0  0.0   5896  2848 pts/1    R+   14:27   0:00 ps aux

I would expect pw.Stop() or pw.Dispose() to cleanup the playwright runtime completly.

@kumaraditya303 kumaraditya303 added help wanted Extra attention is needed and removed help wanted Extra attention is needed needs-verification labels Aug 6, 2021
@kumaraditya303 kumaraditya303 self-assigned this Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants