question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] - playwrights runs in multitudes

See original GitHub issue

My code is essentially is a loop over

tt = api.getTikTokById(video['id'],proxy=proxy,custom_did=custom_did)
bytes = api.get_Video_By_TikTok(tt['itemInfo']['itemStruct'],proxy=proxy,custom_did=custom_did)

api get created in the begin of the program.

Due to some reason, playwrights did not stop and runs until the program finishes. They merrily eats all CPU and memory, at number of 20-30 they causes my machine to hang.

Actually, after some processing, it yields

6816498522741918981 info...loading...6816498522741918981 is video/mp4...done.
6813478929186245893 info...loading...Error at 90 Protocol error (Runtime.enable): The page has been closed. loading 6813478929186245893 error.
6830234382377258245 info...Error at 90 Target page, context or browser has been closed loading 6830234382377258245 error.

And after stop I still see

tarkhil     9917  0.0  0.0   6892  1704 ?        SNs  14:03   0:00 /bin/bash /home/tarkhil/.cache/ms-playwright/webkit-1383/pw_run.sh --inspector-pipe --headless --no-startup-window --proxy=socks5://148.xxx.xxx.247:1080
tarkhil     9922  0.5  0.0 104291544 3176 ?      SNl  14:03   0:12 /home/tarkhil/.cache/ms-playwright/webkit-1383/minibrowser-wpe/bin/MiniBrowser --inspector-pipe --headless --no-startup-window --proxy=socks5://148.xxx.xxx.247:1080

Should I reinint API on each run and kill all subprocesses after?..

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
zoopzorpcommented, Jan 25, 2021

This happens because a new BrowserContext is created upon each request and never closed. I am not sure if a new context is needed each time or not, but to fix the current issue keeping functionality the same:

  • Return the context from create_page instead of a page
  • Change the two calls to create_page to instead create a page afterwards with the returned context
  • Call context.close() after the operation finishes instead of page.close() (You will have to reorder the operations in sign_url since the current page.close() is after the return statement)
0reactions
pibvbpcommented, Jan 29, 2021

great - thanks!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nica Burns Warns of Problems Facing Theatres in 2023
Nica Burns has warned that theatres are facing a multitude of problems in 2023. Appearing on BBC Radio 4's Front Row programme, ...
Read more >
10 British Contemporary Playwrights You Should Know
Read our guide to contemporary British theatre and see which names are turning London's stages into some of the most creative and original...
Read more >
The insect apocalypse: 'Our world will grind to a halt without ...
All of them are prey for a multitude of birds, bats, spiders, reptiles, ... the largest and longest-running scheme of its kind in...
Read more >
Bug (play) - Wikipedia
Bug is a play by American playwright Tracy Letts. Exploring themes of paranoia and conspiracy theories, the play tells the story of a...
Read more >
The Multitude That We Are | Poets & Writers
In this virtual reading and conversation examining the multitude of identities, authors Usha Akella, Manuel Muñoz, and Suzi Q. Smith read their work...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found