siyuan-note / siyuan

A privacy-first, self-hosted, fully open source personal knowledge management software, written in typescript and golang.
https://b3log.org/siyuan
GNU Affero General Public License v3.0
18.47k stars 1.38k forks source link

Unable to start on some Linux desktop distributions #9347

Closed Reverier-Xu closed 11 months ago

Reverier-Xu commented 11 months ago

terminated by SIGTRAP in Arch

Is there an existing issue for this?

Can the issue be reproduced with the default theme (daylight/midnight)?

Could the issue be due to extensions?

Describe the problem

在 Arch 上使用 2.10.8 的 AppImage 版本会直接退出:

$ /opt/appimages/siyuan.AppImage
xdg-mime: application argument missing
Try 'xdg-mime --help' for more information.
bash: Job 1, '/opt/appimages/siyuan.AppImage' terminated by signal SIGTRAP (Trace or breakpoint trap)

2.10.7 版本是正常的。

Expected result

正常运行

Screenshot or screen recording presentation

No response

Version environment

- Version: 2.10.8
- Operating System: Arch Linux

Log file

No new logs after crashing

More information

No response

88250 commented 11 months ago

应该和 Electron 版本有关系,关联 https://github.com/siyuan-note/siyuan/issues/9342

88250 commented 11 months ago

https://github.com/siyuan-note/siyuan/issues/9342#issuecomment-1750764272 https://github.com/siyuan-note/siyuan/issues/9342#issuecomment-1750799267

88250 commented 11 months ago

暂时通过降级 Electron 解决,后续要考虑 remote 的替代方案。

88250 commented 11 months ago

最后定位到是 main.js 中电源处理代码的问题,Linux 端升级 Electron 26 以后电源相关事件必须放在 whenReady 里面,否则会导致 Trace/breakpoint trap (core dumped)

ProgramFan commented 11 months ago

仍然有问题:现在能启动了,闪屏结束后进入上一次的笔记的编辑界面,5秒以后白屏,终端输出如下:

./siyuan
got kernel port [33813]
ui version [2.10.8], booting kernel [/home/zyang/.local/opt/siyuan-2.10.8-linux/resources/kernel/SiYuan-Kernel --port 33813 --wd /home/zyang/.local/opt/siyuan-2.10.8-linux/resources]
booted kernel process [pid=5754, port=33813]
checking kernel version
got kernel version [2.10.8]
network proxy [system]
[5736:1009/220525.967009:ERROR:gl_surface_presentation_helper.cc(260)] GetVSyncParametersIfAvailable() failed for 1 times!
[5736:1009/220529.870255:ERROR:gl_surface_presentation_helper.cc(260)] GetVSyncParametersIfAvailable() failed for 2 times!
Error sending from webFrameMain:  Error: Render frame was disposed before WebFrameMain could be accessed
    at WebFrameMain.send (node:electron/js2c/browser_init:2:94576)
    at WebContents.send (node:electron/js2c/browser_init:2:79721)
    at BrowserWindow.<anonymous> (/home/zyang/.local/opt/siyuan-2.10.8-linux/resources/app/electron/main.js:708:26)
    at BrowserWindow.emit (node:events:525:35)
[5736:1009/220535.409612:ERROR:gl_surface_presentation_helper.cc(260)] GetVSyncParametersIfAvailable() failed for 3 times!
88250 commented 11 months ago

@ProgramFan 你那里使用了插件吗?

ProgramFan commented 11 months ago

有插件

88250 commented 11 months ago

请帮忙测试一下在没有插件的新工作空间能否重现问题。

ProgramFan commented 11 months ago
got kernel port [33543]
ui version [2.10.8], booting kernel [/home/zyang/.local/opt/siyuan-2.10.8-linux/resources/kernel/SiYuan-Kernel --port 33543 --wd /home/zyang/.local/opt/siyuan-2.10.8-linux/resources]
booted kernel process [pid=10068, port=33543]
checking kernel version
get kernel version failed: net::ERR_CONNECTION_REFUSED
got kernel version [2.10.8]
network proxy [system]
Error sending from webFrameMain:  Error: Render frame was disposed before WebFrameMain could be accessed
    at WebFrameMain.send (node:electron/js2c/browser_init:2:94576)
    at WebContents.send (node:electron/js2c/browser_init:2:79721)
    at BrowserWindow.<anonymous> (/home/zyang/.local/opt/siyuan-2.10.8-linux/resources/app/electron/main.js:708:26)
    at BrowserWindow.emit (node:events:525:35)
[10051:1009/221851.801555:ERROR:gl_surface_presentation_helper.cc(260)] GetVSyncParametersIfAvailable() failed for 1 times!
Error sending from webFrameMain:  Error: Render frame was disposed before WebFrameMain could be accessed
    at WebFrameMain.send (node:electron/js2c/browser_init:2:94576)
    at WebContents.send (node:electron/js2c/browser_init:2:79721)
    at BrowserWindow.<anonymous> (/home/zyang/.local/opt/siyuan-2.10.8-linux/resources/app/electron/main.js:705:26)
    at BrowserWindow.emit (node:events:525:35)
Error sending from webFrameMain:  Error: Render frame was disposed before WebFrameMain could be accessed
    at WebFrameMain.send (node:electron/js2c/browser_init:2:94576)
    at WebContents.send (node:electron/js2c/browser_init:2:79721)
    at BrowserWindow.<anonymous> (/home/zyang/.local/opt/siyuan-2.10.8-linux/resources/app/electron/main.js:708:26)
    at BrowserWindow.emit (node:events:525:35)
[10051:1009/221858.548445:ERROR:gl_surface_presentation_helper.cc(260)] GetVSyncParametersIfAvailable() failed for 2 times!
ProgramFan commented 11 months ago

一样的情况,也是闪屏过后2秒就白屏了

ProgramFan commented 11 months ago

测试了全新工作空间,删除原工作空间等情形,结果和上面都一样,时间长度不一样。

88250 commented 11 months ago

我这里用 Ubuntu 22 虚拟机测试正常,感觉可能是这个问题 https://github.com/electron/electron/issues/32760

ProgramFan commented 11 months ago

我在 Wayland 和 X11 两种情况下测试,结果都一样。主要错误在于:

Error sending from webFrameMain:  Error: Render frame was disposed before WebFrameMain could be accessed
    at WebFrameMain.send (node:electron/js2c/browser_init:2:94576)
    at WebContents.send (node:electron/js2c/browser_init:2:79721)
    at BrowserWindow.<anonymous> (/home/zyang/.local/opt/siyuan-2.10.8-linux/resources/app/electron/main.js:708:26)
    at BrowserWindow.emit (node:events:525:35)
Error sending from webFrameMain:  Error: Render frame was disposed before WebFrameMain could be accessed
    at WebFrameMain.send (node:electron/js2c/browser_init:2:94576)
    at WebContents.send (node:electron/js2c/browser_init:2:79721)
    at BrowserWindow.<anonymous> (/home/zyang/.local/opt/siyuan-2.10.8-linux/resources/app/electron/main.js:705:26)
    at BrowserWindow.emit (node:events:525:35)
Error sending from webFrameMain:  Error: Render frame was disposed before WebFrameMain could be accessed
    at WebFrameMain.send (node:electron/js2c/browser_init:2:94576)
    at WebContents.send (node:electron/js2c/browser_init:2:79721)
    at BrowserWindow.<anonymous> (/home/zyang/.local/opt/siyuan-2.10.8-linux/resources/app/electron/main.js:708:26)
    at BrowserWindow.emit (node:events:525:35)
Error sending from webFrameMain:  Error: Render frame was disposed before WebFrameMain could be accessed
    at WebFrameMain.send (node:electron/js2c/browser_init:2:94576)
    at WebContents.send (node:electron/js2c/browser_init:2:79721)
    at BrowserWindow.<anonymous> (/home/zyang/.local/opt/siyuan-2.10.8-linux/resources/app/electron/main.js:705:26)
    at BrowserWindow.emit (node:events:525:35)
Error sending from webFrameMain:  Error: Render frame was disposed before WebFrameMain could be accessed
    at WebFrameMain.send (node:electron/js2c/browser_init:2:94576)
    at WebContents.send (node:electron/js2c/browser_init:2:79721)
    at BrowserWindow.<anonymous> (/home/zyang/.local/opt/siyuan-2.10.8-linux/resources/app/electron/main.js:708:26)
    at BrowserWindow.emit (node:events:525:35)
Error sending from webFrameMain:  Error: Render frame was disposed before WebFrameMain could be accessed
    at WebFrameMain.send (node:electron/js2c/browser_init:2:94576)
    at WebContents.send (node:electron/js2c/browser_init:2:79721)
    at BrowserWindow.<anonymous> (/home/zyang/.local/opt/siyuan-2.10.8-linux/resources/app/electron/main.js:705:26)
    at BrowserWindow.emit (node:events:525:35)
Error sending from webFrameMain:  Error: Render frame was disposed before WebFrameMain could be accessed
    at WebFrameMain.send (node:electron/js2c/browser_init:2:94576)
    at WebContents.send (node:electron/js2c/browser_init:2:79721)
    at BrowserWindow.<anonymous> (/home/zyang/.local/opt/siyuan-2.10.8-linux/resources/app/electron/main.js:708:26)
    at BrowserWindow.emit (node:events:525:35)
ProgramFan commented 11 months ago

ChatGPT 的看法:

The error message "Error sending from webFrameMain: Error: Render frame was disposed before WebFrameMain could be accessed" indicates a timing or state issue within an Electron application. Here's a breakdown of what each part means:

Error sending from webFrameMain: The error is occurring when trying to send a message from the main process to the renderer process via Electron's WebFrameMain API.

Render frame was disposed before WebFrameMain could be accessed: This is the core issue. It suggests that the renderer frame (essentially, a web page within your Electron application) has been closed, navigated away from, or otherwise disposed of before the main process could perform an operation on it via WebFrameMain.

The following lines provide a stack trace, indicating where in the code the issue occurred.

Here are some common reasons why this could happen:

Navigating Away: If the web page in the renderer process is navigated away from or refreshed, the frame would be disposed of.

Closing or Reloading the Window: If the Electron BrowserWindow is closed or reloaded, the render frame will be disposed of.

Race Condition: Your code might be running asynchronously, and you're trying to perform an operation on the render frame after it's already been disposed of but before your code is aware of that.

Debugging Steps Check Object Lifecycles: Make sure you're not accidentally disposing of the render frame by closing a window, navigating away, or refreshing the page.

Review Asynchronous Code: If you're making asynchronous calls, use appropriate checks or hooks to ensure that the frame still exists when your code runs.

Error Handling: Incorporate try-catch blocks or promise-based error handling to catch such exceptions and handle them gracefully.

Event Listening: Listen for events like 'closed' on the BrowserWindow object or other events that indicate a change in frame status, and prevent or queue up actions accordingly.

Check API Documentation: Ensure that you are using Electron's WebFrameMain and other related APIs correctly.

This should give you a good starting point for debugging the issue.

ProgramFan commented 11 months ago

目前 2.10.7 一切正常,我有办法能测试一下其他版本的 Electron 吗?

88250 commented 11 months ago

目前 main.js 改动有点多,我们现在再编译一个 dev 版看看。

要测试其他版本只能手动编译打包,scripts/linux-build.sh

88250 commented 11 months ago

正在编译 https://github.com/siyuan-note/siyuan/actions/runs/6458185058

ProgramFan commented 11 months ago

错误依旧,无变化。

88250 commented 11 months ago

稍等我们降级一下 Electron 再测测看。

88250 commented 11 months ago

https://github.com/siyuan-note/siyuan/actions/runs/6458468143

ProgramFan commented 11 months ago

新版本工作正常。

88250 commented 11 months ago

好的,多谢帮忙测试,晚安了,老铁。

---Original--- From: @.> Date: Mon, Oct 9, 2023 23:42 PM To: @.>; Cc: @.>;"State @.>; Subject: Re: [siyuan-note/siyuan] Unable to start on some Linux desktopdistributions (Issue #9347)

新版本工作正常。

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>

88250 commented 10 months ago

下个版本我们计划升级到 Electron v27.1.0,可能还会导致这个问题,麻烦看到的老铁帮忙测试。

如果有问题,请到 https://github.com/siyuan-note/siyuan/issues/9705 中反馈,谢谢。

ProgramFan commented 10 months ago

发布可用版本后第一时间测试。

ProgramFan commented 10 months ago

27.1.0 正常。