AFFiNE icon indicating copy to clipboard operation
AFFiNE copied to clipboard

​Software version 0.14 crashes after opening in Ubuntu system

Open MingStudentSE opened this issue 1 year ago • 12 comments

What happened?

Ubuntu 20.04.6 LTS After I update the version to 0.14.1, I find it crashes after opening. 0.14 is the same.

Distribution version

Linux

What browsers are you seeing the problem on if you're using web version?

No response

Are you self-hosting?

  • [ ] Yes

Relevant log output

No response

Anything else?

No response

MingStudentSE avatar May 08 '24 02:05 MingStudentSE

Issue Status: 🧑‍💻 To Reproduce

🧑‍💻 To Reproduce

We will try to find the steps needed to reproduce the issue on our side.

This is an automatic reply by the bot.

affine-issue-bot[bot] avatar May 08 '24 02:05 affine-issue-bot[bot]

I did not manage to reproduce on 22.04.4 using affine 0.14.1 stable. Can you try running affine directly from terminal and check the log?

pengx17 avatar May 09 '24 03:05 pengx17

Sure. @pengx17

~/software$ ./affine-0.14.1-stable-linux-x64.appimage 
MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0

15:57:29.316 (main) › [ipc-event] updater:onDownloadProgress [ 0 ]
15:57:29.329 (main) › auto-updater feed config {
  channel: 'stable',
  provider: 'custom',
  repo: 'AFFiNE',
  owner: 'toeverything',
  releaseType: 'release',
  updateProvider: '[function] class extends import_GitHubProvider.BaseGitHubProvider {\n' +
    '      constructor(options, updater, runtimeOptions) {\n' +
    '        super(options, "github.com", runtimeOptions);\n' +
    '        this.updater = updater;\n' +
    '      }\n' +
    '      async getLatestVersion() {\n' +
    '        const cancellationToken = new import_electron_updater.CancellationToken();\n' +
    '        const feedXml = await this.httpRequest(\n' +
    '          newUrlFromBase(`${this.basePath}.atom`, this.baseUrl),\n' +
    '          {\n' +
    '            accept: "application/xml, application/atom+xml, text/xml, */*"\n' +
    '          },\n' +
    '          cancellationToken\n' +
    '        );\n' +
    '        if (!feedXml) {\n' +
    '          throw new Error(\n' +
    '            `Cannot find feed in the remote server (${this.baseUrl.href})`\n' +
    '          );\n' +
    '        }\n' +
    '        const feed = (0, import_builder_util_runtime.parseXml)(feedXml);\n' +
    '        let latestRelease = feed.element(\n' +
    '          "entry",\n' +
    '          false,\n' +
    '          `No published versions on GitHub`\n' +
    '        );\n' +
    '        let tag = null;\n' +
    '        try {\n' +
    '          const currentChannel = this.options.channel || this.updater?.channel || semver.prerelease(this.updater.currentVersion)?.[0] || null;\n' +
    '          if (currentChannel === null) {\n' +
    '            throw (0, import_builder_util_runtime.newError)(\n' +
    '              `Cannot parse channel from version: ${this.updater.currentVersion}`,\n' +
    '              "ERR_UPDATER_INVALID_VERSION"\n' +
    '            );\n' +
    '          }\n' +
    '          const releaseTag = await this.getLatestTagByRelease(\n' +
    '            currentChannel,\n' +
    '            cancellationToken\n' +
    '          );\n' +
    '          for (const element of feed.getElements("entry")) {\n' +
    '            const hrefElement = hrefRegExp.exec(\n' +
    '              element.element("link").attribute("href")\n' +
    '            );\n' +
    '            if (hrefElement === null)\n' +
    '              continue;\n' +
    '            const hrefTag = hrefElement[1];\n' +
    '            const hrefChannel = semver.prerelease(hrefTag)?.[0] || "stable";\n' +
    '            let isNextPreRelease = false;\n' +
    '            if (releaseTag) {\n' +
    '              isNextPreRelease = releaseTag === hrefTag;\n' +
    '            } else {\n' +
    '              isNextPreRelease = hrefChannel === currentChannel;\n' +
    '            }\n' +
    '            if (isNextPreRelease) {\n' +
    '              tag = hrefTag;\n' +
    '              latestRelease = element;\n' +
    '              break;\n' +
    '            }\n' +
    '          }\n' +
    '        } catch (e) {\n' +
    '          throw (0, import_builder_util_runtime.newError)(\n' +
    '            `Cannot parse releases feed: ${e.stack || e.message},\n' +
    'XML:\n' +
    '${feedXml}`,\n' +
    '            "ERR_UPDATER_INVALID_RELEASE_FEED"\n' +
    '          );\n' +
    '        }\n' +
    '        if (tag === null || tag === void 0) {\n' +
    '          throw (0, import_builder_util_runtime.newError)(\n' +
    '            `No published versions on GitHub`,\n' +
    '            "ERR_UPDATER_NO_PUBLISHED_VERSIONS"\n' +
    '          );\n' +
    '        }\n' +
    '        let rawData = null;\n' +
    '        let channelFile = "";\n' +
    '        let channelFileUrl = "";\n' +
    '        const fetchData = async (channelName) => {\n' +
    '          channelFile = getChannelFilename(channelName);\n' +
    '          channelFileUrl = newUrlFromBase(\n' +
    '            this.getBaseDownloadPath(String(tag), channelFile),\n' +
    '            this.baseUrl\n' +
    '          );\n' +
    '          const requestOptions = this.createRequestOptions(channelFileUrl);\n' +
    '          try {\n' +
    '            return await this.executor.request(requestOptions, cancellationToken);\n' +
    '          } catch (e) {\n' +
    '            if (e instanceof import_builder_util_runtime.HttpError && e.statusCode === 404) {\n' +
    '              throw (0, import_builder_util_runtime.newError)(\n' +
    '                `Cannot find ${channelFile} in the latest release artifacts (${channelFileUrl}): ${e.stack || e.message}`,\n' +
    '                "ERR_UPDATER_CHANNEL_FILE_NOT_FOUND"\n' +
    '              );\n' +
    '            }\n' +
    '            throw e;\n' +
    '          }\n' +
    '        };\n' +
    '        try {\n' +
    '          const channel = this.updater.allowPrerelease ? this.getCustomChannelName(\n' +
    '            String(semver.prerelease(tag)?.[0] || "latest")\n' +
    '          ) : this.getDefaultChannelName();\n' +
    '          rawData = await fetchData(channel);\n' +
    '        } catch (e) {\n' +
    '          if (this.updater.allowPrerelease) {\n' +
    '            rawData = await fetchData(this.getDefaultChannelName());\n' +
    '          } else {\n' +
    '            throw e;\n' +
    '          }\n' +
    '        }\n' +
    '        const result = (0, import_Provider.parseUpdateInfo)(rawData, channelFile, channelFileUrl);\n' +
    '        if (result.releaseName == null) {\n' +
    '          result.releaseName = latestRelease.elementValueOrEmpty("title");\n' +
    '        }\n' +
    '        if (result.releaseNotes == null) {\n' +
    '          result.releaseNotes = computeReleaseNotes(\n' +
    '            this.updater.currentVersion,\n' +
    '            this.updater.fullChangelog,\n' +
    '            feed,\n' +
    '            latestRelease\n' +
    '          );\n' +
    '        }\n' +
    '        return {\n' +
    '          tag,\n' +
    '          ...result\n' +
    '        };\n' +
    '      }\n' +
    '      get basePath() {\n' +
    '        return `/${this.options.owner}/${this.options.repo}/releases`;\n' +
    '      }\n' +
    '      /**\n' +
    '       * Use release api to get latest version to filter draft version.\n' +
    '       * But this api have low request limit 60-times/1-hour, use this to help, not depend on it\n' +
    '       * https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28\n' +
    '       * https://api.github.com/repos/toeverything/affine/releases\n' +
    '       * https://docs.github.com/en/rest/rate-limit/rate-limit?apiVersion=2022-11-28#about-rate-limits\n' +
    '       */\n' +
    '      async getLatestTagByRelease(currentChannel, cancellationToken) {\n' +
    '        try {\n' +
    '          const releasesStr = await this.httpRequest(\n' +
    '            newUrlFromBase(`/repos${this.basePath}`, this.baseApiUrl),\n' +
    '            {\n' +
    '              accept: "Accept: application/vnd.github+json",\n' +
    '              "X-GitHub-Api-Version": "2022-11-28"\n' +
    '            },\n' +
    '            cancellationToken\n' +
    '          );\n' +
    '          if (!releasesStr) {\n' +
    '            return null;\n' +
    '          }\n' +
    '          const releases = JSON.parse(releasesStr);\n' +
    '          for (const release2 of releases) {\n' +
    '            if (release2.draft) {\n' +
    '              continue;\n' +
    '            }\n' +
    '            const releaseTag = release2.tag_name;\n' +
    '            const releaseChannel = semver.prerelease(releaseTag)?.[0] || "stable";\n' +
    '            if (releaseChannel === currentChannel) {\n' +
    '              return release2.tag_name;\n' +
    '            }\n' +
    '          }\n' +
    '        } catch (e) {\n' +
    '          console.info(`Cannot parse release: ${e.stack || e.message}`);\n' +
    '        }\n' +
    '        return null;\n' +
    '      }\n' +
    '      resolveFiles(updateInfo) {\n' +
    '        const filteredUpdateInfo = structuredClone(updateInfo);\n' +
    '        if (process.platform === "win32" && updateInfo.files.length > 1) {\n' +
    '          const isSquirrel = isSquirrelBuild();\n' +
    '          filteredUpdateInfo.files = updateInfo.files.filter((file) => {\n' +
    '            return isSquirrel ? !file.url.includes("nsis.exe") : file.url.includes("nsis.exe");\n' +
    '          });\n' +
    '        }\n' +
    '        return (0, import_Provider.resolveFiles)(\n' +
    '          filteredUpdateInfo,\n' +
    '          this.baseUrl,\n' +
    '          (p) => this.getBaseDownloadPath(filteredUpdateInfo.tag, p.replace(/ /g, "-"))\n' +
    '        );\n' +
    '      }\n' +
    '      getBaseDownloadPath(tag, fileName) {\n' +
    '        return `${this.basePath}/download/${tag}/${fileName}`;\n' +
    '      }\n' +
    '    }'
}
15:57:29.344 (main) › [helper] forked 438459
15:57:29.606 (main) › create window
15:57:29.715 (main) › loading page at file://.
15:57:29.785 (main) › [ipc-event] ui:onMaximized [ true ]
Segmentation fault (core dumped)

MingStudentSE avatar May 09 '24 07:05 MingStudentSE

I can open previous Appimage versions of the AFFine. When I try to open 0.14-beta, 0.15-beta and 0.15-canary, I find they are ok to open. So only 0.14-stable will crash immediately now.

MingStudentSE avatar May 09 '24 08:05 MingStudentSE

0.14.2 still crash. Do I have to wait until version 0.15 to use it? >-<

MingStudentSE avatar May 09 '24 13:05 MingStudentSE

@MingStudentSE we will provide a hotfix soon, probably 0.14.3

pengx17 avatar May 10 '24 01:05 pengx17

@pengx17 Hi, I update 0.14.3. It still crash.

~/software$ ./affine-0.14.3-stable-linux-x64.appimage 
MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0

16:32:42.091 (main) › [ipc-event] updater:onDownloadProgress [ 0 ]
16:32:42.107 (main) › auto-updater feed config {
  channel: 'stable',
  provider: 'custom',
  repo: 'AFFiNE',
  owner: 'toeverything',
  releaseType: 'release',
  updateProvider: '[function] class extends import_GitHubProvider.BaseGitHubProvider {\n' +
    '      constructor(options, updater, runtimeOptions) {\n' +
    '        super(options, "github.com", runtimeOptions);\n' +
    '        this.updater = updater;\n' +
    '      }\n' +
    '      async getLatestVersion() {\n' +
    '        const cancellationToken = new import_electron_updater.CancellationToken();\n' +
    '        const feedXml = await this.httpRequest(\n' +
    '          newUrlFromBase(`${this.basePath}.atom`, this.baseUrl),\n' +
    '          {\n' +
    '            accept: "application/xml, application/atom+xml, text/xml, */*"\n' +
    '          },\n' +
    '          cancellationToken\n' +
    '        );\n' +
    '        if (!feedXml) {\n' +
    '          throw new Error(\n' +
    '            `Cannot find feed in the remote server (${this.baseUrl.href})`\n' +
    '          );\n' +
    '        }\n' +
    '        const feed = (0, import_builder_util_runtime.parseXml)(feedXml);\n' +
    '        let latestRelease = feed.element(\n' +
    '          "entry",\n' +
    '          false,\n' +
    '          `No published versions on GitHub`\n' +
    '        );\n' +
    '        let tag = null;\n' +
    '        try {\n' +
    '          const currentChannel = this.options.channel || this.updater?.channel || semver.prerelease(this.updater.currentVersion)?.[0] || null;\n' +
    '          if (currentChannel === null) {\n' +
    '            throw (0, import_builder_util_runtime.newError)(\n' +
    '              `Cannot parse channel from version: ${this.updater.currentVersion}`,\n' +
    '              "ERR_UPDATER_INVALID_VERSION"\n' +
    '            );\n' +
    '          }\n' +
    '          const releaseTag = await this.getLatestTagByRelease(\n' +
    '            currentChannel,\n' +
    '            cancellationToken\n' +
    '          );\n' +
    '          for (const element of feed.getElements("entry")) {\n' +
    '            const hrefElement = hrefRegExp.exec(\n' +
    '              element.element("link").attribute("href")\n' +
    '            );\n' +
    '            if (hrefElement === null) continue;\n' +
    '            const hrefTag = hrefElement[1];\n' +
    '            const hrefChannel = semver.prerelease(hrefTag)?.[0] || "stable";\n' +
    '            let isNextPreRelease = false;\n' +
    '            if (releaseTag) {\n' +
    '              isNextPreRelease = releaseTag === hrefTag;\n' +
    '            } else {\n' +
    '              isNextPreRelease = hrefChannel === currentChannel;\n' +
    '            }\n' +
    '            if (isNextPreRelease) {\n' +
    '              tag = hrefTag;\n' +
    '              latestRelease = element;\n' +
    '              break;\n' +
    '            }\n' +
    '          }\n' +
    '        } catch (e) {\n' +
    '          throw (0, import_builder_util_runtime.newError)(\n' +
    '            `Cannot parse releases feed: ${e.stack || e.message},\n' +
    'XML:\n' +
    '${feedXml}`,\n' +
    '            "ERR_UPDATER_INVALID_RELEASE_FEED"\n' +
    '          );\n' +
    '        }\n' +
    '        if (tag === null || tag === void 0) {\n' +
    '          throw (0, import_builder_util_runtime.newError)(\n' +
    '            `No published versions on GitHub`,\n' +
    '            "ERR_UPDATER_NO_PUBLISHED_VERSIONS"\n' +
    '          );\n' +
    '        }\n' +
    '        let rawData = null;\n' +
    '        let channelFile = "";\n' +
    '        let channelFileUrl = "";\n' +
    '        const fetchData = async (channelName) => {\n' +
    '          channelFile = getChannelFilename(channelName);\n' +
    '          channelFileUrl = newUrlFromBase(\n' +
    '            this.getBaseDownloadPath(String(tag), channelFile),\n' +
    '            this.baseUrl\n' +
    '          );\n' +
    '          const requestOptions = this.createRequestOptions(channelFileUrl);\n' +
    '          try {\n' +
    '            return await this.executor.request(requestOptions, cancellationToken);\n' +
    '          } catch (e) {\n' +
    '            if (e instanceof import_builder_util_runtime.HttpError && e.statusCode === 404) {\n' +
    '              throw (0, import_builder_util_runtime.newError)(\n' +
    '                `Cannot find ${channelFile} in the latest release artifacts (${channelFileUrl}): ${e.stack || e.message}`,\n' +
    '                "ERR_UPDATER_CHANNEL_FILE_NOT_FOUND"\n' +
    '              );\n' +
    '            }\n' +
    '            throw e;\n' +
    '          }\n' +
    '        };\n' +
    '        try {\n' +
    '          const channel = this.updater.allowPrerelease ? this.getCustomChannelName(\n' +
    '            String(semver.prerelease(tag)?.[0] || "latest")\n' +
    '          ) : this.getDefaultChannelName();\n' +
    '          rawData = await fetchData(channel);\n' +
    '        } catch (e) {\n' +
    '          if (this.updater.allowPrerelease) {\n' +
    '            rawData = await fetchData(this.getDefaultChannelName());\n' +
    '          } else {\n' +
    '            throw e;\n' +
    '          }\n' +
    '        }\n' +
    '        const result = (0, import_Provider.parseUpdateInfo)(rawData, channelFile, channelFileUrl);\n' +
    '        if (result.releaseName == null) {\n' +
    '          result.releaseName = latestRelease.elementValueOrEmpty("title");\n' +
    '        }\n' +
    '        if (result.releaseNotes == null) {\n' +
    '          result.releaseNotes = computeReleaseNotes(\n' +
    '            this.updater.currentVersion,\n' +
    '            this.updater.fullChangelog,\n' +
    '            feed,\n' +
    '            latestRelease\n' +
    '          );\n' +
    '        }\n' +
    '        return {\n' +
    '          tag,\n' +
    '          ...result\n' +
    '        };\n' +
    '      }\n' +
    '      get basePath() {\n' +
    '        return `/${this.options.owner}/${this.options.repo}/releases`;\n' +
    '      }\n' +
    '      /**\n' +
    '       * Use release api to get latest version to filter draft version.\n' +
    '       * But this api have low request limit 60-times/1-hour, use this to help, not depend on it\n' +
    '       * https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28\n' +
    '       * https://api.github.com/repos/toeverything/affine/releases\n' +
    '       * https://docs.github.com/en/rest/rate-limit/rate-limit?apiVersion=2022-11-28#about-rate-limits\n' +
    '       */\n' +
    '      async getLatestTagByRelease(currentChannel, cancellationToken) {\n' +
    '        try {\n' +
    '          const releasesStr = await this.httpRequest(\n' +
    '            newUrlFromBase(`/repos${this.basePath}`, this.baseApiUrl),\n' +
    '            {\n' +
    '              accept: "Accept: application/vnd.github+json",\n' +
    '              "X-GitHub-Api-Version": "2022-11-28"\n' +
    '            },\n' +
    '            cancellationToken\n' +
    '          );\n' +
    '          if (!releasesStr) {\n' +
    '            return null;\n' +
    '          }\n' +
    '          const releases = JSON.parse(releasesStr);\n' +
    '          for (const release2 of releases) {\n' +
    '            if (release2.draft) {\n' +
    '              continue;\n' +
    '            }\n' +
    '            const releaseTag = release2.tag_name;\n' +
    '            const releaseChannel = semver.prerelease(releaseTag)?.[0] || "stable";\n' +
    '            if (releaseChannel === currentChannel) {\n' +
    '              return release2.tag_name;\n' +
    '            }\n' +
    '          }\n' +
    '        } catch (e) {\n' +
    '          console.info(`Cannot parse release: ${e.stack || e.message}`);\n' +
    '        }\n' +
    '        return null;\n' +
    '      }\n' +
    '      resolveFiles(updateInfo) {\n' +
    '        const filteredUpdateInfo = structuredClone(updateInfo);\n' +
    '        if (process.platform === "win32" && updateInfo.files.length > 1) {\n' +
    '          const isSquirrel = isSquirrelBuild();\n' +
    '          filteredUpdateInfo.files = updateInfo.files.filter((file) => {\n' +
    '            return isSquirrel ? !file.url.includes("nsis.exe") : file.url.includes("nsis.exe");\n' +
    '          });\n' +
    '        }\n' +
    '        return (0, import_Provider.resolveFiles)(\n' +
    '          filteredUpdateInfo,\n' +
    '          this.baseUrl,\n' +
    '          (p) => this.getBaseDownloadPath(filteredUpdateInfo.tag, p.replace(/ /g, "-"))\n' +
    '        );\n' +
    '      }\n' +
    '      getBaseDownloadPath(tag, fileName) {\n' +
    '        return `${this.basePath}/download/${tag}/${fileName}`;\n' +
    '      }\n' +
    '    }'
}
16:32:42.123 (main) › [helper] forked 243440
16:32:42.354 (main) › create window
16:32:42.457 (main) › loading page at file://.
16:32:42.526 (main) › [ipc-event] ui:onMaximized [ true ]
Segmentation fault (core dumped)

MingStudentSE avatar May 10 '24 08:05 MingStudentSE

ℹ️ All products based on Electron v30.x are affected by this very annoying issue. Check here for details: https://github.com/electron/electron/issues/41839

As a workaround: electron29 /usr/lib/affine/app.asar (ofc electron v29 must be installed).

M1CK431 avatar May 10 '24 14:05 M1CK431

@pengx17 So it has to wait for electron/electron/pull/42126 to fix this problem?

MingStudentSE avatar May 11 '24 05:05 MingStudentSE

Looks like the issue is now fixed at eletron side 🎉 🤸🏼‍♂️ @pengx17 It is possible to publish a hotfix release using electron v30.0.5 (or upper) please? 🥺 🙏🏼

M1CK431 avatar May 15 '24 20:05 M1CK431

Hope it can be solved in 0.14.7. @pengx17

MingStudentSE avatar May 16 '24 01:05 MingStudentSE

@EYHN @pengx17 This issue could be closed

MingStudentSE avatar Jun 13 '24 01:06 MingStudentSE