Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chromium DevToolsActivePort file doesn't exist #8

Closed
cssxsh opened this issue Jan 18, 2022 · 11 comments
Closed

Chromium DevToolsActivePort file doesn't exist #8

cssxsh opened this issue Jan 18, 2022 · 11 comments
Assignees
Labels
bug Something isn't working

Comments

@cssxsh
Copy link
Owner

cssxsh commented Jan 18, 2022

2021-12-24 18:27:27 E/bilibili-helper: Exception in coroutine Plugin xyz.cssxsh.mirai.plugin.bilibili-helper of bilibili-helper
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: DevToolsActivePort file doesn't exist
Build info: version: '4.1.0', revision: '87802e897b'
System info: host: 'VM-8-2-ubuntu', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.0-77-generic', java.version: '17.0.1'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [null, newSession {capabilities=[Capabilities {acceptInsecureCerts: true, browserName: chrome, goog:chromeOptions: {args: [--headless, --silent, --hide-scrollbars], excludeSwitches: [enable-automation, ignore-certificate-errors], extensions: [], mobileEmulation: {deviceMetrics: {height: 1024, pixelRatio: 3, width: 768}, userAgent: Mozilla/5.0 (iPad; CPU OS 1...}}, pageLoadStrategy: normal}], desiredCapabilities=Capabilities {acceptInsecureCerts: true, browserName: chrome, goog:chromeOptions: {args: [--headless, --silent, --hide-scrollbars], excludeSwitches: [enable-automation, ignore-certificate-errors], extensions: [], mobileEmulation: {deviceMetrics: {height: 1024, pixelRatio: 3, width: 768}, userAgent: Mozilla/5.0 (iPad; CPU OS 1...}}, pageLoadStrategy: normal}}]
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:84)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:62)
        at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156)
        at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:164)
        at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:139)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:559)
        at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:246)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:168)
        at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:108)
        at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:104)
        at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:91)
        at xyz.cssxsh.selenium.SeleniumInitKt$setupChromeDriver$2.invoke(SeleniumInit.kt:272)
        at xyz.cssxsh.selenium.SeleniumInitKt$setupChromeDriver$2.invoke(SeleniumInit.kt:263)
        at xyz.cssxsh.selenium.SeleniumToolKt.RemoteWebDriver(SeleniumTool.kt:58)
        at xyz.cssxsh.mirai.plugin.MiraiSeleniumPlugin.driver(MiraiSeleniumPlugin.kt:55)
        at xyz.cssxsh.mirai.plugin.BiliUtilsKt$driver$2$driver$1.invokeSuspend(BiliUtils.kt:82)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)


Originally posted by @LaoLittle in #4 (comment)

@cssxsh
Copy link
Owner Author

cssxsh commented Jan 18, 2022

@cloudlinks in #4 (comment)

arguments: --no-sandbox,--disable-dev-shm-usage

arguments 是数组,应该带中括号
arguments: [--no-sandbox, --disable-dev-shm-usage]

@cssxsh cssxsh added the bug Something isn't working label Jan 18, 2022
@cssxsh cssxsh self-assigned this Jan 18, 2022
@cssxsh cssxsh pinned this issue Jan 18, 2022
@cloudlinks
Copy link

更改后报错不变

org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: Chrome failed to start: exited abnormally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '4.1.1', revision: 'e8fcc2cecf'
System info: host: 'iZ8vb7u69g9j7k4l0tgkvnZ', ip: '172.23.70.22', os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.0-92-generic', java.version: '11.0.13'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [null, newSession {capabilities=[Capabilities {acceptInsecureCerts: true, browserName: chrome, goog:chromeOptions: {args: [--headless, --silent, --hide-scrollbars], excludeSwitches: [enable-automation, ignore-certificate-errors], extensions: [], mobileEmulation: {deviceMetrics: {height: 1024, pixelRatio: 3, width: 768}, userAgent: Mozilla/5.0 (Macintosh; U; ...}}, pageLoadStrategy: normal}], desiredCapabilities=Capabilities {acceptInsecureCerts: true, browserName: chrome, goog:chromeOptions: {args: [--headless, --silent, --hide-scrollbars], excludeSwitches: [enable-automation, ignore-certificate-errors], extensions: [], mobileEmulation: {deviceMetrics: {height: 1024, pixelRatio: 3, width: 768}, userAgent: Mozilla/5.0 (Macintosh; U; ...}}, pageLoadStrategy: normal}}]

对应的配置文件为:


# 截图UA
user_agent: 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50'
# 截图宽度
width: 768
# 截图高度
height: 1024
# 截图像素比
pixel_ratio: 3
# 无头模式(后台模式)
headless: true
# 代理地址
proxy: ''
# 启用日志文件
log: true
# 指定使用的浏览器,Chrome/Chromium/Firefox/Edge
browser: Chromium
# 指定使用的Factory
factory: ktor
#自定义解决兼容性问题
arguments: [--no-sandbox, --disable-dev-shm-usage]
expires: 7

@cssxsh
Copy link
Owner Author

cssxsh commented Jan 18, 2022

更改后报错不变

org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: Chrome failed to start: exited abnormally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '4.1.1', revision: 'e8fcc2cecf'
System info: host: 'iZ8vb7u69g9j7k4l0tgkvnZ', ip: '172.23.70.22', os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.0-92-generic', java.version: '11.0.13'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [null, newSession {capabilities=[Capabilities {acceptInsecureCerts: true, browserName: chrome, goog:chromeOptions: {args: [--headless, --silent, --hide-scrollbars], excludeSwitches: [enable-automation, ignore-certificate-errors], extensions: [], mobileEmulation: {deviceMetrics: {height: 1024, pixelRatio: 3, width: 768}, userAgent: Mozilla/5.0 (Macintosh; U; ...}}, pageLoadStrategy: normal}], desiredCapabilities=Capabilities {acceptInsecureCerts: true, browserName: chrome, goog:chromeOptions: {args: [--headless, --silent, --hide-scrollbars], excludeSwitches: [enable-automation, ignore-certificate-errors], extensions: [], mobileEmulation: {deviceMetrics: {height: 1024, pixelRatio: 3, width: 768}, userAgent: Mozilla/5.0 (Macintosh; U; ...}}, pageLoadStrategy: normal}}]

对应的配置文件为:


# 截图UA
user_agent: 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50'
# 截图宽度
width: 768
# 截图高度
height: 1024
# 截图像素比
pixel_ratio: 3
# 无头模式(后台模式)
headless: true
# 代理地址
proxy: ''
# 启用日志文件
log: true
# 指定使用的浏览器,Chrome/Chromium/Firefox/Edge
browser: Chromium
# 指定使用的Factory
factory: ktor
#自定义解决兼容性问题
arguments: [--no-sandbox, --disable-dev-shm-usage]
expires: 7

arguments 没有生效, 2.0.2 尝试修复

@cssxsh
Copy link
Owner Author

cssxsh commented Feb 4, 2022

@cssxsh
Copy link
Owner Author

cssxsh commented Feb 13, 2022

有使用者反应可以安装 xorg-x11-server-Xvfb 解决

@xiaojiedev
Copy link

xiaojiedev commented Mar 11, 2022

我也遇到此问题,而且issues #4 和本页面的信息都没有帮助我解决问题。可以帮我看看有什么不同吗?

2022-03-11 20:49:59 W/bilibili-helper: 获取动态636360719944646678快照失败
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: Chrome failed to start: exited abnormally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /root/mirai/data/xyz.cssxsh.mirai.plugin.mirai-selenium-plugin/Chromium-v99.0.4844.65-r961656-portable-ungoogled-Lin64/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '4.1.2', revision: '9a5a329c5a'
System info: host: 'C20220311002354', ip: '172.16.0.29', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-1160.59.1.el7.x86_64', java.version: '16.0.2'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [null, newSession {capabilities=[Capabilities {acceptInsecureCerts: true, browserName: chrome, goog:chromeOptions: {args: [--headless, --silent, --hide-scrollbars, --user-agent=Mozilla/5.0 (i..., --window-size=768,1024, --no-sandbox, --disable-dev-shm-usage], binary: /root/mirai/data/xyz.cssxsh..., excludeSwitches: [enable-automation, ignore-certificate-errors], extensions: [], prefs: {}}, pageLoadStrategy: normal}], desiredCapabilities=Capabilities {acceptInsecureCerts: true, browserName: chrome, goog:chromeOptions: {args: [--headless, --silent, --hide-scrollbars, --user-agent=Mozilla/5.0 (i..., --window-size=768,1024, --no-sandbox, --disable-dev-shm-usage], binary: /root/mirai/data/xyz.cssxsh..., excludeSwitches: [enable-automation, ignore-certificate-errors], extensions: [], prefs: {}}, pageLoadStrategy: normal}}]
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:84)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:62)
        at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156)
        at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:167)
        at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:142)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:558)
        at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:245)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:161)
        at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:108)
        at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:106)
        at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:93)
        at xyz.cssxsh.selenium.SeleniumInitKt$setupChromeDriver$2.invoke(SeleniumInit.kt:400)
        at xyz.cssxsh.selenium.SeleniumInitKt$setupChromeDriver$2.invoke(SeleniumInit.kt:380)
        at xyz.cssxsh.selenium.SeleniumToolKt.RemoteWebDriver(SeleniumTool.kt:78)
        at xyz.cssxsh.mirai.plugin.BiliUtilsKt.screenshot(BiliUtils.kt:364)
        at xyz.cssxsh.mirai.plugin.BiliUtilsKt.screenshot(BiliUtils.kt:227)
        at xyz.cssxsh.mirai.plugin.BiliUtilsKt.screenshot$default(BiliUtils.kt:225)
        at xyz.cssxsh.mirai.plugin.BiliContentKt.screenshot(BiliContent.kt:71)
        at xyz.cssxsh.mirai.plugin.BiliContentKt.content(BiliContent.kt:25)
        at xyz.cssxsh.mirai.plugin.BiliDynamicLoader.build(BiliTasker.kt:251)
        at xyz.cssxsh.mirai.plugin.BiliDynamicLoader.build(BiliTasker.kt:236)
        at xyz.cssxsh.mirai.plugin.AbstractTasker$send$1$1.invokeSuspend(BiliTasker.kt:75)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:39)
        at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

配置文件

# 驱动文件过期时间,默认一星期 (单位:天)
expires: 7
# 清理浏览器驱动,默认30 (单位:分钟)
destroy: 30
# 截图UA
user_agent: 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1'
# 截图宽度
width: 768
# 截图高度
height: 1024
# 无头模式(后台模式)
headless: true
# 代理地址
proxy: ''
# User Preferences
preferences: {}

# 启用日志文件
log: true
# 指定使用的浏览器,Chrome/Chromium/Firefox/Edge
browser: 'Chromium'
# 指定使用的Factory
factory: ktor
# 自定义 arguments
arguments: [--no-sandbox, --disable-dev-shm-usage]

VPS是2Core - 2GB RAM的,运行mirai后内存占用660M/1.8G。程序都是以ROOT用户运行的。
刚开始试过Firefox63、80、98,报错Process unexpectedly closed with status 255,百度上的方法无法解决,然后我就转用chromium了,得到以上错误,能帮看的话不胜感激!

@cssxsh
Copy link
Owner Author

cssxsh commented Mar 29, 2022

我也遇到此问题,而且issues #4 和本页面的信息都没有帮助我解决问题。可以帮我看看有什么不同吗?

2022-03-11 20:49:59 W/bilibili-helper: 获取动态636360719944646678快照失败
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: Chrome failed to start: exited abnormally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /root/mirai/data/xyz.cssxsh.mirai.plugin.mirai-selenium-plugin/Chromium-v99.0.4844.65-r961656-portable-ungoogled-Lin64/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '4.1.2', revision: '9a5a329c5a'
System info: host: 'C20220311002354', ip: '172.16.0.29', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-1160.59.1.el7.x86_64', java.version: '16.0.2'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [null, newSession {capabilities=[Capabilities {acceptInsecureCerts: true, browserName: chrome, goog:chromeOptions: {args: [--headless, --silent, --hide-scrollbars, --user-agent=Mozilla/5.0 (i..., --window-size=768,1024, --no-sandbox, --disable-dev-shm-usage], binary: /root/mirai/data/xyz.cssxsh..., excludeSwitches: [enable-automation, ignore-certificate-errors], extensions: [], prefs: {}}, pageLoadStrategy: normal}], desiredCapabilities=Capabilities {acceptInsecureCerts: true, browserName: chrome, goog:chromeOptions: {args: [--headless, --silent, --hide-scrollbars, --user-agent=Mozilla/5.0 (i..., --window-size=768,1024, --no-sandbox, --disable-dev-shm-usage], binary: /root/mirai/data/xyz.cssxsh..., excludeSwitches: [enable-automation, ignore-certificate-errors], extensions: [], prefs: {}}, pageLoadStrategy: normal}}]
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:84)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:62)
        at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156)
        at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:167)
        at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:142)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:558)
        at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:245)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:161)
        at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:108)
        at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:106)
        at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:93)
        at xyz.cssxsh.selenium.SeleniumInitKt$setupChromeDriver$2.invoke(SeleniumInit.kt:400)
        at xyz.cssxsh.selenium.SeleniumInitKt$setupChromeDriver$2.invoke(SeleniumInit.kt:380)
        at xyz.cssxsh.selenium.SeleniumToolKt.RemoteWebDriver(SeleniumTool.kt:78)
        at xyz.cssxsh.mirai.plugin.BiliUtilsKt.screenshot(BiliUtils.kt:364)
        at xyz.cssxsh.mirai.plugin.BiliUtilsKt.screenshot(BiliUtils.kt:227)
        at xyz.cssxsh.mirai.plugin.BiliUtilsKt.screenshot$default(BiliUtils.kt:225)
        at xyz.cssxsh.mirai.plugin.BiliContentKt.screenshot(BiliContent.kt:71)
        at xyz.cssxsh.mirai.plugin.BiliContentKt.content(BiliContent.kt:25)
        at xyz.cssxsh.mirai.plugin.BiliDynamicLoader.build(BiliTasker.kt:251)
        at xyz.cssxsh.mirai.plugin.BiliDynamicLoader.build(BiliTasker.kt:236)
        at xyz.cssxsh.mirai.plugin.AbstractTasker$send$1$1.invokeSuspend(BiliTasker.kt:75)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:39)
        at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

配置文件

# 驱动文件过期时间,默认一星期 (单位:天)
expires: 7
# 清理浏览器驱动,默认30 (单位:分钟)
destroy: 30
# 截图UA
user_agent: 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1'
# 截图宽度
width: 768
# 截图高度
height: 1024
# 无头模式(后台模式)
headless: true
# 代理地址
proxy: ''
# User Preferences
preferences: {}

# 启用日志文件
log: true
# 指定使用的浏览器,Chrome/Chromium/Firefox/Edge
browser: 'Chromium'
# 指定使用的Factory
factory: ktor
# 自定义 arguments
arguments: [--no-sandbox, --disable-dev-shm-usage]

VPS是2Core - 2GB RAM的,运行mirai后内存占用660M/1.8G。程序都是以ROOT用户运行的。 刚开始试过Firefox63、80、98,报错Process unexpectedly closed with status 255,百度上的方法无法解决,然后我就转用chromium了,得到以上错误,能帮看的话不胜感激!

就结果来看,进程一启动就自动退出了,你可以尝试 打开 MiraiSeleniumConfig.yml 里的 log 配置,以获取 驱动进程 日志

@cssxsh
Copy link
Owner Author

cssxsh commented Jun 2, 2022

我也遇到此问题,而且issues #4 和本页面的信息都没有帮助我解决问题。可以帮我看看有什么不同吗?

2022-03-11 20:49:59 W/bilibili-helper: 获取动态636360719944646678快照失败
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: Chrome failed to start: exited abnormally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /root/mirai/data/xyz.cssxsh.mirai.plugin.mirai-selenium-plugin/Chromium-v99.0.4844.65-r961656-portable-ungoogled-Lin64/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Build info: version: '4.1.2', revision: '9a5a329c5a'
System info: host: 'C20220311002354', ip: '172.16.0.29', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-1160.59.1.el7.x86_64', java.version: '16.0.2'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Command: [null, newSession {capabilities=[Capabilities {acceptInsecureCerts: true, browserName: chrome, goog:chromeOptions: {args: [--headless, --silent, --hide-scrollbars, --user-agent=Mozilla/5.0 (i..., --window-size=768,1024, --no-sandbox, --disable-dev-shm-usage], binary: /root/mirai/data/xyz.cssxsh..., excludeSwitches: [enable-automation, ignore-certificate-errors], extensions: [], prefs: {}}, pageLoadStrategy: normal}], desiredCapabilities=Capabilities {acceptInsecureCerts: true, browserName: chrome, goog:chromeOptions: {args: [--headless, --silent, --hide-scrollbars, --user-agent=Mozilla/5.0 (i..., --window-size=768,1024, --no-sandbox, --disable-dev-shm-usage], binary: /root/mirai/data/xyz.cssxsh..., excludeSwitches: [enable-automation, ignore-certificate-errors], extensions: [], prefs: {}}, pageLoadStrategy: normal}}]
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:84)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:62)
        at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156)
        at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:167)
        at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:142)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:558)
        at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:245)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:161)
        at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:108)
        at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:106)
        at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:93)
        at xyz.cssxsh.selenium.SeleniumInitKt$setupChromeDriver$2.invoke(SeleniumInit.kt:400)
        at xyz.cssxsh.selenium.SeleniumInitKt$setupChromeDriver$2.invoke(SeleniumInit.kt:380)
        at xyz.cssxsh.selenium.SeleniumToolKt.RemoteWebDriver(SeleniumTool.kt:78)
        at xyz.cssxsh.mirai.plugin.BiliUtilsKt.screenshot(BiliUtils.kt:364)
        at xyz.cssxsh.mirai.plugin.BiliUtilsKt.screenshot(BiliUtils.kt:227)
        at xyz.cssxsh.mirai.plugin.BiliUtilsKt.screenshot$default(BiliUtils.kt:225)
        at xyz.cssxsh.mirai.plugin.BiliContentKt.screenshot(BiliContent.kt:71)
        at xyz.cssxsh.mirai.plugin.BiliContentKt.content(BiliContent.kt:25)
        at xyz.cssxsh.mirai.plugin.BiliDynamicLoader.build(BiliTasker.kt:251)
        at xyz.cssxsh.mirai.plugin.BiliDynamicLoader.build(BiliTasker.kt:236)
        at xyz.cssxsh.mirai.plugin.AbstractTasker$send$1$1.invokeSuspend(BiliTasker.kt:75)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:39)
        at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

配置文件

# 驱动文件过期时间,默认一星期 (单位:天)
expires: 7
# 清理浏览器驱动,默认30 (单位:分钟)
destroy: 30
# 截图UA
user_agent: 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1'
# 截图宽度
width: 768
# 截图高度
height: 1024
# 无头模式(后台模式)
headless: true
# 代理地址
proxy: ''
# User Preferences
preferences: {}

# 启用日志文件
log: true
# 指定使用的浏览器,Chrome/Chromium/Firefox/Edge
browser: 'Chromium'
# 指定使用的Factory
factory: ktor
# 自定义 arguments
arguments: [--no-sandbox, --disable-dev-shm-usage]

VPS是2Core - 2GB RAM的,运行mirai后内存占用660M/1.8G。程序都是以ROOT用户运行的。 刚开始试过Firefox63、80、98,报错Process unexpectedly closed with status 255,百度上的方法无法解决,然后我就转用chromium了,得到以上错误,能帮看的话不胜感激!

试试 https://stackoverflow.com/questions/67090130
sudo apt-get install -y wget bzip2 libxtst6 packagekit-gtk3-module libx11-xcb-dev libdbus-glib-1-2 libxt6 libpci-dev

@cssxsh
Copy link
Owner Author

cssxsh commented Jul 6, 2022

github actions 测试是通过了的 (root 模式)

https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md#installed-apt-packages

这个文档里 有已安装的包列表,你可以对比看看是不是缺少了什么

@cssxsh cssxsh unpinned this issue Jul 21, 2022
@cssxsh cssxsh pinned this issue Jul 21, 2022
@Dream-Rainy
Copy link

今天也遇到了相似的问题,然后发现Chromium打不开了(闪退),重新安装Chrome后问题解决
可以做个参考
系统:Ubuntu 22.04.1 LTS
java版本:

openjdk 18.0.2 2022-07-19
OpenJDK Runtime Environment Zulu18.32+11-CA (build 18.0.2+9)
OpenJDK 64-Bit Server VM Zulu18.32+11-CA (build 18.0.2+9, mixed mode, sharing)

Chrome版本:104.0.5112.79(Official Build)(64-bit)
配置文件:

#驱动文件过期时间,默认一星期 (单位:天)
expires: 7
#清理浏览器驱动,默认30 (单位:分钟)
destroy: 30
#截图UA
user_agent: 'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1'
#截图宽度
width: 768
#截图高度
height: 1024
#无头模式(后台模式)
headless: true
#代理地址
proxy: ''
#User Preferences
preferences: {}
#启用日志文件
log: false
#指定使用的浏览器,Chrome/Chromium/Firefox/Edge
browser: 'Chrome'
#指定使用的Factory
factory: netty
#自定义 arguments
arguments: [--no-sandbox, --disable-dev-shm-usage]

@cssxsh
Copy link
Owner Author

cssxsh commented Jan 24, 2023

目前以经验来看
这是由于 X11 端口转发导致的问题
使用第三方SSH请自行关闭 X11 端口转发 功能

@cssxsh cssxsh unpinned this issue Jan 24, 2023
@cssxsh cssxsh pinned this issue Jan 24, 2023
@cssxsh cssxsh closed this as not planned Won't fix, can't repro, duplicate, stale Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 👌
Development

No branches or pull requests

4 participants