Dgraph on Windows Fails on start - "Truncating MMapped File" Error

I installed dgraph on windows using go get -v github.com/dgraph-io/dgraph/dgraph. when I run the command dgraph it runs and I get the help output. When I run the command dgraph alpha -l 2048 It starts, but then immediately errors out with the message (I put the full output at bottom of post).

2019/09/17 10:10:03 truncate w\000000.vlog: The requested operation cannot be performed on a file with a user-mapped section open. During db.vlog.open

I looked around, and only thing I could find is a closed issue in badger from 2017 that mentioned issue with truncation on windows, but it seems to be fixed. I looked in the code and see comments that mention “truncate before mmap here, otherwise windows will panic” so I’m wondering if the code isn’t catching that I’m in a windows environment.

It seems to me like this might be a regression error in badger / dgraph running on windows. At the same time, I’m not sure if there are just certain options / configs I just need to edit. I know running on windows isn’t exactly recommended, but for this project its a requirement and the docker solution isn’t an option for several reason.

Really impressed with dgraph - any help would be greatly appreciated. Output attached.


Dgraph version   :
Dgraph SHA-256   : a0bc7b169abdab2832ad838538b0630c791669193883ee7215928c380c1dfebf
Commit SHA-1     :
Commit timestamp :
Branch           :
Go version       : go1.13

...

I0917 10:10:03.560111   11396 run.go:500] x.Config: {PortOffset:0 QueryEdgeLimit:1000000 NormalizeNodeLimit:10000}
I0917 10:10:03.560111   11396 run.go:501] x.WorkerConfig: {ExportPath:export NumPendingProposals:256 Tracing:1 MyAddr: ZeroAddr:localhost:5080 RaftId:0 WhiteListedIPRanges:[] MaxRetries:-1 StrictMutations:false AclEnabled:false AbortOlderThan:5m0s SnapshotAfter:10000}
I0917 10:10:03.560111   11396 run.go:502] edgraph.Config: {PostingDir:p BadgerTables:mmap BadgerVlog:mmap WALDir:w MutationsMode:0 AuthToken: AllottedMemory:2048.0MB AccessJwtTtl:0s RefreshJwtTtl:0s AclRefreshInterval:0s}
I0917 10:10:03.561113   11396 server.go:133] Setting Badger table load option: mmap
I0917 10:10:03.561113   11396 server.go:145] Setting Badger value log load option: mmap
I0917 10:10:03.562095   11396 server.go:173] Opening write-ahead log BadgerDB with options: {Dir:w ValueDir:w SyncWrites:false TableLoadingMode:1 ValueLogLoadingMode:2 NumVersionsToKeep:1 ReadOnly:false Truncate:true Logger:0x1ca16a8 MaxTableSize:67108864 LevelSizeMultiplier:10 MaxLevels:7 ValueThreshold:1048576 NumMemtables:5 BlockSize:4096 BloomFalsePositive:0.01 NumLevelZeroTables:5 NumLevelZeroTablesStall:10 LevelOneSize:268435456 ValueLogFileSize:1073741823 ValueLogMaxEntries:10000 NumCompactors:2 CompactL0OnClose:true LogRotatesToFlush:2 ChecksumVerificationMode:0 managedTxns:false maxBatchCount:0 maxBatchSize:0}
I0917 10:10:03.577099   11396 log.go:34] All 0 tables opened in 0s
2019/09/17 10:10:03 truncate w\000000.vlog: The requested operation cannot be performed on a file with a user-mapped section open.
During db.vlog.open
github.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger/y.Wrapf
        C:/Users/Mike/go/src/github.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger/y/error.go:82
github.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger.Open
        C:/Users/Mike/go/src/github.com/dgraph-io/dgraph/vendor/github.com/dgraph-io/badger/db.go:323
github.com/dgraph-io/dgraph/edgraph.(*ServerState).initStorage
        C:/Users/Mike/go/src/github.com/dgraph-io/dgraph/edgraph/server.go:174
github.com/dgraph-io/dgraph/edgraph.InitServerState
        C:/Users/Mike/go/src/github.com/dgraph-io/dgraph/edgraph/server.go:97
github.com/dgraph-io/dgraph/dgraph/cmd/alpha.run
        C:/Users/Mike/go/src/github.com/dgraph-io/dgraph/dgraph/cmd/alpha/run.go:504
github.com/dgraph-io/dgraph/dgraph/cmd/alpha.init.2.func1
        C:/Users/Mike/go/src/github.com/dgraph-io/dgraph/dgraph/cmd/alpha/run.go:87
github.com/dgraph-io/dgraph/vendor/github.com/spf13/cobra.(*Command).execute
        C:/Users/Mike/go/src/github.com/dgraph-io/dgraph/vendor/github.com/spf13/cobra/command.go:702
github.com/dgraph-io/dgraph/vendor/github.com/spf13/cobra.(*Command).ExecuteC
        C:/Users/Mike/go/src/github.com/dgraph-io/dgraph/vendor/github.com/spf13/cobra/command.go:783
github.com/dgraph-io/dgraph/vendor/github.com/spf13/cobra.(*Command).Execute
        C:/Users/Mike/go/src/github.com/dgraph-io/dgraph/vendor/github.com/spf13/cobra/command.go:736
github.com/dgraph-io/dgraph/dgraph/cmd.Execute
        C:/Users/Mike/go/src/github.com/dgraph-io/dgraph/dgraph/cmd/root.go:68
main.main
        C:/Users/Mike/go/src/github.com/dgraph-io/dgraph/dgraph/main.go:33
runtime.main
        c:/go/src/runtime/proc.go:203
runtime.goexit
        c:/go/src/runtime/asm_amd64.s:1357
Error while creating badger KV WAL store
github.com/dgraph-io/dgraph/x.Checkf
        C:/Users/Mike/go/src/github.com/dgraph-io/dgraph/x/error.go:49
github.com/dgraph-io/dgraph/edgraph.(*ServerState).initStorage
        C:/Users/Mike/go/src/github.com/dgraph-io/dgraph/edgraph/server.go:175
github.com/dgraph-io/dgraph/edgraph.InitServerState
        C:/Users/Mike/go/src/github.com/dgraph-io/dgraph/edgraph/server.go:97
github.com/dgraph-io/dgraph/dgraph/cmd/alpha.run
        C:/Users/Mike/go/src/github.com/dgraph-io/dgraph/dgraph/cmd/alpha/run.go:504
github.com/dgraph-io/dgraph/dgraph/cmd/alpha.init.2.func1
        C:/Users/Mike/go/src/github.com/dgraph-io/dgraph/dgraph/cmd/alpha/run.go:87
github.com/dgraph-io/dgraph/vendor/github.com/spf13/cobra.(*Command).execute
        C:/Users/Mike/go/src/github.com/dgraph-io/dgraph/vendor/github.com/spf13/cobra/command.go:702
github.com/dgraph-io/dgraph/vendor/github.com/spf13/cobra.(*Command).ExecuteC
        C:/Users/Mike/go/src/github.com/dgraph-io/dgraph/vendor/github.com/spf13/cobra/command.go:783
github.com/dgraph-io/dgraph/vendor/github.com/spf13/cobra.(*Command).Execute
        C:/Users/Mike/go/src/github.com/dgraph-io/dgraph/vendor/github.com/spf13/cobra/command.go:736
github.com/dgraph-io/dgraph/dgraph/cmd.Execute
        C:/Users/Mike/go/src/github.com/dgraph-io/dgraph/dgraph/cmd/root.go:68
main.main
        C:/Users/Mike/go/src/github.com/dgraph-io/dgraph/dgraph/main.go:33
runtime.main
        c:/go/src/runtime/proc.go:203
runtime.goexit
        c:/go/src/runtime/asm_amd64.s:1357

This is a known issue Importing movies dataset breaks Dgraph v1.1.0-rc1 on Windows 10 · Issue #3800 · dgraph-io/dgraph · GitHub and we have a fix for it merged in badger and should be merged in Dgraph soon Vendor latest badger by jarifibrahim · Pull Request #4007 · dgraph-io/dgraph · GitHub.

Awesome - thanks so much! Checked out the dgraph repo under my go src tree, then did git checkout ibrahim/badger-update && go get ./dgraph - worked like a charm!

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