jstaf / onedriver

A native Linux filesystem for Microsoft OneDrive
GNU General Public License v3.0
1.92k stars 96 forks source link

onedriver crashes with message "slice bounds out of range" #255

Open teras opened 2 years ago

teras commented 2 years ago

When I run onedriver with debug enabled and I try to directly create a borgbackup on onedrive, I get after working for a few minutes, the following error:. Any ideas?

2022/05/03 00:41:24 rx 110708: WRITE n34 {Fh 0 [213639168 +65536)  L 0 WRONLY,0x8000} "x\xa6\x1e\x05\xb6\xb4F_"... 65536b
2022/05/03 00:41:24 tx 110708:     OK
2022/05/03 00:41:24 rx 110710: WRITE n34 {Fh 0 [213704704 +65536)  L 0 WRONLY,0x8000} "\xfcM\x95\xad_\xd7e\xba"... 65536b
2022/05/03 00:41:24 tx 110710:     OK
2022/05/03 00:41:24 rx 110712: WRITE n34 {Fh 0 [213770240 +65536)  L 0 WRONLY,0x8000} "\x10_L\xfa\\\x11]\xa0"... 65536b
2022/05/03 00:41:24 tx 110712:     OK
2022/05/03 00:41:24 rx 110714: WRITE n34 {Fh 0 [213835776 +65536)  L 0 WRONLY,0x8000} "\x90\xb5D\xf7\x0fL\u007f\xd4"... 65536b
2022/05/03 00:41:24 tx 110714:     OK
2022/05/03 00:41:24 rx 110716: WRITE n34 {Fh 0 [213901312 +31940)  L 0 WRONLY,0x8000} "\xdf\xe4\f\x05\xa7dZ\x00"... 31940b
2022/05/03 00:41:24 tx 110716:     OK
panic: runtime error: slice bounds out of range [::2806083047] with length 2147483647

goroutine 51 [running]:
go.etcd.io/bbolt.unsafeByteSlice(...)
    go.etcd.io/bbolt@v1.3.5/unsafe.go:27
go.etcd.io/bbolt.(*leafPageElement).value(...)
    go.etcd.io/bbolt@v1.3.5/page.go:133
go.etcd.io/bbolt.(*node).read(0xc0014761c0, 0x7f7c3dae0000)
    go.etcd.io/bbolt@v1.3.5/node.go:172 +0x367
go.etcd.io/bbolt.(*Bucket).node(0xc0008e8b80, 0x7d6dc, 0x0)
    go.etcd.io/bbolt@v1.3.5/bucket.go:666 +0x1f7
go.etcd.io/bbolt.(*Cursor).node(0xc000669ce8)
    go.etcd.io/bbolt@v1.3.5/cursor.go:365 +0x85
go.etcd.io/bbolt.(*Bucket).Put(0xc0008e8b80, {0xc0005725c0, 0x1a, 0x20}, {0xc18c3a2000, 0x29b7a061, 0x29b7c000})
    go.etcd.io/bbolt@v1.3.5/bucket.go:304 +0x1a9
github.com/jstaf/onedriver/fs.(*UploadManager).uploadLoop.func1(0xc0000a8680?)
    github.com/jstaf/onedriver/fs/upload_manager.go:80 +0x96
go.etcd.io/bbolt.(*DB).Update(0x562e1eeb8ba0?, 0xc000660030)
    go.etcd.io/bbolt@v1.3.5/db.go:694 +0x82
go.etcd.io/bbolt.(*DB).Batch(0xc000190000, 0xc000660030)
    go.etcd.io/bbolt@v1.3.5/db.go:772 +0x325
github.com/jstaf/onedriver/fs.(*UploadManager).uploadLoop(0xc00007c4c0, 0xc0000d8b40?)
    github.com/jstaf/onedriver/fs/upload_manager.go:76 +0x1fc
created by github.com/jstaf/onedriver/fs.NewUploadManager
    github.com/jstaf/onedriver/fs/upload_manager.go:61 +0x1b6
jstaf commented 2 years ago

That's a weird bug I've run into once before - didn't have a way to reproduce it in that case though. You can follow the directions in that issue to fix things in the meantime https://github.com/jstaf/onedriver/issues/234

I will try to take a look once I get the chance.

teras commented 2 years ago

Thank you, I tried to use this method, but my backup still fails at some time, although in the beginning it seems to work. TO be honest I've moved from borgbackup to a more promising restic backup instead (which directly talks with OneDrive).

For general usage, onedriver works for me, so for now I'll stay with the basic functionality. Thank you!

Zeratoxx commented 11 months ago

+1 ; I get this error message too:

panic: runtime error: slice bounds out of range [::2562408940] with length 2147483647

goroutine 1 [running]:
go.etcd.io/bbolt.unsafeByteSlice(...)
        /usr/src/packages/BUILD/vendor/go.etcd.io/bbolt/unsafe.go:27
go.etcd.io/bbolt.(*leafPageElement).value(...)
        /usr/src/packages/BUILD/vendor/go.etcd.io/bbolt/page.go:133
go.etcd.io/bbolt.(*node).read(0xc0044e8930, 0x7f0eb9929000)
        /usr/src/packages/BUILD/vendor/go.etcd.io/bbolt/node.go:172 +0x367
go.etcd.io/bbolt.(*Bucket).node(0xc000012400, 0x11db29, 0xc0000b3650)
        /usr/src/packages/BUILD/vendor/go.etcd.io/bbolt/bucket.go:666 +0x1fa
go.etcd.io/bbolt.(*node).childAt(0x0?, 0xc000122070?)
        /usr/src/packages/BUILD/vendor/go.etcd.io/bbolt/node.go:77 +0x45
go.etcd.io/bbolt.(*Cursor).node(0xc0070d7740?)
        /usr/src/packages/BUILD/vendor/go.etcd.io/bbolt/cursor.go:369 +0x149
go.etcd.io/bbolt.(*Bucket).Delete(0xc000012400, {0x7f0eb9929040, 0x16, 0x16})
        /usr/src/packages/BUILD/vendor/go.etcd.io/bbolt/bucket.go:334 +0xe7
github.com/jstaf/onedriver/fs.NewFilesystem.func1.1({0x7f0eb9929040, 0x16, 0x16}, {0x7f0eb9929056, 0x3d5bf3a0, 0x3d5bf3a0})
        /usr/src/packages/BUILD/fs/cache.go:89 +0xee
go.etcd.io/bbolt.(*Bucket).ForEach(0xc000012400, 0xc0070d7890)
        /usr/src/packages/BUILD/vendor/go.etcd.io/bbolt/bucket.go:390 +0xa4
github.com/jstaf/onedriver/fs.NewFilesystem.func1(0x7f1d9a681108?)
        /usr/src/packages/BUILD/fs/cache.go:84 +0x169
go.etcd.io/bbolt.(*DB).Update(0xc00001c2c0?, 0xc00013fa20)
        /usr/src/packages/BUILD/vendor/go.etcd.io/bbolt/db.go:741 +0x82
github.com/jstaf/onedriver/fs.NewFilesystem(0xc00016a3f0, {0xc000024480, 0x30})
        /usr/src/packages/BUILD/fs/cache.go:71 +0x2ab
main.main()
        /usr/src/packages/BUILD/cmd/onedriver/main.go:128 +0xb36
jstaf commented 10 months ago

@Zeratoxx What version of onedriver are you using here? File contents don't get stored in boltdb anymore (in 0.14+) and that looks like it's an error with boltdb.

PeterJudgeZA commented 10 months ago

I see the same error with 0.14.1 on Ubuntu Budgie 23.10 .

2:16:31 INF onedriver v0.14.1 15a1c642
panic: runtime error: slice bounds out of range [::2229335823] with length 2147483647

goroutine 1 [running]:
go.etcd.io/bbolt.unsafeByteSlice(...)
    /usr/src/packages/BUILD/vendor/go.etcd.io/bbolt/unsafe.go:27
go.etcd.io/bbolt.(*leafPageElement).value(...)
    /usr/src/packages/BUILD/vendor/go.etcd.io/bbolt/page.go:133
go.etcd.io/bbolt.(*Cursor).keyValue(0xc00a31d7d8?)
    /usr/src/packages/BUILD/vendor/go.etcd.io/bbolt/cursor.go:350 +0x157
go.etcd.io/bbolt.(*Cursor).next(0xc00a31d7d8)
    /usr/src/packages/BUILD/vendor/go.etcd.io/bbolt/cursor.go:242 +0xcf
go.etcd.io/bbolt.(*Cursor).Next(0xc00019b7d8?)
    /usr/src/packages/BUILD/vendor/go.etcd.io/bbolt/cursor.go:75 +0x27
go.etcd.io/bbolt.(*Bucket).ForEach(0xc00a3ac018?, 0xc00a31d838)
    /usr/src/packages/BUILD/vendor/go.etcd.io/bbolt/bucket.go:389 +0x74
github.com/jstaf/onedriver/fs.NewUploadManager.func1(0xc000030e40?)
    /usr/src/packages/BUILD/fs/upload_manager.go:46 +0x85
go.etcd.io/bbolt.(*DB).View(0xc00a3a6000?, 0xc00019b8f8)
    /usr/src/packages/BUILD/vendor/go.etcd.io/bbolt/db.go:772 +0x72
github.com/jstaf/onedriver/fs.NewUploadManager(0x77359400, 0xc000148fc0, 0xc00011a4e0, 0xc0001ac090)
    /usr/src/packages/BUILD/fs/upload_manager.go:37 +0x156
github.com/jstaf/onedriver/fs.NewFilesystem(0xc0001ac090, {0xc000192140, 0x4d})
    /usr/src/packages/BUILD/fs/cache.go:147 +0x577
main.main()
    /usr/src/packages/BUILD/cmd/onedriver/main.go:128 +0x9d4
PeterJudgeZA commented 10 months ago

I RTFM (aka the Troubleshooting section), and ran onedriver -w. After doing that, onedriver works as expected.