Dgraph does not work with mounted volumes

Hi. I use Dgraph inside Docker within an Ubuntu VM from a Windows 10 Host (scripted using Vagrant) and I noticed few issues when using mounted volumes for storing Dgraph data.

Case 1:

If the mounted volume is an SMB share , it works without any issues

Case 2:

If the mounted volume is a normal synced folder, it fails with thes error which was reported here:

https://github.com/dgraph-io/dgraph/issues/2699

https://github.com/dgraph-io/dgraph/issues/1325

(I don’t use WSL but a normal Ubuntu VM)

Case 3:

If I don’t use the shared folder (from host) within the VM, it works.

So, basically the problem is with the shared folder getting mounted from Windows host to Ubuntu VM.

@joaquin any ideas what’s going on?

While this may no longer be needed for me since I have moved away from Vagrant to hosting my dev env online, it might be relevant to others who face such issues.

This might be related to [Windows] potential directory sync API misuse · Issue #699 · dgraph-io/badger · GitHub which has been fixed.

1 Like

@tvvignesh What is the provider used with Vagrant? Hyper-V? Virtualbox? Do you have a Vagrantfile you could share with us?

@joaquin Virtualbox without HyperV on Win 10 Home with SMB mount. Sure. You can find the vagrantfile below (changed a few things, but you may want to customize it to make it run on your side)

# -*- mode: ruby -*-
# vi: set ft=ruby :

## PLEASE CHANGE THESE ACCORDING TO YOUR OWN NEED

BOX_BASE = "bento/ubuntu-20.04"
# Custom Name for the Vagrant box
BOX_NAME = "tc-ubuntu-workspace"
# amount of RAM for Vagrant box
BOX_RAM_MB = "6144"
# number of CPUs for Vagrant box
BOX_CPU_COUNT = "4"
# Private IP of the BOX
BOX_IP_PRIVATE = "192.168.30.10"
# Hostname of the BOX
HOSTNAME = "host.my"
# Your Email
EMAIL = "xyz@example.com"
# Your Email
FULL_NAME = "My Name"
# SMB USERNAME
SMB_USERNAME = "xyz@example.com"

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|

  config.vm.hostname = HOSTNAME

  config.vm.box = BOX_BASE

  config.ssh.username = "vagrant"

  config.vm.network "forwarded_port", guest: 22, host: 2222, host_ip: "127.0.0.1", id: 'ssh'

  # Create a private network, which allows host-only access to the machine using a specific IP.
  config.vm.network "private_network", ip: BOX_IP_PRIVATE

  config.vm.box_check_update = true

   if Vagrant::Util::Platform.windows? then
     config.vm.synced_folder "../workspace", "/opt/workspace", type: "smb", smb_username: SMB_USERNAME, mount_options: ["mfsymlinks"], owner: "vagrant", group: "vagrant"
   else
    config.vm.synced_folder "../workspace", "/opt/workspace", owner: "vagrant", group: "vagrant"
   end

  # Provider-specific configuration so you can fine-tune various
  # backing providers for Vagrant. These expose provider-specific options.
  # Example for VirtualBox:
  #
  config.vm.provider "virtualbox" do |vb|
    vb.name = BOX_NAME
    # Display the VirtualBox GUI when booting the machine
    # vb.gui = true

    vb.customize ["modifyvm", :id, "--cableconnected1", "on"]

    vb.customize ["modifyvm", :id, "--cpus", BOX_CPU_COUNT]

    vb.memory = BOX_RAM_MB

    vb.customize ["modifyvm", :id, "--accelerate3d", "off"]
    # vb.customize ["modifyvm", :id, "--vram", "128"]

    # integration with host
    vb.customize ["modifyvm", :id, "--clipboard", "bidirectional"]
    # vb.customize ["modifyvm", :id, "--draganddrop", "bidirectional"]

    # vb.customize ["modifyvm", :id, "--audio", "dsound"]
    # vb.customize ["modifyvm", :id, "--audioout", "on"]
    # vb.customize ["modifyvm", :id, "--audioin", "on"]
    # vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]
    # Default host uses a USB mouse instead of PS2
    #vb.customize ["modifyvm", :id, "--mouse", "usb"]
    # Enable the use of hardware virtualization extensions (Intel VT-x or AMD-V) in the processor of your host system
    # vb.customize ["modifyvm", :id, "--hwvirtex", "on"]
    # it is also required if you want to use more than one virtual CPU in a VM.
    # vb.customize ["modifyvm", :id, "--ioapic", "on"]

    vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant","1"]
    vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/opt/workspace","1"]
  end

  # PROVISION SHELL SCRIPTS

  # IMPORT SSH KEYS

  config.vm.provision "file", source: "../my-ssh-keys/id_ed25519.pub", destination: "/home/vagrant/.ssh/id_ed25519.pub"
  config.vm.provision "file", source: "../my-ssh-keys/id_ed25519", destination: "/home/vagrant/.ssh/id_ed25519"

  config.vm.provision "shell", inline: "cat /home/vagrant/.ssh/id_ed25519.pub >> /home/vagrant/.ssh/authorized_keys"

  # UPDATE OS, SETUP GUI, INSTALL ALL THE SOFTWARE AND TOOLS REQUIRED

  # config.vm.provision "shell", path: "./scripts/initial-scripts.sh"
  # config.vm.provision "shell", path: "./scripts/software-setup.sh"
  # config.vm.provision "shell", path: "./scripts/docker.sh"
  # config.vm.provision "shell", path: "./scripts/velero.sh"
  # config.vm.provision "shell", path: "./scripts/terraform.sh"
  # config.vm.provision "shell", path: "./scripts/postinstall.sh", env: {"EMAIL" => EMAIL, "FULL_NAME" => FULL_NAME}
  # TRIGGERS

  config.trigger.after [:provision] do |t|
    t.name = "Reboot after provisioning"
    t.run = { :inline => "vagrant reload" }
  end
end
1 Like

As a compare point, I wanted to try this out Win10Pro w/ Hyper/V. I have another system with Win10Home + Virtualbox, which I will try next.

These will be the steps I use for this test.

vagrant up --no-provision
vagrant ssh

On the guest system I then run this:

sudo su
curl -OsL https://gist.githubusercontent.com/darkn3rd/ad9f736b67cc552412736cf09be79c88/raw/422ed657385f16a8c36e77261b1150af45923001/dgraph_dev_env.sh
bash dgraph_dev_env.sh

Then I log out and log in as vagrant, so that I pick up access to docker and docker-compose is in the path:

cd /opt/workarea
docker-compose up -d

I slightly modified the Vagrantfile:

# -*- mode: ruby -*-
# vi: set ft=ruby :

BOX_BASE = "bento/ubuntu-20.04"
BOX_NAME = "tc-ubuntu-workspace"
BOX_RAM_MB = "6144"
BOX_CPU_COUNT = "4"
BOX_IP_PRIVATE = "192.168.30.10"
HOSTNAME = "host.my"
EMAIL = "xyz@example.com"
FULL_NAME = "My Name"
SMB_USERNAME = "xyz@example.com"

Vagrant.configure("2") do |config|
  config.vm.hostname = HOSTNAME
  config.vm.box = BOX_BASE
  config.ssh.username = "vagrant"
  config.vm.network "forwarded_port", guest: 22, host: 2222, host_ip: "127.0.0.1", id: 'ssh'
  config.vm.network "private_network", ip: BOX_IP_PRIVATE
  config.vm.box_check_update = true
  
#   if Vagrant::Util::Platform.windows? then
#     config.vm.synced_folder "./workspace", "/opt/workspace", type: "smb", smb_username: SMB_USERNAME, mount_options: ["mfsymlinks"], owner: "vagrant", group: "vagrant"
#   else
    config.vm.synced_folder "./workspace", "/opt/workspace", owner: "vagrant", group: "vagrant"
#   end

  config.vm.provider "virtualbox" do |vb|
    vb.name = BOX_NAME
    vb.customize ["modifyvm", :id, "--cableconnected1", "on"]
    vb.customize ["modifyvm", :id, "--cpus", BOX_CPU_COUNT]
    vb.memory = BOX_RAM_MB
    vb.customize ["modifyvm", :id, "--accelerate3d", "off"]
    vb.customize ["modifyvm", :id, "--clipboard", "bidirectional"]
    vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant","1"]
    vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/opt/workspace","1"]
  end
end

Test Results

Vagrant Provider Share Type Results
Hyper/V SMB pass
Virtualbox SMB pass
Virtualbox default sync fail

Zero Logs

[Decoder]: Using assembly version of decoder
[Sentry] 2020/09/19 00:04:41 Integration installed: ContextifyFrames
[Sentry] 2020/09/19 00:04:41 Integration installed: Environment
[Sentry] 2020/09/19 00:04:41 Integration installed: Modules
[Sentry] 2020/09/19 00:04:41 Integration installed: IgnoreErrors
[Decoder]: Using assembly version of decoder
[Sentry] 2020/09/19 00:04:41 Integration installed: ContextifyFrames
[Sentry] 2020/09/19 00:04:41 Integration installed: Environment
[Sentry] 2020/09/19 00:04:41 Integration installed: Modules
[Sentry] 2020/09/19 00:04:41 Integration installed: IgnoreErrors
I0919 00:04:42.029401      15 sentry_integration.go:48] This instance of Dgraph will send anonymous reports of panics back to Dgraph Labs via Sentry. No confidential information is sent. These reports help improve Dgraph. To opt-out, restart your instance with the --enable_sentry=false flag. For more info, see https://dgraph.io/docs/howto/#data-handling.
I0919 00:04:42.204425      15 init.go:102]

Dgraph version   : v20.07.1
Dgraph codename  : shuri-1
Dgraph SHA-256   : 29d6804d57da4b9ddcc2173c5fe1631b97031d1b364b8b75e52cfa180ec36de6
Commit SHA-1     : d7123d93e
Commit timestamp : 2020-09-17 14:57:43 -0700
Branch           : HEAD
Go version       : go1.14.4

For Dgraph official documentation, visit https://dgraph.io/docs/.
For discussions about Dgraph     , visit http://discuss.dgraph.io.
To say hi to the community       , visit https://dgraph.slack.com.

Licensed variously under the Apache Public License 2.0 and Dgraph Community License.
Copyright 2015-2020 Dgraph Labs, Inc.


I0919 00:04:42.204682      15 run.go:127] Setting up grpc listener at: 0.0.0.0:5080
I0919 00:04:42.205718      15 run.go:127] Setting up http listener at: 0.0.0.0:6080
I0919 00:04:42.206477      15 run.go:298] Opening zero BadgerDB with options: {Dir:zw ValueDir:zw SyncWrites:false TableLoadingMode:2 ValueLogLoadingMode:2 NumVersionsToKeep:1 ReadOnly:false Truncate:true Logger:0xc00006d3b0 Compression:2 InMemory:false MaxTableSize:67108864 LevelSizeMultiplier:10 MaxLevels:7 ValueThreshold:1048576 NumMemtables:5 BlockSize:4096 BloomFalsePositive:0.01 KeepL0InMemory:false BlockCacheSize:0 IndexCacheSize:0 LoadBloomsOnOpen:false NumLevelZeroTables:5 NumLevelZeroTablesStall:15 LevelOneSize:268435456 ValueLogFileSize:67108864 ValueLogMaxEntries:1000000 NumCompactors:2 CompactL0OnClose:true LogRotatesToFlush:2 ZSTDCompressionLevel:3 VerifyValueChecksum:false EncryptionKey:[] EncryptionKeyRotationDuration:240h0m0s BypassLockGuard:false ChecksumVerificationMode:0 DetectConflicts:true managedTxns:false maxBatchCount:0 maxBatchSize:0}
[Sentry] 2020/09/19 00:04:42 Sending fatal event [a1e0d417f4cc441b84dce20eb5a94b18] to o318308.ingest.sentry.io project: 1805390
2020/09/19 00:04:42 sync zw: invalid argument
While syncing directory: zw.
github.com/dgraph-io/badger/v2.syncDir
        /go/pkg/mod/github.com/dgraph-io/badger/v2@v2.2007.2-0.20200827131741-d5a25b83fbf4/dir_unix.go:115
github.com/dgraph-io/badger/v2.helpRewrite
        /go/pkg/mod/github.com/dgraph-io/badger/v2@v2.2007.2-0.20200827131741-d5a25b83fbf4/manifest.go:294
github.com/dgraph-io/badger/v2.helpOpenOrCreateManifestFile
        /go/pkg/mod/github.com/dgraph-io/badger/v2@v2.2007.2-0.20200827131741-d5a25b83fbf4/manifest.go:147
github.com/dgraph-io/badger/v2.openOrCreateManifestFile
        /go/pkg/mod/github.com/dgraph-io/badger/v2@v2.2007.2-0.20200827131741-d5a25b83fbf4/manifest.go:127
github.com/dgraph-io/badger/v2.Open
        /go/pkg/mod/github.com/dgraph-io/badger/v2@v2.2007.2-0.20200827131741-d5a25b83fbf4/db.go:286
github.com/dgraph-io/dgraph/dgraph/cmd/zero.run
        /ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/zero/run.go:300
github.com/dgraph-io/dgraph/dgraph/cmd/zero.init.0.func1
        /ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/zero/run.go:79
github.com/spf13/cobra.(*Command).execute
        /go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:830
github.com/spf13/cobra.(*Command).ExecuteC
        /go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914
github.com/spf13/cobra.(*Command).Execute
        /go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
github.com/dgraph-io/dgraph/dgraph/cmd.Execute
        /ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/root.go:70
main.main
        /ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/main.go:78
runtime.main
        /usr/local/go/src/runtime/proc.go:203
runtime.goexit
        /usr/local/go/src/runtime/asm_amd64.s:1373
Error while opening WAL store
github.com/dgraph-io/dgraph/x.Checkf
        /ext-go/1/src/github.com/dgraph-io/dgraph/x/error.go:51
github.com/dgraph-io/dgraph/dgraph/cmd/zero.run
        /ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/zero/run.go:301
github.com/dgraph-io/dgraph/dgraph/cmd/zero.init.0.func1
        /ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/zero/run.go:79
github.com/spf13/cobra.(*Command).execute
        /go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:830
github.com/spf13/cobra.(*Command).ExecuteC
        /go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914
github.com/spf13/cobra.(*Command).Execute
        /go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
github.com/dgraph-io/dgraph/dgraph/cmd.Execute
        /ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/root.go:70
main.main
        /ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/main.go:78
runtime.main
        /usr/local/go/src/runtime/proc.go:203
runtime.goexit
        /usr/local/go/src/runtime/asm_amd64.s:1373

Alpha Logs

[Decoder]: Using assembly version of decoder
[Sentry] 2020/09/19 00:04:41 Integration installed: ContextifyFrames
[Sentry] 2020/09/19 00:04:41 Integration installed: Environment
[Sentry] 2020/09/19 00:04:41 Integration installed: Modules
[Sentry] 2020/09/19 00:04:41 Integration installed: IgnoreErrors
[Decoder]: Using assembly version of decoder
[Sentry] 2020/09/19 00:04:41 Integration installed: ContextifyFrames
[Sentry] 2020/09/19 00:04:41 Integration installed: Environment
[Sentry] 2020/09/19 00:04:41 Integration installed: Modules
[Sentry] 2020/09/19 00:04:41 Integration installed: IgnoreErrors
I0919 00:04:42.017222      14 sentry_integration.go:48] This instance of Dgraph will send anonymous reports of panics back to Dgraph Labs via Sentry. No confidential information is sent. These reports help improve Dgraph. To opt-out, restart your instance with the --enable_sentry=false flag. For more info, see https://dgraph.io/docs/howto/#data-handling.
I0919 00:04:42.018316      14 util_ee.go:126] KeyReader instantiated of type <nil>
I0919 00:04:42.204421      14 init.go:102]

Dgraph version   : v20.07.1
Dgraph codename  : shuri-1
Dgraph SHA-256   : 29d6804d57da4b9ddcc2173c5fe1631b97031d1b364b8b75e52cfa180ec36de6
Commit SHA-1     : d7123d93e
Commit timestamp : 2020-09-17 14:57:43 -0700
Branch           : HEAD
Go version       : go1.14.4

For Dgraph official documentation, visit https://dgraph.io/docs/.
For discussions about Dgraph     , visit http://discuss.dgraph.io.
To say hi to the community       , visit https://dgraph.slack.com.

Licensed variously under the Apache Public License 2.0 and Dgraph Community License.
Copyright 2015-2020 Dgraph Labs, Inc.


I0919 00:04:42.204436      14 run.go:714] x.Config: {PortOffset:0 QueryEdgeLimit:1000000 NormalizeNodeLimit:10000 PollInterval:1s GraphqlExtension:true}
I0919 00:04:42.204453      14 run.go:715] x.WorkerConfig: {ExportPath:export NumPendingProposals:256 Tracing:0.01 MyAddr:alpha1:7080 ZeroAddr:[zero1:5080] RaftId:0 WhiteListedIPRanges:[{Lower:10.0.0.0 Upper:10.255.255.255} {Lower:172.16.0.0 Upper:172.31.255.255} {Lower:192.168.0.0 Upper:192.168.255.255} {Lower:172.20.0.0 Upper:172.31.255.255}] MaxRetries:-1 StrictMutations:false AclEnabled:false AbortOlderThan:5m0s SnapshotAfter:10000 ProposedGroupId:0 StartTime:2020-09-19 00:04:41.655328533 +0000 UTC m=+0.016049008 LudicrousMode:false EncryptionKey:**** LogRequest:0}
I0919 00:04:42.204486      14 run.go:716] worker.Config: {PostingDir:p BadgerTables:mmap BadgerVlog:mmap BadgerWalTables:mmap BadgerWalVlog:mmap BadgerCompressionLevel:3 WALDir:w MutationsMode:0 AuthToken: AllottedMemory:1024 PBlockCacheSize:0 PIndexCacheSize:0 WBlockCacheSize:0 WIndexCacheSize:0 HmacSecret:**** AccessJwtTtl:0s RefreshJwtTtl:0s AclRefreshInterval:0s}
I0919 00:04:42.205056      14 server_state.go:78] Setting Badger Compression Level: 3
I0919 00:04:42.205066      14 server_state.go:99] Setting Badger table load option: mmap
I0919 00:04:42.205069      14 server_state.go:111] Setting Badger value log load option: mmap
I0919 00:04:42.205072      14 server_state.go:150] Opening write-ahead log BadgerDB with options: {Dir:w ValueDir:w SyncWrites:false TableLoadingMode:2 ValueLogLoadingMode:2 NumVersionsToKeep:1 ReadOnly:false Truncate:true Logger:0x2be83e8 Compression:2 InMemory:false MaxTableSize:67108864 LevelSizeMultiplier:10 MaxLevels:7 ValueThreshold:1048576 NumMemtables:5 BlockSize:4096 BloomFalsePositive:0.01 KeepL0InMemory:false BlockCacheSize:0 IndexCacheSize:0 LoadBloomsOnOpen:false NumLevelZeroTables:5 NumLevelZeroTablesStall:15 LevelOneSize:268435456 ValueLogFileSize:1073741823 ValueLogMaxEntries:10000 NumCompactors:2 CompactL0OnClose:true LogRotatesToFlush:2 ZSTDCompressionLevel:3 VerifyValueChecksum:false EncryptionKey:[] EncryptionKeyRotationDuration:240h0m0s BypassLockGuard:false ChecksumVerificationMode:0 DetectConflicts:false managedTxns:false maxBatchCount:0 maxBatchSize:0}
[Sentry] 2020/09/19 00:04:42 Sending fatal event [da497c698ab74ab085a92806bb381616] to o318308.ingest.sentry.io project: 1805390
2020/09/19 00:04:42 sync w: invalid argument
While syncing directory: w.
github.com/dgraph-io/badger/v2.syncDir
        /go/pkg/mod/github.com/dgraph-io/badger/v2@v2.2007.2-0.20200827131741-d5a25b83fbf4/dir_unix.go:115
github.com/dgraph-io/badger/v2.helpRewrite
        /go/pkg/mod/github.com/dgraph-io/badger/v2@v2.2007.2-0.20200827131741-d5a25b83fbf4/manifest.go:294
github.com/dgraph-io/badger/v2.helpOpenOrCreateManifestFile
        /go/pkg/mod/github.com/dgraph-io/badger/v2@v2.2007.2-0.20200827131741-d5a25b83fbf4/manifest.go:147
github.com/dgraph-io/badger/v2.openOrCreateManifestFile
        /go/pkg/mod/github.com/dgraph-io/badger/v2@v2.2007.2-0.20200827131741-d5a25b83fbf4/manifest.go:127
github.com/dgraph-io/badger/v2.Open
        /go/pkg/mod/github.com/dgraph-io/badger/v2@v2.2007.2-0.20200827131741-d5a25b83fbf4/db.go:286
github.com/dgraph-io/dgraph/worker.(*ServerState).initStorage
        /ext-go/1/src/github.com/dgraph-io/dgraph/worker/server_state.go:153
github.com/dgraph-io/dgraph/worker.InitServerState
        /ext-go/1/src/github.com/dgraph-io/dgraph/worker/server_state.go:54
github.com/dgraph-io/dgraph/dgraph/cmd/alpha.run
        /ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/alpha/run.go:718
github.com/dgraph-io/dgraph/dgraph/cmd/alpha.init.2.func1
        /ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/alpha/run.go:97
github.com/spf13/cobra.(*Command).execute
        /go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:830
github.com/spf13/cobra.(*Command).ExecuteC
        /go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914
github.com/spf13/cobra.(*Command).Execute
        /go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
github.com/dgraph-io/dgraph/dgraph/cmd.Execute
        /ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/root.go:70
main.main
        /ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/main.go:78
runtime.main
        /usr/local/go/src/runtime/proc.go:203
runtime.goexit
        /usr/local/go/src/runtime/asm_amd64.s:1373
Error while creating badger KV WAL store
github.com/dgraph-io/dgraph/x.Checkf
        /ext-go/1/src/github.com/dgraph-io/dgraph/x/error.go:51
github.com/dgraph-io/dgraph/worker.(*ServerState).initStorage
        /ext-go/1/src/github.com/dgraph-io/dgraph/worker/server_state.go:154
github.com/dgraph-io/dgraph/worker.InitServerState
        /ext-go/1/src/github.com/dgraph-io/dgraph/worker/server_state.go:54
github.com/dgraph-io/dgraph/dgraph/cmd/alpha.run
        /ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/alpha/run.go:718
github.com/dgraph-io/dgraph/dgraph/cmd/alpha.init.2.func1
        /ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/alpha/run.go:97
github.com/spf13/cobra.(*Command).execute
        /go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:830
github.com/spf13/cobra.(*Command).ExecuteC
        /go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914
github.com/spf13/cobra.(*Command).Execute
        /go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
github.com/dgraph-io/dgraph/dgraph/cmd.Execute
        /ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/root.go:70
main.main
        /ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/main.go:78
runtime.main
        /usr/local/go/src/runtime/proc.go:203
runtime.goexit
        /usr/local/go/src/runtime/asm_amd64.s:1373

@ibrahim Do you have any suggestions? Is there anything I can try out?

1 Like

The file.Sync call here is failing because zw is a directory.

We might be misusing the sync API. This should be easy to fix.

1 Like

It looks like fsync and virtual box shared directories don’t work well together. Calling fsync on a shared volume returns a invalid argument error (this is fsync returning error, not badger or dgraph).

The only thing we can do is ignore the fsync error but I don’t think people use dgraph or badger very often on shared virtual box volumes and so we don’t need to do anything.

2 Likes

I was digging around for vboxsf vs. fsync() and found these

https://forums.virtualbox.org/viewtopic.php?f=1&t=87454

and comments in the source code (not sure if this is what implements it):

https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Additions/linux/sharedfolders/regops.c

I conclusion it seems the only route is to not sure vboxsf as it doesn’t support fsync, and use a network file share like SMB or NFS.

2 Likes

@ibrahim @joaquin Interesting. I had my own fair share of trouble with Virtualbox and Volumes. Even SMB has issues (not with Dgraph but with other tools where it takes 10x the time to run a script over a normal synced folder) and NFS is not officially supported in Windows Host (Sadly had to use windows as the host because loads of applications run only on windows :worried: ). That is why I shifted my entire dev env online to GCE and everything is great now.

Going plain docker was not advisable for me since I wanted the entire dev env setup, rather I run containers within the VM. This might occur to anyone who actually uses VM for development. You might want to add this somewhere in the website sometime later.

Great response as always guys. Cheers.

1 Like

@tvvignesh Nice to hear.

On Windows side of things: NFS is supported, but well, only on the servers (ref: NFS Overview). With SMB, I would recommend sure to use SMB3.0 with vagrant, as the default SMB2.0 has problems:

smb_sync_opts = { type: "smb", mount_options: %w[mfsymlinks vers=3.0] }
config.vm.synced_folder ".", "/vagrant", smb_sync_opts

On VMs vs Docker: Docker is insanely popular for local dev environments, but for myself personally, I find on some occasions, such as simulating full CI/CD scenario, I need VMs.

I added some docs under systemd for using vagrant to test dgraph with systemd configuration for Ubuntu 18.04 and CentOS 8 with Vagrant using either Libvirt (KVM) and Virtualbox providers:

Updated with above link with support for SMB3.0 as default for Virtualbox (on Windows) and Hyper/V providers.

1 Like