'chromedp failed to start, read: connection reset by peer
My golang program using chromedp to fetch data from other website. The program is running for 2 weeks and everything looks fine. But all of sudden, it starts failed with the error message "connection reset by peer"
I run the docker image on local container and it also works. Not sure what is going on?
Below are the logs I took from the AWS cloudwatch.
2021-10-23T14:06:04.158+11:00 could not dial "ws://127.0.0.1:33355/devtools/browser/39d9dcb9-3f16-41a3-b280-4a5a6f514b65": read tcp 127.0.0.1:44026->127.0.0.1:33355: read: connection reset by peer
2021-10-23T14:06:08.615+11:00 RetrieveNewsAgain
2021-10-23T14:06:10.143+11:00 context canceled
2021-10-23T14:06:13.604+11:00 RetrieveNewsAgain
2021-10-23T14:06:14.423+11:00 context canceled
2021-10-23T14:06:17.127+11:00 load error, return
2021-10-23T14:06:17.127+11:00 Start GetNewsViaCrawlFromNews_2
2021-10-23T14:06:17.941+11:00 could not dial "ws://127.0.0.1:43919/devtools/browser/208ca3a5-05f3-4aa3-960b-d2cd7214c271": EOF
2021-10-23T14:06:20.648+11:00 RetrieveNewsAgain
2021-10-23T14:06:21.351+11:00 chrome failed to start:
2021-10-23T14:06:21.351+11:00 [1023/140620.658504:WARNING:resource_bundle.cc(403)] locale_file_path.empty() for locale
2021-10-23T14:06:21.351+11:00 [1023/140620.669605:WARNING:resource_bundle.cc(403)] locale_file_path.empty() for locale
2021-10-23T14:06:21.351+11:00 [1023/140620.674715:WARNING:resource_bundle.cc(403)] locale_file_path.empty() for locale
2021-10-23T14:06:21.351+11:00 [1023/140620.675904:ERROR:power_monitor_device_source_stub.cc(11)] Not implemented reached in virtual bool base::PowerMonitorDeviceSource::IsOnBatteryPower()
2021-10-23T14:06:21.351+11:00 [1023/140620.676378:INFO:content_main_runner_impl.cc(1100)] Chrome is running in full browser mode.
2021-10-23T14:06:21.351+11:00 [1023/140620.682206:ERROR:platform_thread_posix.cc(147)] pthread_create: Resource temporarily unavailable (11)
2021-10-23T14:06:21.351+11:00 [1023/140620.682641:ERROR:platform_thread_posix.cc(147)] pthread_create: Resource temporarily unavailable (11)
2021-10-23T14:06:21.351+11:00 [1023/140620.682663:ERROR:thread.cc(221)] failed to create thread
2021-10-23T14:06:21.351+11:00 [1023/140620.682676:FATAL:media_stream_manager.cc(759)] Check failed: video_capture_thread_->Start().
2021-10-23T14:06:21.351+11:00 #18 0x55a22072eb8d (/headless-shell/headless-shell+0x6715b8c)
2021-10-23T14:06:21.351+11:00 #19 0x7f27695ac09b __libc_start_main
2021-10-23T14:06:21.351+11:00 #20 0x55a21d3b902a _start
2021-10-23T14:06:21.351+11:00 Received signal 6
2021-10-23T14:06:21.351+11:00 #0 0x55a2207faac9 (/headless-shell/headless-shell+0x67e1ac8)
2021-10-23T14:06:21.351+11:00 #1 0x55a220737883 (/headless-shell/headless-shell+0x671e882)
2021-10-23T14:06:21.351+11:00 #2 0x55a2207fa551 (/headless-shell/headless-shell+0x67e1550)
2021-10-23T14:06:21.351+11:00 #3 0x7f2769af8730 (/lib/x86_64-linux-gnu/libpthread-2.28.so+0x1272f)
2021-10-23T14:06:21.351+11:00 #4 0x7f27695bf7bb gsignal
2021-10-23T14:06:21.351+11:00
2021-10-23T14:06:21.351+11:00 #5 0x7f27695aa535 abort
Solution 1:[1]
I guess you have encountered the zombie processes issue. Here are the suggestions copied from https://github.com/chromedp/chromedp/issues/894#issuecomment-892723178:
- (for docker container) specify the init process to reap the zombie processes: https://docs.docker.com/engine/reference/run/#specify-an-init-process
- try to use a single browser instance and create new tabs in it (instead of creating many browser instances)
See the reported issue for more information: https://github.com/chromedp/chromedp/issues/752
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Zeke Lu |