selenium-ide icon indicating copy to clipboard operation
selenium-ide copied to clipboard

Heavy CPU usage on new tab in Chrome

Open puteulanus opened this issue 3 years ago • 8 comments

🐛 Bug Report

When a new tab is opened on the Chrome browser with selenium ide extension, the CPU usage of chrome remains at a high level. Close the new tab, or enter url in address bar to visit the web page, the CPU usage will drop.

To Reproduce

Steps to reproduce the behavior:

  1. Click "+" to open a new tab.
  2. Wait some second and watch CPU usage.

Expected behavior

CPU usage will not increase significantly

Environment

OS: macOS 10.15.7 Selenium IDE Version: 3.17.0 Browser: Chrome Browser Version: 89.0.4389.82

2021-03-16 15 36 59

puteulanus avatar Mar 16 '21 07:03 puteulanus

Noticed this bug under Chrome 89.0.4389.114 on Linux Mint 20 -- single CPU core is pegged to 100 percent when Selenium IDE is open and a new tab is opened.

I attached strace to the process; this was a snippet of the output:

recvmsg(27, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(30, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(30, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=11, events=POLLIN}, {fd=12, events=POLLIN}, {fd=27, events=POLLIN}, {fd=30, events=POLLIN}, {fd=127, events=POLLIN}], 5, 0) = 0 (Timeout)
recvmsg(27, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
write(29, "\0", 1)                      = 1
write(29, "\0", 1)                      = 1
write(29, "\0", 1)                      = 1
recvmsg(27, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(30, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(30, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=11, events=POLLIN}, {fd=12, events=POLLIN}, {fd=27, events=POLLIN}, {fd=30, events=POLLIN}, {fd=127, events=POLLIN}], 5, 0) = 0 (Timeout)
recvmsg(27, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(27, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(30, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(30, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=11, events=POLLIN}, {fd=12, events=POLLIN}, {fd=27, events=POLLIN}, {fd=30, events=POLLIN}, {fd=127, events=POLLIN}], 5, 0) = 0 (Timeout)
recvmsg(27, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(27, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(30, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(30, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=11, events=POLLIN}, {fd=12, events=POLLIN}, {fd=27, events=POLLIN}, {fd=30, events=POLLIN}, {fd=127, events=POLLIN}], 5, 0) = 0 (Timeout)
recvmsg(27, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
write(29, "\0", 1)                      = 1
recvmsg(27, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(30, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(30, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=11, events=POLLIN}, {fd=12, events=POLLIN}, {fd=27, events=POLLIN}, {fd=30, events=POLLIN}, {fd=127, events=POLLIN}], 5, 0) = 0 (Timeout)
recvmsg(27, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
write(29, "\0", 1)                      = 1
write(29, "\0", 1)                      = 1
write(29, "\0", 1)                      = 1
recvmsg(27, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(30, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(30, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=11, events=POLLIN}, {fd=12, events=POLLIN}, {fd=27, events=POLLIN}, {fd=30, events=POLLIN}, {fd=127, events=POLLIN}], 5, 0) = 0 (Timeout)
recvmsg(27, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
write(29, "\0", 1)                      = 1
write(29, "\0", 1)                      = 1
recvmsg(27, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(30, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(30, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=11, events=POLLIN}, {fd=12, events=POLLIN}, {fd=27, events=POLLIN}, {fd=30, events=POLLIN}, {fd=127, events=POLLIN}], 5, 0) = 0 (Timeout)
recvmsg(27, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(27, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(30, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(30, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=11, events=POLLIN}, {fd=12, events=POLLIN}, {fd=27, events=POLLIN}, {fd=30, events=POLLIN}, {fd=127, events=POLLIN}], 5, 0) = 0 (Timeout)
recvmsg(27, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(27, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(30, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(30, {msg_namelen=0}, 0)         = -1 EAGAIN (Resource temporarily unavailable)

File descriptor 27 refers to some socket: 27 -> socket:[15993600] Same with file descriptor 30: 30 -> socket:[15993601]

Socket is being used for some Chrome ipc related things, it seems:

chrome    2471833                               timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM
chrome    2471833 2471840 sandbox_i             timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM
chrome    2471833 2471848 chrome                timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM
chrome    2471833 2471849 HangWatch             timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM
chrome    2471833 2471850 ThreadPoo             timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM
chrome    2471833 2471853 Chrome_IO             timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM
chrome    2471833 2471854 MemoryInf             timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM
chrome    2471833 2471855 gmain                 timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM
chrome    2471833 2471856 gdbus                 timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM
chrome    2471833 2471857 Bluez\x20             timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM
chrome    2471833 2471858 CrShutdow             timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM
chrome    2471833 2471859 dconf\x20             timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM
chrome    2471833 2471862 inotify_r             timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM
chrome    2471833 2471863 Composito             timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM
chrome    2471833 2471864 VideoCapt             timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM
chrome    2471833 2471865 BrowserWa             timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM
chrome    2471833 2471866 ThreadPoo             timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM
chrome    2471833 2471867 gpu-proce             timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM
chrome    2471833 2471868 CacheThre             timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM
chrome    2471833 2471870 utility_c             timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM
chrome    2471833 2471872 ThreadPoo             timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM
chrome    2471833 2471913 renderer_             timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM
chrome    2471833 2471990 extension             timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM
chrome    2471833 2472004 BatterySt             timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM
chrome    2471833 2509747 ThreadPoo             timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM
chrome    2471833 2519014 ThreadPoo             timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM
chrome    2471833 2529875 ThreadPoo             timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM
chrome    2471833 2529897 ThreadPoo             timothy   27u     unix 0x000000005f37aa44       0t0   15993600 type=STREAM

Hope this helps y'all debug things; I don't know the internals of the Chrome project at all.

Let me know if there's any progress made towards a fix. Thanks!

tkanarsky avatar Apr 07 '21 23:04 tkanarsky

i can confirm this is still happening. once removed cpu load turns back to normal.

drewbeer avatar Sep 29 '21 16:09 drewbeer

I believe I'm experiencing this on MacOS as well. I disabled the extension and my computer actually nets battery charge on low-power chargers now.

RulerOf avatar Oct 02 '21 15:10 RulerOf

Also experiencing this. MacOS Catalina 10.15.7

chaseTfreeman avatar Jan 27 '22 16:01 chaseTfreeman

This is not a full on outage or usage blocker, so it won't get resolved in v3. We're working hard on v4 however, which will have the benefit of being targetted only at electron instead of multiple browsers. Once we get there, we'll be able to actually target performance all the way down without hitting any unknown unknowns.

toddtarsi avatar Jan 27 '22 16:01 toddtarsi

Thanks @toddtarsi. Is there a development Roadmap? From what you wrote it seems like the IDE is going to be electron-based? I'm new to the Selenium Ecosystem so am not sure what resources are out there for me to look at other than the docs.

chaseTfreeman avatar Jan 27 '22 17:01 chaseTfreeman

@chaseTfreeman - I've gotten this question before. There isn't a development roadmap, but the plan I'm operating under is to have a beta in April. As a result, the only things I'm giving attention to in v3 are total deal breakers.

The closest thing to one is this project tracker, but it is QUITE out of date

toddtarsi avatar Jan 27 '22 18:01 toddtarsi

Still having the problem on Ubuntu 20.04.1 with Chrome 103.0.5060.53 and Selenium IDE 3.17.2 Easily shown with Chrome Task explorer (SHIFT+ESC) image

Note that killing the sub-process "https://google.com" that is attached to the new "empty" tab (and also uses 50% CPU) makes the CPU usage on Selenium IDE Extension go back to 0.

PS : Same screenshot, a few seconds after. Notice the increase in allocated memory... Still increasing. Above 1GB after 1min... image

davelowper avatar Jun 27 '22 20:06 davelowper

Not an issue in v4 where we're running as a standalone binary

toddtarsi avatar Nov 18 '22 14:11 toddtarsi

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Dec 19 '22 01:12 github-actions[bot]