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

Uncaught Error: Cannot decorate a destroyed marker #134

Closed
5 tasks done
olibia opened this issue Nov 11, 2022 · 15 comments · Fixed by #481
Closed
5 tasks done

Uncaught Error: Cannot decorate a destroyed marker #134

olibia opened this issue Nov 11, 2022 · 15 comments · Fixed by #481
Labels
bug Something isn't working

Comments

@olibia
Copy link

olibia commented Nov 11, 2022

Thanks in advance for your bug report!

  • Have you reproduced issue in safe mode?
  • Have you used the debugging guide to try to resolve the issue?
  • Have you checked our FAQs to make sure your question isn't answered there?
  • Does your issue already exist?
  • Have you checked you are on the latest release of Pulsar?

What happened?

Versions

Atom: 1.63.2022110914 x64
Electron: 12.2.3
OS: linux 6.0.7-arch1-1
Thrown From: Atom Core

Stack Trace

Uncaught Error: Cannot decorate a destroyed marker

At /opt/Pulsar/resources/app.asar/src/decoration-manager.js:220

Error: Cannot decorate a destroyed marker
    at DecorationManager.decorateMarker (/app.asar/src/decoration-manager.js:208:21)
    at TextEditor.decorateMarker (/app.asar/src/text-editor.js:2797:35)
    at GitDiffView.markRange (git-diff-view.js:264:17)
    at GitDiffView.updateDiffs (git-diff-view.js:247:25)

Commands

     -1:17 tabs:close-all-tabs (div.title.icon.ruby-icon.medium-red)
     -1:12.5.0 open-terminal-here:open (div.header.list-item.project-root-header)

Which OS does this happen on?

🐧 Arch based (Manjaro, Garuda, etc.)

OS details

Gnome 43 Wayland

Which CPU architecture are you running this on?

64-bit(x86_64)

What steps are needed to reproduce this?

  1. Leave open files and a git diff tab
  2. Close Pulsar
  3. Open Pulsar and close all tabs when editor has not fully loaded yet

Additional Information:

Issue has been reported in Atom, but was closed due to inactivity atom/atom#19173. This issue is probably triggered by pulsar-edit/github .

@olibia olibia added the bug Something isn't working label Nov 11, 2022
@m1ga
Copy link

m1ga commented Nov 22, 2022

seeing a lot of these recently too
Fedora

Pulsar  : 1.63.2022111017
Electron: 12.2.3
Chrome  : 89.0.4389.128
Node    : 14.16.0

@mhzawadi
Copy link

Have just got this

Versions

** Pulsar**: 1.101.0-beta x64
Electron: 12.2.3
OS: macOS 13.1
Thrown From: Atom Core

Stack Trace

Uncaught Error: Cannot decorate a destroyed marker

At /Applications/Pulsar.app/Contents/Resources/app.asar/src/decoration-manager.js:220

Error: Cannot decorate a destroyed marker
    at DecorationManager.decorateMarker (/app.asar/src/decoration-manager.js:208:21)
    at TextEditor.decorateMarker (/app.asar/src/text-editor.js:2797:35)
    at GitDiffView.markRange (git-diff-view.js:264:17)
    at GitDiffView.updateDiffs (git-diff-view.js:247:25)

Commands

     -4:27 core:backspace (input.hidden-input)
     -4:26.7.0 core:move-right (input.hidden-input)
     -4:26.1.0 core:save (input.hidden-input)
  5x -3:48.5.0 core:move-left (input.hidden-input)
     -3:46.8.0 core:delete (input.hidden-input)
     -3:46 github:commit (input.hidden-input)

Non-Core Packages

auto-dark-mode 0.6.0 
auto-indent 0.5.0 
language-nagios 0.2.0 
language-nginx 0.8.0 
project-manager 3.3.8 

@m1ga
Copy link

m1ga commented Feb 1, 2023

Any update here?

@meadowsys
Copy link
Member

able to reproduce (yay?) using Apple Silicon Pulsar from CI on the macos code signing PR and macOS Ventura 13.2 (public beta), and also in safe mode.

Uncaught Error: Cannot decorate a destroyed marker

At /Applications/Pulsar.app/Contents/Resources/app.asar/src/decoration-manager.js:220

Error: Cannot decorate a destroyed marker
    at DecorationManager.decorateMarker (/app.asar/src/decoration-manager.js:208:21)
    at TextEditor.decorateMarker (/app.asar/src/text-editor.js:2797:35)
    at GitDiffView.markRange (git-diff-view.js:264:17)
    at GitDiffView.updateDiffs (git-diff-view.js:247:25)

Commands

  5x -0:22.2.0 core:close (atom-pane.pane.active)
     -0:08.6.0 core:copy (atom-notification.fatal.icon.icon-bug.native-key-bindings.has-detail.has-close.has-stack)

No non-core packages

@meadowsys
Copy link
Member

meadowsys commented Feb 1, 2023

My educated guess (maybe its obvious) is that the git diff view was closed before it was fully initialised, so the code to initialise is still in the process of running, but the instance was destroyed. So, a race condition of sorts. Here the error is thrown while its still initialising:

mark = this.markRange(0, 0, 'git-previous-line-removed');

@meadowsys
Copy link
Member

actually nuh i didn't follow the stacktrace up. Here is where the error is constructed and thrown:

if (marker.isDestroyed()) {
const error = new Error('Cannot decorate a destroyed marker');
error.metadata = { markerLayerIsDestroyed: marker.layer.isDestroyed() };
if (marker.destroyStackTrace != null) {
error.metadata.destroyStackTrace = marker.destroyStackTrace;
}
if (
marker.bufferMarker != null &&
marker.bufferMarker.destroyStackTrace != null
) {
error.metadata.destroyStackTrace =
marker.bufferMarker.destroyStackTrace;
}
throw error;
}

I think this would be an edge case. maybe its best to just log an error but silently ignore it?

@m1ga
Copy link

m1ga commented Feb 1, 2023

Might be a good way. I only see this error for git-diff-view anyways (since a long time in Atom and Pulsar 😄 ). Just log it into the devtools and not show the error box. Of course fixing the source would be better but since everything works fine after closing the error message it could be a simple log

@confused-Techie
Copy link
Member

(Without researching into why this happens with github) Since it sounds like this only happens when the package's pane is closed before it's done writing updates to it, we could modify any long running tasks to double check that their marker is still available before trying to write to it? So that way if it's not then the task will just stop so the error is never triggered?

@meadowsys
Copy link
Member

actually that's exactly what the throwing code is doing! (checking if the marker is destroyed already) :p

@confused-Techie
Copy link
Member

actually that's exactly what the throwing code is doing! (checking if the marker is destroyed already) :p

Oh wow, then ignore my previous comment. Yeah then I'm not to sure if this has to be a big error. Unless this exists as an error to protect some other state we aren't thinking of? Since if the only time this would really happen is when the user closes the tab then we shouldn't care about it being gone

@meadowsys
Copy link
Member

Throwing the error does stop the operation, but I think it would achieve the same effect if you just console.error and return early? plus it doesn't give you red in your face error

@m1ga
Copy link

m1ga commented Mar 4, 2023

@meadowsys did you have time to look at this one?

@mukteshkrmishra
Copy link

Still getting this error.

/Applications/Pulsar.app/Contents/Resources/app.asar/src/decoration-manager.js:220
Hide Stack Trace
Error: Cannot decorate a destroyed marker
at DecorationManager.decorateMarker (/Applications/Pulsar.app/Contents/Resources/app.asar/src/decoration-manager.js:208:21)
at TextEditor.decorateMarker (/Applications/Pulsar.app/Contents/Resources/app.asar/src/text-editor.js:2797:35)
at GitDiffView.markRange (git-diff-view.js:264:17)
at GitDiffView.updateDiffs (git-diff-view.js:247:25)

@savetheclocktower
Copy link
Contributor

savetheclocktower commented Apr 10, 2023

What's weird about this is that it implies the marker is destroyed already when it's returned from markBufferRange, since there's nothing async between line 264 and the exception being thrown:

const marker = this.editor.markBufferRange([[startRow, 0], [endRow, 0]], {
invalidate: 'never'
});
this.editor.decorateMarker(marker, { type: 'line-number', class: klass });
return marker;

No idea why, but it does make a band-aid fix possible for this specific issue without requiring that we suppress all exceptions whenever someone tries to decorate a destroyed marker.

@m1ga
Copy link

m1ga commented Apr 18, 2023

Thanks @savetheclocktower !! Looking very good so far.

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
None yet
Development

Successfully merging a pull request may close this issue.

7 participants