Biscync: panic: page 33 already freed

What is the problem you are having with rclone?

Bisync results in error panic: page 33 already freed and hangs.

Run the command 'rclone version' and share the full output of the command.

rclone v1.68.0
- os/version: ubuntu 22.04 (64 bit)
- os/kernel: 5.15.0-121-generic (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.23.1
- go/linking: static
- go/tags: none

Which cloud storage system are you using? (eg Google Drive)

IDrive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

First occurred resuming from hibernate during a run without --recover but log below is from using --resync instead:

rclone bisync "idrive-sync-hasher:/" "/home/salty/sync/" --check-access --fast-list --verbose --filter-from=/home/salty/.config/rclone/filters --links --compare size,modtime,checksum --log-file="$temp_log" --error-on-no-transfer --conflict-resolve newer --resilient --resync

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

[idrive-sync]
type = s3
provider = IDrive
access_key_id = XXX
secret_access_key = XXX
acl = private
endpoint = x3k6.ie.idrivee2-50.com
bucket_acl = private
no_check_bucket = true
server_side_encryption = aws:kms

[idrive-sync-crypt]
type = crypt
remote = idrive-sync:sync
password = XXX
password2 = XXX
filename_encoding = base32768

[idrive-sync-hasher]
type = hasher
remote = idrive-sync-crypt:
hashes = md5
max_age = 3M
auto_size = 107374182400

A log from the command that you were trying to run with the -vv flag

2024/09/18 08:36:19 INFO  : Hasher is EXPERIMENTAL!
2024/09/18 08:36:19 NOTICE: bisync is IN BETA. Don't use in production!
2024/09/18 08:36:19 INFO  : Bisyncing with Comparison Settings: 
{
	"Modtime": true,
	"Size": true,
	"Checksum": true,
	"HashType1": 1,
	"HashType2": 1,
	"NoSlowHash": false,
	"SlowHashSyncOnly": false,
	"SlowHashDetected": true,
	"DownloadHash": false
}
2024/09/18 08:36:19 INFO  : Synching Path1 "idrive-sync-hasher:/" with Path2 "local{b6816}:/home/daire/sync/"
2024/09/18 08:36:19 INFO  : Copying Path2 files to Path1
2024/09/18 08:36:19 INFO  : Checking access health
2024/09/18 08:36:49 INFO  : Found 1 matching "RCLONE_TEST" files on both paths
2024/09/18 08:36:49 INFO  : - Path2    Resync is copying files to         - Path1
2024/09/18 08:37:19 INFO  : 
Transferred:   	          0 B / 0 B, -, 0 B/s, ETA -
Checks:                 2 / 2, 100%
Elapsed time:       1m0.0s

2024/09/18 08:38:19 INFO  : 
Transferred:   	          0 B / 0 B, -, 0 B/s, ETA -
Checks:              1309 / 2503, 52%
Elapsed time:       2m0.0s
Checking:
 * code/FinanceToolkit/Fiā€¦nceToolkit-env/bin/ttx: checking
 * Education/mod1234/liā€¦/java/client/Main.java: checking
 *                           code/gflows/LICENSE: checking
 *                          code/gflows/Procfile: checking
 *                         code/gflows/README.md: checking
 *                            code/gflows/app.py: checking
 * Education/mod1234/liā€¦sses/client/Main.class: checking
 * Education/FYP/softhsm-ā€¦retest.vcxproj.filters: checking

panic: page 33 already freed

goroutine 15 [running]:
go.etcd.io/bbolt.(*freelist).free(0xc004134f00, 0x4a01f, 0x7fcb01d6c000)
	go.etcd.io/bbolt@v1.3.10/freelist.go:175 +0x2b4
go.etcd.io/bbolt.(*node).spill(0xc006ac9f10)
	go.etcd.io/bbolt@v1.3.10/node.go:363 +0x192
go.etcd.io/bbolt.(*node).spill(0xc006ac9ea0)
	go.etcd.io/bbolt@v1.3.10/node.go:350 +0x9e
go.etcd.io/bbolt.(*node).spill(0xc006ac9e30)
	go.etcd.io/bbolt@v1.3.10/node.go:350 +0x9e
go.etcd.io/bbolt.(*node).spill(0xc006ac9dc0)
	go.etcd.io/bbolt@v1.3.10/node.go:350 +0x9e
go.etcd.io/bbolt.(*node).spill(0xc006ac9d50)
	go.etcd.io/bbolt@v1.3.10/node.go:350 +0x9e
go.etcd.io/bbolt.(*Bucket).spill(0xc00096e440)
	go.etcd.io/bbolt@v1.3.10/bucket.go:592 +0x365
go.etcd.io/bbolt.(*Bucket).spill(0xc006dda478)
	go.etcd.io/bbolt@v1.3.10/bucket.go:559 +0x105
go.etcd.io/bbolt.(*Tx).Commit(0xc006dda460)
	go.etcd.io/bbolt@v1.3.10/tx.go:163 +0xf9
go.etcd.io/bbolt.(*DB).Update(0xc0000b6100?, 0xc007eb1e78)
	go.etcd.io/bbolt@v1.3.10/db.go:893 +0xca
github.com/rclone/rclone/lib/kv.(*DB).execute(0xc0000b6100, {0x2a61d10, 0x3e49a60}, {0x2a3ad60, 0xc006df0660}, 0x1)
	github.com/rclone/rclone/lib/kv/bolt.go:264 +0xa5
github.com/rclone/rclone/lib/kv.(*request).handle(0xc00096e3c0, {0x2a61d10?, 0x3e49a60?}, 0xc0000b6100)
	github.com/rclone/rclone/lib/kv/bolt.go:254 +0x1ee
github.com/rclone/rclone/lib/kv.(*DB).loop(0xc0000b6100)
	github.com/rclone/rclone/lib/kv/bolt.go:197 +0xf9
created by github.com/rclone/rclone/lib/kv.Start in goroutine 1
	github.com/rclone/rclone/lib/kv/bolt.go:108 +0x67b

How can I resolve this please?

This looks like an upstream bug in the bbolt package, which provides the database used by hasher. It looks like they are aware of it and have made some recent improvements:

^I'm guessing this is what caused it in your case, as it appears to be related to database operations that get interrupted uncleanly, resulting in db corruption.

I wonder if updating the bbolt package to the latest version might help, given their recent fixes? I'm not sure if it will, but it might be worth a try.

Otherwise, I'm not sure if there is a solution other than resetting your hasher db :frowning:

1 Like

Is there an fsck or repair for bolt DBs?

1 Like

Looks like maybe?

I am not very familiar with it, though.

I wonder if it's worth trying to switch to sqlite instead. We now have CGo-free implementations of sqlite and they have pretty good performance.

If I rclone backend drop idrive-sync-hasher:/ will it just rebuild next time I run my bisync command or must I setup the hasher again as I did originally?

I think that should be enough, but I'm not 100% sure (it may be that the db is too corrupted to even get that far). If that doesn't work, what you may need to do is go into the cache directory (usually ~/.cache/rclone/kv/) and delete the corrupt hasher.bolt file.

Either way, yes, it should regenerate the sum cache next time, and you shouldn't have to mess with the config. You can also manually force it to refresh by running rclone hashsum MD5 --download idrive-sync-hasher:

1 Like

Those tools look really low level, for use by bbolt experts only and are not at all the bbolt repair tool that users could actually use :frowning:

That is a possibility... The repair tools are certainly better for sqlite. I wonder how the speed of sqlite compares against bbolt?

1 Like

In general and from previous such migrations, it should be equivalent to bbolt for reads (if not faster) and definitely faster for writes.

Shifting to sqlite will also allow other programs to interact with the DB directly bypassing rclone and will also allow multiple rclone processes to run simultaneously using the same DB, which is not possible with BoltDB.

There are some performance numbers available in these PRs, but Iā€™m not sure how relevant they are:

bolt on master:
    lnd_payment_test.go:348: 	Benchmark info: Elapsed time:  41.977280583s
    lnd_payment_test.go:349: 	Benchmark info: TPS:  11.506224159637577

the branch as is:
    lnd_payment_test.go:348: 	Benchmark info: Elapsed time:  26.357677917s
    lnd_payment_test.go:349: 	Benchmark info: TPS:  18.324831251104936

synchronous=normal + fullfsync=true:
    lnd_payment_test.go:348: 	Benchmark info: Elapsed time:  1.956410833s
    lnd_payment_test.go:349: 	Benchmark info: TPS:  246.8806611847257
Note that this implementation of etcd-on-sqlite uses a pure golang version of sqlite, which is roughly half as fast as the full blown C implementation. Even so, the etcdctl performance tests suggest that the full golang version of sqlite seems roughly on par with bolt (if not a tad bit faster).

That said, I doubt such numbers would matter for most rclone uses since we would be bottlenecked mostly by disk or network I/O.

1 Like

I've been keeping an eye on the modernc sqlite port for a long time now! It seems to be very good now with the benchmarks only 16% slower than the C version.

Once possible problem is the platform support which doesn't include all the platforms rclone supports.

I made a prototype for VFS2 which used bbolt for directory metadata and file metadata storage, but I'd much rather use sqlite for that...

2 Likes

It may be possible to use the WASM version for those platforms not supported by the modernc version. Theoretically, WASM should work on every platform.

This is the WASM version: GitHub - ncruces/go-sqlite3: Go bindings to SQLite using wazero

which uses: GitHub - tetratelabs/wazero: wazero: the zero dependency WebAssembly runtime for Go developers

Per their docs regarding the compiler:

It has zero dependencies, and doesn't rely on CGO. 
This is done without host-specific dependencies.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.