Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WSL Fault under Ubuntu impacting Docker #144

Closed
Downchuck opened this issue Jan 31, 2019 · 5 comments
Closed

WSL Fault under Ubuntu impacting Docker #144

Downchuck opened this issue Jan 31, 2019 · 5 comments

Comments

@Downchuck
Copy link

Noted from here microsoft/WSL#3162 it seems BBolt is falling apart under WSL.
This is impacting docker boot-up.

panic: invalid page type: 0: 4

goroutine 1 [running]:
github.com/docker/docker/vendor/go.etcd.io/bbolt.(*Cursor).search(0xc420a72bc0, 0xc420a72c70, 0x6, 0x20, 0x4)
        /go/src/github.com/docker/docker/vendor/go.etcd.io/bbolt/cursor.go:250 +0x38a
github.com/docker/docker/vendor/go.etcd.io/bbolt.(*Cursor).seek(0xc420a72bc0, 0xc420a72c70, 0x6, 0x20, 0x0, 0x0, 0xc420710458, 0x0, 0xc42005ac00, 0xc420a72c20, ...)
        /go/src/github.com/docker/docker/vendor/go.etcd.io/bbolt/cursor.go:159 +0xa7
github.com/docker/docker/vendor/go.etcd.io/bbolt.(*Bucket).Bucket(0xc42003ab78, 0xc420a72c70, 0x6, 0x20, 0xc420a72c70)
        /go/src/github.com/docker/docker/vendor/go.etcd.io/bbolt/bucket.go:105 +0xe0
github.com/docker/docker/vendor/go.etcd.io/bbolt.(*Tx).Bucket(0xc42003ab60, 0xc420a72c70, 0x6, 0x20, 0x6)
        /go/src/github.com/docker/docker/vendor/go.etcd.io/bbolt/tx.go:101 +0x51
github.com/docker/docker/vendor/github.com/moby/buildkit/solver/bboltcachestorage.(*Store).Walk.func1(0xc42003ab60, 0x7f3f633da1e0, 0xc42003ab60)
        /go/src/github.com/docker/docker/vendor/github.com/moby/buildkit/solver/bboltcachestorage/storage.go:60 +0x8c
github.com/docker/docker/vendor/go.etcd.io/bbolt.(*DB).View(0xc4209310e0, 0xc420a72d70, 0x0, 0x0)
        /go/src/github.com/docker/docker/vendor/go.etcd.io/bbolt/db.go:701 +0x92
github.com/docker/docker/vendor/github.com/moby/buildkit/solver/bboltcachestorage.(*Store).Walk(0xc420710440, 0xc42097eee0, 0x7f3f5fad0601, 0xc420823ea0)
        /go/src/github.com/docker/docker/vendor/github.com/moby/buildkit/solver/bboltcachestorage/storage.go:59 +0x8d
github.com/docker/docker/vendor/github.com/moby/buildkit/solver.(*cacheManager).ReleaseUnreferenced(0xc420823ea0, 0xc420823ea0, 0xc420a72e18)
        /go/src/github.com/docker/docker/vendor/github.com/moby/buildkit/solver/cachemanager.go:42 +0x70
github.com/docker/docker/vendor/github.com/moby/buildkit/solver.NewCacheManager(0x7f3f62793de7, 0x5, 0x7f3f634245e0, 0xc420710440, 0x7f3f63411020, 0xc420710450, 0xc420a72e88, 0x7f3f611d80fa)
        /go/src/github.com/docker/docker/vendor/github.com/moby/buildkit/solver/cachemanager.go:26 +0xb2
github.com/docker/docker/vendor/github.com/moby/buildkit/control.NewController(0xc4207036a0, 0xc4207134c0, 0xc4209d6ab0, 0x7f3f634245e0, 0xc420710440, 0x0, 0xc420703aa0, 0x0, 0x0, 0x0)
        /go/src/github.com/docker/docker/vendor/github.com/moby/buildkit/control/control.go:50 +0xc4
github.com/docker/docker/builder/builder-next.newController(0x7f3f633eb360, 0xc420703700, 0xc4207036a0, 0xc42074a420, 0x18, 0x7f3f633eb780, 0xc420929180, 0x7f3f63415460, 0xc42097ed90, 0x7f3f63424260, ...)
        /go/src/github.com/docker/docker/builder/builder-next/controller.go:169 +0xe12
github.com/docker/docker/builder/builder-next.New(0xc4207036a0, 0xc42074a420, 0x18, 0x7f3f633eb780, 0xc420929180, 0x7f3f63415460, 0xc42097ed90, 0x7f3f63424260, 0xc420754fa0, 0x7f3f63424960, ...)
        /go/src/github.com/docker/docker/builder/builder-next/builder.go:93 +0xf5
main.newRouterOptions(0xc4206c6000, 0xc4208d21e0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /go/src/github.com/docker/docker/cmd/dockerd/daemon.go:292 +0x700
main.(*DaemonCli).start(0xc420704780, 0xc42071a180, 0x0, 0x0)
        /go/src/github.com/docker/docker/cmd/dockerd/daemon.go:216 +0xade
main.runDaemon(0xc42071a180, 0xc42015a300, 0x0)
        /go/src/github.com/docker/docker/cmd/dockerd/docker_unix.go:7 +0x47
main.newDaemonCommand.func1(0xc4206c8000, 0xc420708940, 0x0, 0x1, 0x0, 0x0)
        /go/src/github.com/docker/docker/cmd/dockerd/docker.go:29 +0x5d
github.com/docker/docker/vendor/github.com/spf13/cobra.(*Command).execute(0xc4206c8000, 0xc42000c0b0, 0x1, 0x1, 0xc4206c8000, 0xc42000c0b0)
        /go/src/github.com/docker/docker/vendor/github.com/spf13/cobra/command.go:762 +0x46a
github.com/docker/docker/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc4206c8000, 0x7f3f633e56f0, 0x7f3f62faa640, 0x7f3f633e5700)
        /go/src/github.com/docker/docker/vendor/github.com/spf13/cobra/command.go:852 +0x30c
github.com/docker/docker/vendor/github.com/spf13/cobra.(*Command).Execute(0xc4206c8000, 0xc42000e020, 0x7f3f61296b6f)
        /go/src/github.com/docker/docker/vendor/github.com/spf13/cobra/command.go:800 +0x2d
main.main()
        /go/src/github.com/docker/docker/cmd/dockerd/docker.go:70 +0xa2
@rustyx
Copy link

rustyx commented Jun 10, 2019

Same issue with etcd on WSL:

$ etcd
2019-06-10 17:21:46.487677 I | etcdmain: etcd Version: 3.3.13
2019-06-10 17:21:46.488008 I | etcdmain: Git SHA: 98d308426
2019-06-10 17:21:46.488017 I | etcdmain: Go Version: go1.12.5
2019-06-10 17:21:46.488025 I | etcdmain: Go OS/Arch: linux/amd64
2019-06-10 17:21:46.488037 I | etcdmain: setting maximum number of CPUs to 8, total number of available CPUs is 8
2019-06-10 17:21:46.488052 W | etcdmain: no data-dir provided, using default data-dir ./default.etcd
2019-06-10 17:21:46.489419 I | embed: listening for peers on http://localhost:2380
2019-06-10 17:21:46.489690 I | embed: listening for client requests on localhost:2379
2019-06-10 17:21:46.495427 I | etcdserver: name = default
2019-06-10 17:21:46.495466 I | etcdserver: data dir = default.etcd
2019-06-10 17:21:46.495481 I | etcdserver: member dir = default.etcd/member
2019-06-10 17:21:46.495489 I | etcdserver: heartbeat = 100ms
2019-06-10 17:21:46.495496 I | etcdserver: election = 1000ms
2019-06-10 17:21:46.495504 I | etcdserver: snapshot count = 100000
2019-06-10 17:21:46.495529 I | etcdserver: advertise client URLs = http://localhost:2379
2019-06-10 17:21:46.495546 I | etcdserver: initial advertise peer URLs = http://localhost:2380
2019-06-10 17:21:46.495582 I | etcdserver: initial cluster = default=http://localhost:2380
2019-06-10 17:21:46.499407 I | wal: releasing file lock to rename "default.etcd/member/wal.tmp" to "default.etcd/member/wal"
2019-06-10 17:21:46.502517 I | etcdserver: starting member 8e9e05c52164694d in cluster cdf818194e3a8c32
2019-06-10 17:21:46.502549 I | raft: 8e9e05c52164694d became follower at term 0
2019-06-10 17:21:46.502565 I | raft: newRaft 8e9e05c52164694d [peers: [], term: 0, commit: 0, applied: 0, lastindex: 0, lastterm: 0]
2019-06-10 17:21:46.502576 I | raft: 8e9e05c52164694d became follower at term 1
panic: invalid page type: 0: 4

goroutine 1 [running]:
github.com/coreos/etcd/cmd/vendor/github.com/coreos/bbolt.(*Cursor).search(0xc00021c308, 0x174e050, 0x3, 0x3, 0x4)
        /go/src/github.com/coreos/etcd/cmd/vendor/github.com/coreos/bbolt/cursor.go:256 +0x354
github.com/coreos/etcd/cmd/vendor/github.com/coreos/bbolt.(*Cursor).seek(0xc00021c308, 0x174e050, 0x3, 0x3, 0x5000, 0x0, 0x2, 0x2000, 0x203000, 0x203000, ...)
        /go/src/github.com/coreos/etcd/cmd/vendor/github.com/coreos/bbolt/cursor.go:159 +0x7e
github.com/coreos/etcd/cmd/vendor/github.com/coreos/bbolt.(*Bucket).CreateBucket(0xc00031c1d8, 0x174e050, 0x3, 0x3, 0xc000000008, 0xed9b88, 0x60)
        /go/src/github.com/coreos/etcd/cmd/vendor/github.com/coreos/bbolt/bucket.go:165 +0xf0
github.com/coreos/etcd/cmd/vendor/github.com/coreos/bbolt.(*Tx).CreateBucket(...)
        /go/src/github.com/coreos/etcd/cmd/vendor/github.com/coreos/bbolt/tx.go:108
github.com/coreos/etcd/cmd/vendor/github.com/coreos/etcd/mvcc/backend.(*batchTx).UnsafeCreateBucket(0xc0001b3830, 0x174e050, 0x3, 0x3)
        /go/src/github.com/coreos/etcd/cmd/vendor/github.com/coreos/etcd/mvcc/backend/batch_tx.go:48 +0x61
github.com/coreos/etcd/cmd/vendor/github.com/coreos/etcd/mvcc.NewStore(0x10134e0, 0xc0001d36c0, 0x1017180, 0xc0005b83c0, 0xfe9ba0, 0xc000228a18, 0xc000000008)
        /go/src/github.com/coreos/etcd/cmd/vendor/github.com/coreos/etcd/mvcc/kvstore.go:130 +0x38a
github.com/coreos/etcd/cmd/vendor/github.com/coreos/etcd/mvcc.newWatchableStore(0x10134e0, 0xc0001d36c0, 0x1017180, 0xc0005b83c0, 0xfe9ba0, 0xc000228a18, 0x5f5e100)
        /go/src/github.com/coreos/etcd/cmd/vendor/github.com/coreos/etcd/mvcc/watchable_store.go:76 +0x76
github.com/coreos/etcd/cmd/vendor/github.com/coreos/etcd/mvcc.New(...)
        /go/src/github.com/coreos/etcd/cmd/vendor/github.com/coreos/etcd/mvcc/watchable_store.go:71
github.com/coreos/etcd/cmd/vendor/github.com/coreos/etcd/etcdserver.NewServer(0xe95354, 0x7, 0x0, 0x0, 0x0, 0x0, 0xc000232800, 0x1, 0x1, 0xc000232700, ...)
        /go/src/github.com/coreos/etcd/cmd/vendor/github.com/coreos/etcd/etcdserver/server.go:449 +0x16f1
github.com/coreos/etcd/cmd/vendor/github.com/coreos/etcd/embed.StartEtcd(0xc00022a480, 0xc00022a900, 0x0, 0x0)
        /go/src/github.com/coreos/etcd/cmd/vendor/github.com/coreos/etcd/embed/etcd.go:179 +0x7da
github.com/coreos/etcd/cmd/vendor/github.com/coreos/etcd/etcdmain.startEtcd(0xc00022a480, 0xe9250f, 0x3, 0x1, 0xc00021ed50)
        /go/src/github.com/coreos/etcd/cmd/vendor/github.com/coreos/etcd/etcdmain/etcd.go:181 +0x40
github.com/coreos/etcd/cmd/vendor/github.com/coreos/etcd/etcdmain.startEtcdOrProxyV2()
        /go/src/github.com/coreos/etcd/cmd/vendor/github.com/coreos/etcd/etcdmain/etcd.go:111 +0x1514
github.com/coreos/etcd/cmd/vendor/github.com/coreos/etcd/etcdmain.Main()
        /go/src/github.com/coreos/etcd/cmd/vendor/github.com/coreos/etcd/etcdmain/main.go:46 +0x38
main.main()
        /go/src/github.com/coreos/etcd/cmd/etcd/main.go:28 +0x20
$

@xiang90
Copy link
Contributor

xiang90 commented Jun 10, 2019

is this a boltdb issue or a WSL issue?

@rustyx
Copy link

rustyx commented Jun 10, 2019

WSL. It seems to be fixed in 18912 (prerelease).

@xiang90
Copy link
Contributor

xiang90 commented Jun 10, 2019

thanks. then i will close the issue on boltdb side.

@krader1961
Copy link

This issue is not fixed. The problem is caused by creating the DB with 16 KiB of data then calling mmap() with a size of 32 KiB. That's legal on most UNIX implementations but not WSL. Forcing the initial file size to be 32 KiB by doubling the the number of meta pages "fixes" the problem. That is changing the *4 to *8` in this block of code:

bbolt/db.go

Lines 426 to 428 in 68cc10a

func (db *DB) init() error {
// Create two meta pages on a buffer.
buf := make([]byte, db.pageSize*4)

That is obviously a hack but it illustrates that the code is relying on being able to mmap() past the end of the backing file. That works on most UNIX-like systems but should not be relied upon if you care about portability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants