pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

Uncaught Error: Cannot decorate a destroyed marker

Open olibia opened this issue 2 years ago • 1 comments

Thanks in advance for your bug report!

  • [X] Have you reproduced issue in safe mode?
  • [X] Have you used the debugging guide to try to resolve the issue?
  • [X] Have you checked our FAQs to make sure your question isn't answered there?
  • [X] Does your issue already exist?
  • [X] 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 avatar Nov 11 '22 07:11 olibia

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

m1ga avatar Nov 22 '22 10:11 m1ga

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 

mhzawadi avatar Jan 16 '23 20:01 mhzawadi

Any update here?

m1ga avatar Feb 01 '23 19:02 m1ga

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 avatar Feb 01 '23 20:02 meadowsys

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: https://github.com/pulsar-edit/pulsar/blob/1da0dab087d99d62051ded5b53ad9d90e3b62398/packages/git-diff/lib/git-diff-view.js#L247

meadowsys avatar Feb 01 '23 21:02 meadowsys

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

https://github.com/pulsar-edit/pulsar/blob/8d52f907c4fa8fadf1961412c223fcc0f681abd3/src/decoration-manager.js#L207-L221

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

meadowsys avatar Feb 01 '23 21:02 meadowsys

Might be a good way. I only see this error for git-diff-view anyways (since a long time in Atom and Pulsar :smile: ). 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

m1ga avatar Feb 01 '23 21:02 m1ga

(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?

confused-Techie avatar Feb 02 '23 02:02 confused-Techie

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

meadowsys avatar Feb 02 '23 02:02 meadowsys

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

confused-Techie avatar Feb 02 '23 02:02 confused-Techie

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

meadowsys avatar Feb 03 '23 21:02 meadowsys

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

m1ga avatar Mar 04 '23 18:03 m1ga

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)

mukteshkrmishra avatar Apr 10 '23 17:04 mukteshkrmishra

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:

https://github.com/pulsar-edit/pulsar/blob/1da0dab087d99d62051ded5b53ad9d90e3b62398/packages/git-diff/lib/git-diff-view.js#L261-L265

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.

savetheclocktower avatar Apr 10 '23 17:04 savetheclocktower

Thanks @savetheclocktower !! Looking very good so far.

m1ga avatar Apr 18 '23 08:04 m1ga