opengs / uashield

Voluntary Ukraine security platform to protect us from Russian forces in the Internet
The Unlicense
1.09k stars 179 forks source link

Memory leak #211

Open MikronT opened 2 years ago

MikronT commented 2 years ago

Program settings

Version: 0.0.31 (latest) Command line: ./uashield --no-sandbox (doesn't start without --no-sandbox parameter)

Proxy: enabled Max threads (just my preference): 128

The amount of threads doesn't matter because the same happens with 256 or even 32 threads.

Environment

Oracle VM VirtualBox (virtual machine)

OS (uname -a output): Linux kali 5.16.0-kali6-amd64 #1 SMP PREEMPT Debian 5.16.14-1kali2 (2022-03-23) x86_64 GNU/Linux RAM: 3 GB

Behavior

When the program is running normally, the CPU utilization is about 20%, and the RAM usage is 1.5/3.0 GB.

After running for quite a bit, the program starts gradually eating all the memory available, and the CPU load rises to 100% immediately.

image

Memory usage per process right before the crash:

image

By the way, the program window doesn't respond anymore, and the terminal output is scrolling way faster than normal. Among the usual logs, there's superagent: double callback bug message appearing every few seconds.

Then the program runs out of memory, and the crash happens. Here's a message you can see in the terminal:

image

Tried to gather everything I noticed. Don't really sure what else I can provide, so here it is.

opengs commented 2 years ago

I already created issue about this on node-socks-proxy. TooTallNate/node-socks-proxy-agent#93

opengs commented 2 years ago

And looks like there is issue in http-proxy-agent and https-proxy-agent . I'm trying to find it, but now we are on workarounds :D . I spend hours on this issue and looks like this problem not in uashield.

MikronT commented 2 years ago

The issue is still present in the latest release 1.0.6, but there's some new info about it. The process causing the system to hang is now the one with the --type=renderer argument.

Screenshot 2022-05-03 101140

MikronT commented 2 years ago

Forgot to add some logs.

First, there's noticeable the worker count degradation with some errors. But when the thread count reaches 16, there're a lot more of the same errors thrown.

The log of errors is very long. This short snippet was captured at the moment the memory usage went up.

Automatic planer changed workers count from [29] to [28]
Automatic planer changed workers count from [28] to [27]
Automatic planer changed workers count from [27] to [26]
Automatic planer changed workers count from [26] to [25]
Automatic planer changed workers count from [25] to [24]
Automatic planer changed workers count from [24] to [23]
Automatic planer changed workers count from [23] to [22]
Automatic planer changed workers count from [22] to [21]
Automatic planer changed workers count from [21] to [20]
Automatic planer changed workers count from [20] to [19]
Automatic planer changed workers count from [19] to [18]
Automatic planer changed workers count from [18] to [17]
Automatic planer changed workers count from [17] to [16]
[4481:0503/151515.572648:ERROR:platform_shared_memory_region_posix.cc(250)] Creating shared memory in /dev/shm/.org.chromium.Chromium.6vhsY2 failed: Too many open files (24)
Automatic planer changed workers count from [16] to [17]
Automatic planer changed workers count from [17] to [18]
Automatic planer changed workers count from [18] to [19]
Automatic planer changed workers count from [19] to [20]
pageview
null
Automatic planer changed workers count from [20] to [21]
Automatic planer changed workers count from [21] to [20]
Automatic planer changed workers count from [20] to [19]
Automatic planer changed workers count from [19] to [18]
Automatic planer changed workers count from [18] to [17]
Automatic planer changed workers count from [17] to [16]
[4481:0503/151602.761683:ERROR:platform_shared_memory_region_posix.cc(250)] Creating shared memory in /dev/shm/.org.chromium.Chromium.VZqJ8n failed: Too many open files (24)
Automatic planer changed workers count from [16] to [17]
Automatic planer changed workers count from [17] to [16]
[4481:0503/151621.010336:ERROR:platform_shared_memory_region_posix.cc(250)] Creating shared memory in /dev/shm/.org.chromium.Chromium.p7zLN1 failed: Too many open files (24)
[4481:0503/151627.687667:ERROR:platform_shared_memory_region_posix.cc(250)] Creating shared memory in /dev/shm/.org.chromium.Chromium.1E64hm failed: Too many open files (24)
[4481:0503/151636.608858:ERROR:platform_shared_memory_region_posix.cc(250)] Creating shared memory in /dev/shm/.org.chromium.Chromium.0G2eYS failed: Too many open files (24)
Error: EMFILE: too many open files, open '/root/.config/UA Cyber SHIELD/config.json'
    at Object.openSync (node:fs:585:3)
    at Object.func [as openSync] (node:electron/js2c/asar_bundle:5:1812)
    at Object.readFileSync (node:fs:453:35)
    at Object.e.readFileSync (node:electron/js2c/asar_bundle:5:9160)
    at ElectronStore.get store [as store] (/tmp/.mount_uashied3We2N/resources/app.asar/node_modules/conf/dist/source/index.js:276:29)
    at ElectronStore.set (/tmp/.mount_uashied3We2N/resources/app.asar/node_modules/conf/dist/source/index.js:170:17)
    at IpcMainImpl.<anonymous> (/tmp/.mount_uashied3We2N/resources/app.asar/electron-main.js:34:13190)
    at IpcMainImpl.emit (node:events:390:28)
    at EventEmitter.<anonymous> (node:electron/js2c/browser_init:161:10120)
    at EventEmitter.emit (node:events:390:28) {
  errno: -24,
  syscall: 'open',
  code: 'EMFILE',
  path: '/root/.config/UA Cyber SHIELD/config.json'
}
[4481:0503/151711.745965:ERROR:platform_shared_memory_region_posix.cc(250)] Creating shared memory in /dev/shm/.org.chromium.Chromium.UqhUzw failed: Too many open files (24)
[4481:0503/151712.140937:ERROR:platform_shared_memory_region_posix.cc(250)] Creating shared memory in /dev/shm/.org.chromium.Chromium.J2ESXX failed: Too many open files (24)
[4481:0503/151712.165743:ERROR:platform_shared_memory_region_posix.cc(250)] Creating shared memory in /dev/shm/.org.chromium.Chromium.6VhJ8A failed: Too many open files (24)
Error: EMFILE: too many open files, open '/root/.config/UA Cyber SHIELD/config.json'
    at Object.openSync (node:fs:585:3)
    at Object.func [as openSync] (node:electron/js2c/asar_bundle:5:1812)
    at Object.readFileSync (node:fs:453:35)
    at Object.e.readFileSync (node:electron/js2c/asar_bundle:5:9160)
    at ElectronStore.get store [as store] (/tmp/.mount_uashied3We2N/resources/app.asar/node_modules/conf/dist/source/index.js:276:29)
    at ElectronStore.set (/tmp/.mount_uashied3We2N/resources/app.asar/node_modules/conf/dist/source/index.js:170:17)
    at IpcMainImpl.<anonymous> (/tmp/.mount_uashied3We2N/resources/app.asar/electron-main.js:34:13190)
    at IpcMainImpl.emit (node:events:390:28)
    at EventEmitter.<anonymous> (node:electron/js2c/browser_init:161:10120)
    at EventEmitter.emit (node:events:390:28) {
  errno: -24,
  syscall: 'open',
  code: 'EMFILE',
  path: '/root/.config/UA Cyber SHIELD/config.json'
}
Error: EMFILE: too many open files, open '/root/.config/UA Cyber SHIELD/config.json'
    at Object.openSync (node:fs:585:3)
    at Object.func [as openSync] (node:electron/js2c/asar_bundle:5:1812)
    at Object.readFileSync (node:fs:453:35)
    at Object.e.readFileSync (node:electron/js2c/asar_bundle:5:9160)
    at ElectronStore.get store [as store] (/tmp/.mount_uashied3We2N/resources/app.asar/node_modules/conf/dist/source/index.js:276:29)
    at ElectronStore.set (/tmp/.mount_uashied3We2N/resources/app.asar/node_modules/conf/dist/source/index.js:170:17)
    at IpcMainImpl.<anonymous> (/tmp/.mount_uashied3We2N/resources/app.asar/electron-main.js:34:13190)
    at IpcMainImpl.emit (node:events:390:28)
    at EventEmitter.<anonymous> (node:electron/js2c/browser_init:161:10120)
    at EventEmitter.emit (node:events:390:28) {
  errno: -24,
  syscall: 'open',
  code: 'EMFILE',
  path: '/root/.config/UA Cyber SHIELD/config.json'
}
Error: EMFILE: too many open files, open '/root/.config/UA Cyber SHIELD/config.json'
    at Object.openSync (node:fs:585:3)
    at Object.func [as openSync] (node:electron/js2c/asar_bundle:5:1812)
    at Object.readFileSync (node:fs:453:35)
    at Object.e.readFileSync (node:electron/js2c/asar_bundle:5:9160)
    at ElectronStore.get store [as store] (/tmp/.mount_uashied3We2N/resources/app.asar/node_modules/conf/dist/source/index.js:276:29)
    at ElectronStore.set (/tmp/.mount_uashied3We2N/resources/app.asar/node_modules/conf/dist/source/index.js:170:17)
    at IpcMainImpl.<anonymous> (/tmp/.mount_uashied3We2N/resources/app.asar/electron-main.js:34:13190)
    at IpcMainImpl.emit (node:events:390:28)
    at EventEmitter.<anonymous> (node:electron/js2c/browser_init:161:10120)
    at EventEmitter.emit (node:events:390:28) {
  errno: -24,
  syscall: 'open',
  code: 'EMFILE',
  path: '/root/.config/UA Cyber SHIELD/config.json'
}
Error: EMFILE: too many open files, open '/root/.config/UA Cyber SHIELD/config.json'
    at Object.openSync (node:fs:585:3)
    at Object.func [as openSync] (node:electron/js2c/asar_bundle:5:1812)
    at Object.readFileSync (node:fs:453:35)
    at Object.e.readFileSync (node:electron/js2c/asar_bundle:5:9160)
    at ElectronStore.get store [as store] (/tmp/.mount_uashied3We2N/resources/app.asar/node_modules/conf/dist/source/index.js:276:29)
    at ElectronStore.set (/tmp/.mount_uashied3We2N/resources/app.asar/node_modules/conf/dist/source/index.js:170:17)
    at IpcMainImpl.<anonymous> (/tmp/.mount_uashied3We2N/resources/app.asar/electron-main.js:34:13190)
    at IpcMainImpl.emit (node:events:390:28)
    at EventEmitter.<anonymous> (node:electron/js2c/browser_init:161:10120)
    at EventEmitter.emit (node:events:390:28) {
  errno: -24,
  syscall: 'open',
  code: 'EMFILE',
  path: '/root/.config/UA Cyber SHIELD/config.json'
}
Error: EMFILE: too many open files, open '/root/.config/UA Cyber SHIELD/config.json'
    at Object.openSync (node:fs:585:3)
    at Object.func [as openSync] (node:electron/js2c/asar_bundle:5:1812)
    at Object.readFileSync (node:fs:453:35)
    at Object.e.readFileSync (node:electron/js2c/asar_bundle:5:9160)
    at ElectronStore.get store [as store] (/tmp/.mount_uashied3We2N/resources/app.asar/node_modules/conf/dist/source/index.js:276:29)
    at ElectronStore.set (/tmp/.mount_uashied3We2N/resources/app.asar/node_modules/conf/dist/source/index.js:170:17)
    at IpcMainImpl.<anonymous> (/tmp/.mount_uashied3We2N/resources/app.asar/electron-main.js:34:13190)
    at IpcMainImpl.emit (node:events:390:28)
    at EventEmitter.<anonymous> (node:electron/js2c/browser_init:161:10120)
    at EventEmitter.emit (node:events:390:28) {
  errno: -24,
  syscall: 'open',
  code: 'EMFILE',
  path: '/root/.config/UA Cyber SHIELD/config.json'
}
Error: EMFILE: too many open files, open '/root/.config/UA Cyber SHIELD/config.json'
    at Object.openSync (node:fs:585:3)
    at Object.func [as openSync] (node:electron/js2c/asar_bundle:5:1812)
    at Object.readFileSync (node:fs:453:35)
    at Object.e.readFileSync (node:electron/js2c/asar_bundle:5:9160)
    at ElectronStore.get store [as store] (/tmp/.mount_uashied3We2N/resources/app.asar/node_modules/conf/dist/source/index.js:276:29)
    at ElectronStore.set (/tmp/.mount_uashied3We2N/resources/app.asar/node_modules/conf/dist/source/index.js:170:17)
    at IpcMainImpl.<anonymous> (/tmp/.mount_uashied3We2N/resources/app.asar/electron-main.js:34:13190)
    at IpcMainImpl.emit (node:events:390:28)
    at EventEmitter.<anonymous> (node:electron/js2c/browser_init:161:10120)
    at EventEmitter.emit (node:events:390:28) {
  errno: -24,
  syscall: 'open',
  code: 'EMFILE',
  path: '/root/.config/UA Cyber SHIELD/config.json'
}
[4481:0503/151725.527400:ERROR:platform_shared_memory_region_posix.cc(250)] Creating shared memory in /dev/shm/.org.chromium.Chromium.qjY8B3 failed: Too many open files (24)
[4481:0503/151729.321989:ERROR:platform_shared_memory_region_posix.cc(250)] Creating shared memory in /dev/shm/.org.chromium.Chromium.mTsMrD failed: Too many open files (24)
pageview
Error: getaddrinfo EMFILE www.google-analytics.com
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26) {
  errno: -24,
  code: 'EMFILE',
  syscall: 'getaddrinfo',
  hostname: 'www.google-analytics.com'
}
[4481:0503/151750.673180:ERROR:platform_shared_memory_region_posix.cc(250)] Creating shared memory in /dev/shm/.org.chromium.Chromium.4juMyV failed: Too many open files (24)
[4481:0503/151801.246013:ERROR:platform_shared_memory_region_posix.cc(250)] Creating shared memory in /dev/shm/.org.chromium.Chromium.mJL8se failed: Too many open files (24)
Failed to load list of external proxy resources. Error code: [EMFILE]
Failed to load list of external targets resources. Error code: [EMFILE]
Failed to load proxy resource https://raw.githubusercontent.com/opengs/uashieldtargets/master/proxy.json. Error: [EMFILE]
Failed to load proxy list. Loaded empty
EMFILE
Failed to load targets list. Received empty list
[4481:0503/151832.740546:ERROR:platform_shared_memory_region_posix.cc(250)] Creating shared memory in /dev/shm/.org.chromium.Chromium.olbcDQ failed: Too many open files (24)
pageview
Error: getaddrinfo EMFILE www.google-analytics.com
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26) {
  errno: -24,
  code: 'EMFILE',
  syscall: 'getaddrinfo',
  hostname: 'www.google-analytics.com'
}
[4481:0503/151939.310454:ERROR:platform_shared_memory_region_posix.cc(250)] Creating shared memory in /dev/shm/.org.chromium.Chromium.7VGIFm failed: Too many open files (24)
[4481:0503/151939.310521:ERROR:platform_shared_memory_region_posix.cc(250)] Creating shared memory in /dev/shm/.org.chromium.Chromium.bnvjGw failed: Too many open files (24)
[4481:0503/151939.310558:ERROR:platform_shared_memory_region_posix.cc(250)] Creating shared memory in /dev/shm/.org.chromium.Chromium.Wkvxxo failed: Too many open files (24)
pageview
Error: getaddrinfo EMFILE www.google-analytics.com
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26) {
  errno: -24,
  code: 'EMFILE',
  syscall: 'getaddrinfo',
  hostname: 'www.google-analytics.com'
}
[4481:0503/152119.508339:ERROR:platform_shared_memory_region_posix.cc(250)] Creating shared memory in /dev/shm/.org.chromium.Chromium.UhowHa failed: Too many open files (24)
[4481:0503/152133.550187:ERROR:platform_shared_memory_region_posix.cc(250)] Creating shared memory in /dev/shm/.org.chromium.Chromium.PuQZzG failed: Too many open files (24)
[4481:0503/152139.014468:ERROR:platform_shared_memory_region_posix.cc(250)] Creating shared memory in /dev/shm/.org.chromium.Chromium.yp8VSZ failed: Too many open files (24)
[4481:0503/152139.014540:ERROR:platform_shared_memory_region_posix.cc(250)] Creating shared memory in /dev/shm/.org.chromium.Chromium.NjhBCI failed: Too many open files (24)
[4481:0503/152149.323256:ERROR:platform_shared_memory_region_posix.cc(250)] Creating shared memory in /dev/shm/.org.chromium.Chromium.47DOGk failed: Too many open files (24)
[4481:0503/152154.990999:ERROR:platform_shared_memory_region_posix.cc(250)] Creating shared memory in /dev/shm/.org.chromium.Chromium.EjQdku failed: Too many open files (24)

...