[BUG] Out of Memory
Context:
- Playwright Version: [1.35.0]
- Operating System: [Windows10]
- Python version: [e.g. 3.7 x64]
- Browser: [Chromium]
- Extra: [any specific details about your environment]
Describe the bug The "Out of Memory" is displayed in the browser, and the entire program is permanently hung at this time. There is no effect in timeout. The result I expected was to throw a timeout error and refresh the page. like https://github.com/microsoft/playwright-python/issues/1847
Reproduce the condition Not necessarily completely accurate
- Windows memory is not much left
- Browser pages contain a large number of elements
Do you maybe do a lot of repetitive tasks inside your context and don't re-create it over and over again?
Playwright only releases the memory when you close aka. re-create the context what we recommend for end-to-end testing between each test.
Looks like your system ran out of memory, and then Chromium ran out of memory. How much RAM does your computer have?
Do you maybe do a lot of repetitive tasks inside your context and don't re-create it over and over again?
Playwright only releases the memory when you close aka. re-create the context what we recommend for end-to-end testing between each test.
Looks like your system ran out of memory, and then Chromium ran out of memory. How much RAM does your computer have?
Thanks for the reply.
- I just repeat a lot of repetitive tasks in the same context, closing the page and opening a new page to perform a new task with each task completed
- There is about 1-2g of free memory, a total of 12g
- When the browser displays "Out of Memory", the whole Python program is suspended and no exception is thrown, can this be avoided?
Yeah Playwright is designed for end-to-end testing, there we expect the user to re-create the context over and over again. If you don't re-create, you end up in that, see also https://github.com/microsoft/playwright/issues/6319 for the upstream bug.
So you need to re-create the context, otherwise there are no possible workarounds.
Yeah Playwright is designed for end-to-end testing, there we expect the user to re-create the context over and over again. If you don't re-create, you end up in that, see also microsoft/playwright#6319 for the upstream bug.
So you need to re-create the context, otherwise there are no possible workarounds.
I create a context at the beginning of each big task, and if it's a small task contained in a big task, it doesn't create a new context, but a new page. Each small task takes about 3-5 minutes.
But none of this matters, the point is that when the browser displays "Out of Memory" appears, the following code never ends
page.fill('#username', '[email protected]') # now the browser displays "Out of Memory"
print('fill success') # never execute
Oh ok, that seems different then. Are you able to share a reproduction with us? Maybe there is a memory leak on the page or inside Playwright. Having a reproduction would be essencial for us to be able to debug that. Thanks!
Oh ok, that seems different then. Are you able to share a reproduction with us? Maybe there is a memory leak on the page or inside Playwright. Having a reproduction would be essencial for us to be able to debug that. Thanks!
- Open a page with many web elements
- Continuously automate this page for up to 5 minutes. for example fill, click, set_input_files, wait_for_selector
- During the second step, the software is continuously opened so that the available memory is constantly reduced
Do you then close the page and the context after the 5 minutes?
I fear we need a reproduction which we can run locally, since its otherwise more guessing.
Closing as per above since we need a reproduction. Please re-file with a reproduction, thanks for your understanding.