I'm actually struggling with some thread problems. I have few errors when I run a node scraper with Puppeteer inside a Docker.
Scrape::response() -> Code: 0, error: Error: Failed to launch the browser process!
,[0427/125747.260079:WARNING:dns_config_service_posix.cc(341)] Failed to read DnsConfig.
,[0427/125747.264174:ERROR:platform_thread_posix.cc(129)] pthread_create: Resource temporarily unavailable (11)
,[0427/125747.264480:ERROR:platform_thread_posix.cc(129)] pthread_create: Resource temporarily unavailable (11)
,[0427/125747.269387:ERROR:platform_thread_posix.cc(129)] pthread_create: Resource temporarily unavailable (11)
,[0427/125747.287338:ERROR:platform_thread_posix.cc(129)] pthread_create: Resource temporarily unavailable (11)
,[0427/125747.270779:ERROR:platform_thread_posix.cc(129)] pthread_create: Resource temporarily unavailable (11)
,[0427/125747.287379:FATAL:backend_impl.cc(120)] Check failed: StartWithOptions(base::Thread::Options(base::MessagePumpType::IO, 0)).
,Received signal 6
, r12: 00005610d5ebf038 r13: 00007f7a814fb040 r14: 00007f7a814fae30 r15: 0000000000000085
, r8: 00007f7a814fa9b4 r9: 00005610d5ec1c20 r10: 0000000000000008 r11: 0000000000000246
, di: 0000000000000002 si: 00007f7a814fa880 bp: 00007f7a814fa880 bx: 0000000000000000
, dx: 0000000000000000 ax: 0000000000000000 cx: 00007f7a8965c9e2 sp: 00007f7a814fa878
, ip: 00007f7a8965c9e2 efl: 0000000000000246 cgf: 002b000000000033 erf: 0000000000000000
, trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000
,[end of stack trace]
,Calling _exit(1). Core file will not be generated.
,TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md
, at onClose (/opt/src/node_modules/puppeteer/lib/Launcher.js:750:14)
, at ChildProcess.helper.addEventListener (/opt/src/node_modules/puppeteer/lib/Launcher.js:740:61)
, at ChildProcess.emit (events.js:203:15)
, at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
Here's what is displayed when I execute ulimit -a
:
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 1048576
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1048576
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 1048576
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
The result of ps -elfT | wc -l
ps -elfT | wc -l
is 1331 And cat /proc/sys/kernel/threads-max
returns me 100000.
Here's how I run my my docker, I used some limitation.
sh "sudo docker build -f Dockerfile-scraping --build-arg port=${PORT} -t ${DEPLOY_ENV} ."
sh "sudo docker run --pids-limit 100 -m 10G -d -t -p ${PORT}:${PORT} ${DEPLOY_ENV}"
I'm using puppeteer@2.1.0 and my server version is Debian9 .
Another application had thread leaks that were causing OutOfMemory
and pthread_create: Resource temporarily unavailable (11)
errors on the application I was using.
I saw this by using the command docker stats
; an application was using like 20k threads and around 30 per seconds.
I hope it could help someone.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.