atom / atom

:atom: The hackable text editor
https://atom.io
MIT License
60.16k stars 17.39k forks source link

Could not connect to indexedDB #23630

Open furuichinaoya opened 2 years ago

furuichinaoya commented 2 years ago

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.59.0 x64 Electron: 9.4.4 OS: macOS 12.0.1 Thrown From: Atom Core

Stack Trace

Could not connect to indexedDB

At undefined

Error: Could not connect to indexedDB
    at IDBOpenDBRequest.t.onerror (/Applications/Atom.app/Contents/Resources/app/static/<embedded>:11:289935)

Commands

Non-Core Packages

atom-beautify 0.33.4 
atom-material-syntax 1.0.8 
atom-material-syntax-dark 1.0.0 
atom-material-syntax-light 0.4.6 
atom-material-ui 2.1.3 
busy-signal 2.0.1 
editorconfig 2.6.1 
emmet 2.4.3 
file-icons 2.1.47 
git-plus 8.7.1 
git-time-machine 2.1.0 
highlight-line 0.12.0 
highlight-selected 0.17.0 
indent-guide-improved 1.4.13 
intentions 2.1.1 
japanese-menu 1.15.0 
language-pug 0.0.22 
linter 3.4.0 
linter-jshint 3.1.19 
linter-php 1.6.1 
linter-sass-lint 1.9.0 
linter-scss-lint 3.2.1 
linter-ui-default 3.4.1 
minimap 4.40.0 
minimap-highlight-selected 4.6.6 
platformio-ide-terminal 2.10.1 
remote-ftp 2.2.4 
vk-terminal 3.0.1 
daniellucas commented 2 years ago

I am having the same issue 👀

Screen Shot 2022-02-21 at 3 21 20 pm

stmark707 commented 2 years ago

image

Me too! This happened to me while I was opening a file that had the same name as another file but belonged to a different project, hope this helps!

Habis3 commented 2 years ago

fg

Habis3 commented 2 years ago

what can I do!

nelson6e65 commented 2 years ago

I was on Fedora, and I was nit able to paste anything from outside of Atom. When I restarted it, I got that error. 🥺

Has not happened again, but it freezes each time I try to paste text copied from outside of editor.

sm000k commented 2 years ago

same thing

qimotoo commented 2 years ago

Did anyone known how to fix it?

sneakybacon1 commented 2 years ago

SAME PROBLEM HERE, HOW DO YOU FIX IT?

icecream17 commented 2 years ago

Hmm, maybe https://www.nerd.vision/post/how-we-solved-a-case-where-indexeddb-did-not-connect could work?

https://github.com/atom/atom/blob/d016186110ffbe588a45d594803f9f9078804085/src/state-store.js#L25-L28

Possible change:

dbOpenRequest.onsuccess = event => {
  const db = event.target.result;
  db.onversionchange = () => {
    this.connected = false;
    db.close();
  }

  this.connected = true; 
  resolve(dbOpenRequest.result); 
}; 

The MDN docs are quite hard to wade through, and I can't figure where it says this is required, so this is unverified.

Also, this might break some code because there are still references to db

Edit: https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase/close

If anyone could test, does one of the changes above work? Enter this in your [init script](https://flight-manual.atom.io/hacking-atom/sections/the-init-file/) (File > Init Script...) (If your init script is in the coffeescript language either change the file extension to `js` or [surround this code with backticks](https://coffeescript.org/#embedded).) ```js // indexedDB workaround { const stateStoreProto = atom.stateStore.constructor.prototype if (String(Object.getOwnPropertyDescriptor(stateStoreProto, "dbPromise").get).includes("close")) { atom.notifications.addInfo("The indexedDB workaround in your init script is not necessary anymore", { dismissable: true }) } else { stateStoreProto.__defineGetter__("dbPromise", function(){ // Copy https://github.com/atom/atom/blob/d016186110ffbe588a45d594803f9f9078804085/src/state-store.js#L11-L41 // and then test one of the changes above throw "unimplemented!" // Delete this }) } } ```
olivia-tran commented 2 years ago

It happened when I already had another index.html file open. I closed the other file and re-opened this and it worked for me.

robertplanetweb commented 2 years ago

goddamit i had automatic updates checked and it suddenly updated and now i get this error too

liutianfang commented 2 years ago

same bug

I set atom as md file default editor. when the atom is opened, I open a exist md file, the bug is occurred.

I think the db file can not be reopened by a new atom instance

jmanuel1 commented 2 years ago

@icecream17 I changed my init script according to your suggestion, and I still got an error about IndexedDB after reloading the window and after opening a new window.

jmanuel1 commented 2 years ago

It turns out I was running two different versions of Atom at the same time. I don't know how that happened; my guess is that an upgrade happened while I had one window opened, and then I started a new one with the new version by accident. I happened to use GitHub desktop to create a window at some point, so maybe that's related.

image

Based on a comment on a Nuclide issue, running different Atom versions at once is related to the IndexedDB error.

I closed all instances of Atom, then opened two windows. One of them was started with a project. I have not encountered the IndexedDB issue again.

syrsly commented 2 years ago

This happens whenever Atom auto-updates and I open something in WinSCP because WinSCP has to link to the specific version's exe. It's almost like a notice that the editor updated to me. Opening anything in the old version while the new version is also open since 1.58 has resulted in this error.

Aibel2k5 commented 2 years ago

I'm facing exactly same problem. It started yesterday after I chose Atom as my default editor in winSCP

ghost commented 2 years ago

This happened to me when Atom tried to open a second window/instance.

sunnysideup commented 2 years ago

This happened to me when Atom tried to open a second window/instance.

cirethic commented 2 years ago

This happened to me when Atom tried to open a second window/instance.

exactly the same issue.

paxtonfitzpatrick commented 2 years ago

Same issue here, specifically when opening two different versions of Atom side-by-side.

Opening multiple windows of the same app instance works fine, as does opening windows from two different instances, as long as they are the same version.

Tested with:

(OS: macOS 12.1 (M1 Pro chip))

The error is thrown by whichever version is opened second, and the stack trace is slightly different between the two:

whittede commented 2 years ago

This happened to me when Atom tried to open a second window/instance.

This is the same for me as well. Opened a second Atom instance today and the error message popped up.

cubigiabinh commented 2 years ago

To my knowledge, This may cause by opening 2 or more instances (process) of Atom, the second Atom instance will get this problem. For example, You already open the file by using Atom then open the different file by using another Atom instance. Some software can cause this problem as well. I got this problem by opening 2 instances of Atom. I think this is not a very serious problem because I don't see anything caused by this issue.

sporniket commented 2 years ago

I fail to see any user level procedure to work around this issue (like deleting said indexed db to restart from a fresh start ?)

Is there any such procedure ? Or are we stuck with this problem until the next release (hopefully) ?

(for the record, I am quite a very casual user, I just download the *.deb and install ; there are a bunch of binaries at /usr/share/atom, but nothing editable ; and I didn't see something noteworthy inside $HOME/.atom)

Phill-25 commented 2 years ago

Here the same error. It occurs when I run 'git flow finish release'. When the file to write the release comment is opened, the error occurs.

karanamdeepakpillai commented 2 years ago

close atom and try, it should work. It doesn't work if atom is already open.

sporniket commented 2 years ago

It seems that I fixed my occurrence of this problem. In short, the indexed db files where owned by root, I chowned them back to my user. Most likely I started an editor as root to do something root related.

How to check the indexed database file (on Linux)

cd ~/.config/Atom/IndexedDB/file__0.indexeddb.leveldb #maybe the last part of this path is variable,
# just list the content of IndexedDB to check the actual path
ll *.ldb

I got :

-rw------- 1 root    root    2117532 févr. 24 09:29 017396.ldb
-rw------- 1 root    root     390430 févr. 24 09:29 017397.ldb

How to fix this particular problem

You MUST be able to sudo

If your user/group is foo/bar :

sudo chown foo:bar *.ldb
ll *.ldb

you should get something like :

-rw------- 1 foo bar 2117532 févr. 24 09:29 017396.ldb
-rw------- 1 foo bar  390430 févr. 24 09:29 017397.ldb
whittede commented 2 years ago

It seems that I fixed my occurrence of this problem. In short, the indexed db files where owned by root, I chowned them back to my user. Most likely I started an editor as root to do something root related.

Hm, I'm seeing this issue on my Windows version of Atom. I don't think Atom gets different permssions from the user (me, the only admin) running it. Any ideas on a fix for Windows users?

mr-manuel commented 1 year ago

I have the same issue, when Atom decides to open a new file in a new window instead of a new tab. This is annoing that 9 months passed and still no fix.

OS: Windows 11 x64 Atom: 1.60.0 x64

whittede commented 1 year ago

Unfortunately, it seems likely that this will not receive a fix as Atom has been bought by Microsoft and is being deprecated this month. Your best bet is to switch over to a new text editor, because the Atom project is likely not going to receive any new updates.

If you want a text editor written by the same people that created Atom, you can check out zed.dev: https://news.ycombinator.com/item?id=31669615