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

Random error kills silverbullet eventually #1154

Open
devzero opened this issue Nov 13, 2024 · 4 comments
Open

Random error kills silverbullet eventually #1154

devzero opened this issue Nov 13, 2024 · 4 comments

Comments

@devzero
Copy link

devzero commented Nov 13, 2024

I continually get the crash dump below and as a result it becomes unusable. This is running on NixOS, but my home NixOS machine doesn't have this problem, so it's either related to content of the space, or because this machine is behind a HTTPS proxy with non-standard SSL certs. If I stop the service, wipe out .silverbullet.db* and restart, it fixes it temporarily, but some undetermined amount of time later it happens again every time.

I'm also running the GIT plugin (from SETTINGS):

git:
  autoCommitMinutes: 5
  autoSync: true

I just realized it might be the git plugin, so I just disabled that and will track if that isolates the issue.

Host is a x86_64 NixOS 24.11 system running newest silverbullet from nixpkgs.

Here's the log output:

Using KV as a database backend (/var/lib/silverbullet/.silverbullet.db).
Going to start SilverBullet binding to localhost:3000
Using local disk as a storage backend: /var/lib/silverbullet
Unhandled rejection: PromiseRejectionEvent {
  bubbles: false,
  cancelable: true,
  composed: false,
  currentTarget: Window {},
  defaultPrevented: false,
  eventPhase: 2,
  srcElement: null,
  target: Window {},
  returnValue: true,
  timeStamp: 0,
  type: "unhandledrejection",
  promise: Promise {
    <rejected> ReferenceError: window is not defined
    at IV.hashSHA256 (file:///nix/store/d3pvmgayhavxnq5210z14p8h1nzjfqgk-silverbullet-0.9.4/lib/silverbullet.js:87:33860)
    at IV.init (file:///nix/store/d3pvmgayhavxnq5210z14p8h1nzjfqgk-silverbullet-0.9.4/lib/silverbullet.js:87:33272)
    at eventLoopTick (ext:core/01_core.js:175:7)
    at async zX.init (file:///nix/store/d3pvmgayhavxnq5210z14p8h1nzjfqgk-silverbullet-0.9.4/lib/silverbullet.js:2384:18073)
    at async rX.start (file:///nix/store/d3pvmgayhavxnq5210z14p8h1nzjfqgk-silverbullet-0.9.4/lib/silverbullet.js:2385:7437)
    at async F.gj [as actionHandler] (file:///nix/store/d3pvmgayhavxnq5210z14p8h1nzjfqgk-silverbullet-0.9.4/lib/silverbullet.js:2385:13469244)
    at async F.execute (file:///nix/store/d3pvmgayhavxnq5210z14p8h1nzjfqgk-silverbullet-0.9.4/lib/silverbullet.js:24:8601)
    at async F.parseCommand (file:///nix/store/d3pvmgayhavxnq5210z14p8h1nzjfqgk-silverbullet-0.9.4/lib/silverbullet.js:24:6314)
    at async file:///nix/store/d3pvmgayhavxnq5210z14p8h1nzjfqgk-silverbullet-0.9.4/lib/silverbullet.js:2418:6541
  },
  reason: ReferenceError: window is not defined
    at IV.hashSHA256 (file:///nix/store/d3pvmgayhavxnq5210z14p8h1nzjfqgk-silverbullet-0.9.4/lib/silverbullet.js:87:33860)
    at IV.init (file:///nix/store/d3pvmgayhavxnq5210z14p8h1nzjfqgk-silverbullet-0.9.4/lib/silverbullet.js:87:33272)
    at eventLoopTick (ext:core/01_core.js:175:7)
    at async zX.init (file:///nix/store/d3pvmgayhavxnq5210z14p8h1nzjfqgk-silverbullet-0.9.4/lib/silverbullet.js:2384:18073)
    at async rX.start (file:///nix/store/d3pvmgayhavxnq5210z14p8h1nzjfqgk-silverbullet-0.9.4/lib/silverbullet.js:2385:7437)
    at async F.gj [as actionHandler] (file:///nix/store/d3pvmgayhavxnq5210z14p8h1nzjfqgk-silverbullet-0.9.4/lib/silverbullet.js:2385:13469244)
    at async F.execute (file:///nix/store/d3pvmgayhavxnq5210z14p8h1nzjfqgk-silverbullet-0.9.4/lib/silverbullet.js:24:8601)
    at async F.parseCommand (file:///nix/store/d3pvmgayhavxnq5210z14p8h1nzjfqgk-silverbullet-0.9.4/lib/silverbullet.js:24:6314)
    at async file:///nix/store/d3pvmgayhavxnq5210z14p8h1nzjfqgk-silverbullet-0.9.4/lib/silverbullet.js:2418:6541
@zefhemel
Copy link
Collaborator

This is an error I've seen when running SB with deno 2. Are you doing that? If so, you may want to switch to an edge build which has been updated for Deno 2.

@devzero
Copy link
Author

devzero commented Nov 14, 2024

NixOS is, in fact, running deno 2.0.5. Though I noticed, that as soon as I removed the git plugin config from my SETTINGS, it stopped crashing. I've patched my nix config to use edge (overlay is below for those who care), though I'll have to update the hash every time edge.silverbullet.md changes. I didn't notice any changes in the changelog talking about post 0.9.4 feature work, but I guess it's just in progress.

{channels, inputs, ...}:
  final: prev: {
    silverbullet = prev.silverbullet.overrideAttrs (attrs: {
      version = "0.9.5";
      src = final.fetchurl {
        url = "https://edge.silverbullet.md/silverbullet.js";
        hash = "sha256-1W9gR2smsRhipEd3kfonkTpkbDdbKXzZZ2DFZynNsgM=";
      };
    });
  }

@devzero
Copy link
Author

devzero commented Nov 14, 2024

And that builds, but fails to run:

Nov 14 15:30:26  silverbullet[777850]: Download https://deno.land/[email protected]/text/closest_string.ts
Nov 14 15:30:26  silverbullet[777850]: Download https://deno.land/[email protected]/fmt/colors.ts
Nov 14 15:30:26  silverbullet[777850]: Download https://deno.land/[email protected]/console/unicode_width.ts
Nov 14 15:30:26  silverbullet[777850]: Download https://deno.land/[email protected]/encoding/base64url.ts
Nov 14 15:30:26  silverbullet[777850]: Download https://deno.land/[email protected]/streams/readable_stream_from_iterable.ts
Nov 14 15:30:26  silverbullet[777850]: Download https://deno.land/[email protected]/io/buffer.ts
Nov 14 15:30:27  silverbullet[777850]: error: Operation not permitted (os error 1) (for '/var/empty/.cache/deno/remote/https/deno.land')
Nov 14 15:30:27  silverbullet[777850]: Check the permission of the directory.
Nov 14 15:30:27  silverbullet[777850]:     at file:///nix/store/555klhxs0arc90pjqpmbjhncb39lvf86-silverbullet-0.9.5/lib/silverbullet.js:2:125
Nov 14 15:30:27  systemd[1]: silverbullet.service: Main process exited, code=exited, status=1/FAILURE

@zefhemel
Copy link
Collaborator

If you update plugs now this should be fixed. Just pushed a new git plug build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants