anytype-heart icon indicating copy to clipboard operation
anytype-heart copied to clipboard

Crash on Windows App start

Open Nic0 opened this issue 2 years ago • 6 comments

Have you read a contributing guide?

  • [X] I have read CONTRIBUTING.md
  • [X] I have searched the existing issues and didn't find any that were similar
  • [X] I have considered creating a pull request with fixes instead of a bug report and want to proceed

Current Behavior

Hello,

I cannot start the application after that Windows crashed. It fail on the "spash screen".

Expected Behavior

Launch Anytype.

Steps To Reproduce

  1. Freeze Windows
  2. Start Anytype

Environment

- OS: Windows
- Version: 11

Anything else?

My Windows freezed, I restart my PC (hard reboot), every time I start Anytype it crash. I deinstalled/reinstall, it work. I have the following stack.

panic: runtime error: index out of range [3] with length 0 [recovered]
	panic: 
== Recovering from initIndex crash ==
File Info: [ID: 10, Size: 81213, Zeros: 81213]
isEnrypted: false checksumLen: 0 checksum:  indexLen: 0 index: [] 
== Recovered ==


goroutine 62 [running]:
github.com/dgraph-io/badger/v3/table.(*Table).initBiggestAndSmallest.func1.1()
	/Users/runner/go/pkg/mod/github.com/dgraph-io/badger/[email protected]/table/table.go:351 +0xa8
github.com/dgraph-io/badger/v3/table.(*Table).initBiggestAndSmallest.func1()
	/Users/runner/go/pkg/mod/github.com/dgraph-io/badger/[email protected]/table/table.go:397 +0xc2

panic({0x7ff74ba8e8e0, 0xc000112078})
	/Users/runner/hostedtoolcache/go/1.20.10/x64/src/runtime/panic.go:884 +0x213
github.com/google/flatbuffers/go.GetInt32(...)
	/Users/runner/go/pkg/mod/github.com/google/[email protected]/go/encode.go:85
github.com/google/flatbuffers/go.GetUOffsetT(...)
	/Users/runner/go/pkg/mod/github.com/google/[email protected]/go/encode.go:121
github.com/dgraph-io/badger/v3/fb.GetRootAsTableIndex(...)
	/Users/runner/go/pkg/mod/github.com/dgraph-io/badger/[email protected]/fb/TableIndex.go:14
github.com/dgraph-io/badger/v3/table.(*Table).readTableIndex(0xc000000540)
	/Users/runner/go/pkg/mod/github.com/dgraph-io/badger/[email protected]/table/table.go:707 +0x15e
github.com/dgraph-io/badger/v3/table.(*Table).initIndex(0xc000000540)
	/Users/runner/go/pkg/mod/github.com/dgraph-io/badger/[email protected]/table/table.go:462 +0x19d
github.com/dgraph-io/badger/v3/table.(*Table).initBiggestAndSmallest(0xc000000540)
	/Users/runner/go/pkg/mod/github.com/dgraph-io/badger/[email protected]/table/table.go:401 +0x7f
github.com/dgraph-io/badger/v3/table.OpenTable(0xc000424040, {0x0, 0x1, 0x200000, 0x0, 0x0, 0x3f847ae147ae147b, 0x1000, 0x0, 0x0, ...})
	/Users/runner/go/pkg/mod/github.com/dgraph-io/badger/[email protected]/table/table.go:308 +0x272
github.com/dgraph-io/badger/v3.newLevelsController.func1({0xc00015e310, 0x70}, {0x64?, 0x43040a32226e6f69?, 0x1265646f?})
	/Users/runner/go/pkg/mod/github.com/dgraph-io/badger/[email protected]/levels.go:150 +0x1f9
created by github.com/dgraph-io/badger/v3.newLevelsController
	/Users/runner/go/pkg/mod/github.com/dgraph-io/badger/[email protected]/levels.go:129 +0x585

Nic0 avatar Dec 11 '23 07:12 Nic0

Same Problem here

This is the most severe Bug i am experiencing with Anytype at the moment → this already did cost me major loss of data

Also using Local-Only mode, but the problem has already been there before running online-mode

In my case its a problem, that my system basically never has access to sync → Thats why i am using Local Only mode (which is perfect for my usecase)

For this topic i think there is already a bigger thread in the community forum

I could offer to synthetically crash on purpose and provide logs for the problem

If i should do this, could you give me some orders what and how to log?

Running non Windows BTW

SHU-red avatar Jan 19 '24 09:01 SHU-red

I did one more test --> Just cancelling Anytype via Windows Task manager does not lead to the same situation

After i shut down anytype the "Anytype Helper" dialog came up But after re-opening anytype it started normally

So i think the problem only exists if like windows powers down and that does kill anytype in a different way

SHU-red avatar Jan 19 '24 14:01 SHU-red

Anyways, due to the fact that this is very problematic for me (and other users i know), i just crashed my PC on purpose and zipped as much logs as i can get

I attached them here to this comment and hope it brings light into the dark anytype_logs_afterCrash.zip anytype_logs_beforeCrash.zip

SHU-red avatar Jan 19 '24 14:01 SHU-red

Hello @SHU-red and @Nic0! We've fixed the issue that may leads to the db corruption on windows in case of BSOD or power failure in the release v0.30.7 of anytype-heart. It's included since desktop v0.37.14-beta.

You said that you use the local-only mode, which means you don't have a backup? Maybe you have another device with the anytype installed? If there is no backup we may try to recover your db manually

requilence avatar Jan 19 '24 15:01 requilence

So, I have created the tool to fix the corrupted db.

Instructions for Windows Users Step 1: Downloading Badger

Go to https://github.com/anyproto/badger/releases/tag/v0.0.4 Download for Windows: Look for the Badger release suitable for Windows.

Step 2: Accessing PowerShell

Open PowerShell: Press Windows Key + X and select “Windows PowerShell” from the menu. Alternatively, you can search for “PowerShell” in the Start menu. Step 3: Running Badger

Navigate to the Download Folder: In the PowerShell window, use the cd command to change the directory to where you downloaded badger.exe. For example, if it's in your Downloads folder, you would type cd Downloads. Run Badger: Execute the following command:

.\badger.exe --dir <spacestore_db_path> fix

Replace <spacestore_db_path> with the actual path to your Spacestore database. Finding the AppData for the "anytype" App

The "anytype" app, being an Electron app, stores its data in the AppData folder on your Windows system. To find this:

Open File Explorer: Press Windows Key + E to open the File Explorer. Access AppData: Type %AppData% in the address bar of the File Explorer and press Enter. This will take you to the C:\Users[YourUsername]\AppData\Roaming folder. Locate Anytype Folder: In the Roaming folder, look for a folder named anytype. Inside it you should find "data/<accountId>" folder. In case you use beta channel it will be "beta/data/<accountId>". Within this folder you will find "spacestore" folder. You need to take it path and put it to the command

This tool creates the backup of the corrupted db before trying to fix it. Backup will be stored at "spacestore_corrupted_backup_

requilence avatar Jan 19 '24 20:01 requilence

Well done! Thank you @requilence Next time I'll crash Windows, I'll test your tool.

Nic0 avatar Jan 20 '24 06:01 Nic0