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

segmentation fault while try to create a local backup in a dolthub/dolt-sql-server:1.7.5 docker image #6365

Closed
chicco785 opened this issue Jul 20, 2023 · 6 comments · Fixed by #6372

Comments

@chicco785
Copy link

I am try to add a local backup from a dolthub/dolt-sql-server:1.7.5 docker image and I get a segmentation fault as result:

root@a4b5d1456447:/home# mkdir -p /home/backup
root@a4b5d1456447:/home# dolt backup add local-backup file:///home/backup
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x19e1495]

goroutine 1 [running]:
github.com/dolthub/dolt/go/libraries/doltcore/env.(*DoltEnv).AddBackup(0xc00073a3f0, {{0x5554fffff935, 0xc}, {0x5554fffff942, 0x13}, {0xc000462220, 0x1, 0x1}, 0xc000fa4de0})
	/src/libraries/doltcore/env/environment.go:908 +0x75
github.com/dolthub/dolt/go/cmd/dolt/commands.addBackup(0xc00073a3f0, 0xc000fa4db0)
	/src/cmd/dolt/commands/backup.go:180 +0x485
github.com/dolthub/dolt/go/cmd/dolt/commands.BackupCmd.Exec({}, {0x2ee1f08, 0xc000148b40}, {0xc00042ed50, 0xb}, {0xc0001b0020, 0x3, 0x3}, 0x58b2840?, {0x0, ...})
	/src/cmd/dolt/commands/backup.go:119 +0x1e5
github.com/dolthub/dolt/go/cmd/dolt/cli.SubCommandHandler.handleCommand({{0x25fe892, 0x4}, {0x261e766, 0x11}, {0x0, 0x0}, {0x58322e0, 0x32, 0x32}, 0x0}, ...)
	/src/cmd/dolt/cli/command.go:244 +0x4ec
github.com/dolthub/dolt/go/cmd/dolt/cli.SubCommandHandler.Exec({{0x25fe892, 0x4}, {0x261e766, 0x11}, {0x0, 0x0}, {0x58322e0, 0x32, 0x32}, 0x0}, ...)
	/src/cmd/dolt/cli/command.go:193 +0x4b8
main.runMain()
	/src/cmd/dolt/dolt.go:543 +0x2a1e
main.main()
	/src/cmd/dolt/dolt.go:202 +0x19

i am running the test on mac book pro with m2

@fulghum
Copy link
Contributor

fulghum commented Jul 20, 2023

Hey @chicco785, thank you for taking the time to report this. I was able to repro the segfault. On first look, I believe this is happening either because dolt backup is run from a non-dolt directory or because the url specified (file:///home/backup) doesn't point to a dolt database. We'll dig into that and fix the segfault so that a helpful error message is displayed instead.

In the meantime, to get you unblocked, try running dolt backup from one of the database directories under /var/lib/dolt/, for example, I tested with /var/lib/dolt/db1:

# pwd
/var/lib/dolt/db1
# dolt backup add backup1 file:///var/lib/dolt/db1

I then ran dolt backup to list the backups and verify backup1 was there:

# dolt backup
backup1
local-backup

Let us know if that helps! I'm happy to take a look at our dolt backup docs and see if we can make the usage clearer, too.

@bpf120
Copy link

bpf120 commented Jul 20, 2023

Hi @chicco785 , Thanks for using Dolt and filing this. We'd love to learn more about your Dolt use case too. If you'd like to share, feel free to email me or swing by our Discord.

@chicco785
Copy link
Author

chicco785 commented Jul 20, 2023

Hey @chicco785, thank you for taking the time to report this. I was able to repro the segfault. On first look, I believe this is happening either because dolt backup is run from a non-dolt directory or because the url specified (file:///home/backup) doesn't point to a dolt database. We'll dig into that and fix the segfault so that a helpful error message is displayed instead.

In the meantime, to get you unblocked, try running dolt backup from one of the database directories under /var/lib/dolt/, for example, I tested with /var/lib/dolt/db1:

# pwd
/var/lib/dolt/db1
# dolt backup add backup1 file:///var/lib/dolt/db1

I then ran dolt backup to list the backups and verify backup1 was there:

# dolt backup
backup1
local-backup

Let us know if that helps! I'm happy to take a look at our dolt backup docs and see if we can make the usage clearer, too.

thx @fulghum,
clearly i misunderstood what file should point too :) from the example in the docs:

$ mkdir -p /Users/timsehn/liquidata/dolt/backups/backup-example
$ dolt backup add local-backup file:///Users/timsehn/liquidata/dolt/backups/backup-example
$ dolt backup sync local-backup
Uploaded 3.1 kB of 3.1 kB @ 0 B/s.

I assumed it was the destination directory to create the backup.

@chicco785
Copy link
Author

Hi @chicco785 , Thanks for using Dolt and filing this. We'd love to learn more about your Dolt use case too. If you'd like to share, feel free to email me or swing by our Discord.

hi @bpf120 ,
we are exploring dolt to use to support versioning of some models used in our smart grid platform.

if you think it's an interesting usecase, happy to have a meeting or drop you an email.

@bpf120
Copy link

bpf120 commented Jul 20, 2023

@chicco785 super interesting! :) Want to send me an email and we can try to talk next week?

@zachmu zachmu self-assigned this Jul 21, 2023
@zachmu
Copy link
Member

zachmu commented Jul 21, 2023

$ mkdir -p /Users/timsehn/liquidata/dolt/backups/backup-example
$ dolt backup add local-backup file:///Users/timsehn/liquidata/dolt/backups/backup-example
$ dolt backup sync local-backup
Uploaded 3.1 kB of 3.1 kB @ 0 B/s.

I assumed it was the destination directory to create the backup.

You are correct, Jason misspoke. The cause of the error is that this command must be run inside a dolt database directory.

% dolt init
Successfully initialized dolt data repository.
zachmu@zachmu-thinkpad:zachmu/dolt-scratch/b6365% mkdir backup
zachmu@zachmu-thinkpad:zachmu/dolt-scratch/b6365% dolt backup add local-backup file://./backup
zachmu@zachmu-thinkpad:zachmu/dolt-scratch/b6365% cd backup
zachmu@zachmu-thinkpad:dolt-scratch/b6365/backup% dolt backup add local-backup file://./
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x18b1b95]

goroutine 1 [running]:
github.com/dolthub/dolt/go/libraries/doltcore/env.(*DoltEnv).AddBackup(0xc0006202d0, {{0x7fffc26f31ef, 0xc}, {0x7fffc26f31fc, 0x9}, {0xc00057b7c0, 0x1, 0x1}, 0xc00067e780})
        /c/Users/zachmu/liquidata/go-workspace/src/github.com/dolthub/dolt/go/libraries/doltcore/env/environment.go:882 +0x75
github.com/dolthub/dolt/go/cmd/dolt/commands.addBackup(0xc0006202d0, 0xc00067e750)
        /c/Users/zachmu/liquidata/go-workspace/src/github.com/dolthub/dolt/go/cmd/dolt/commands/backup.go:180 +0x485
github.com/dolthub/dolt/go/cmd/dolt/commands.BackupCmd.Exec({}, {0x2d087d8, 0xc00072b780}, {0xc000642e80, 0xb}, {0xc0000520c0, 0x3, 0x3}, 0x55bdd00?, {0x0, ...})
        /c/Users/zachmu/liquidata/go-workspace/src/github.com/dolthub/dolt/go/cmd/dolt/commands/backup.go:119 +0x1e5
github.com/dolthub/dolt/go/cmd/dolt/cli.SubCommandHandler.handleCommand({{0x2451cf6, 0x4}, {0x2470ff6, 0x11}, {0x0, 0x0}, {0x553ed20, 0x32, 0x32}, 0x0}, ...)
        /c/Users/zachmu/liquidata/go-workspace/src/github.com/dolthub/dolt/go/cmd/dolt/cli/command.go:244 +0x4ec
github.com/dolthub/dolt/go/cmd/dolt/cli.SubCommandHandler.Exec({{0x2451cf6, 0x4}, {0x2470ff6, 0x11}, {0x0, 0x0}, {0x553ed20, 0x32, 0x32}, 0x0}, ...)
        /c/Users/zachmu/liquidata/go-workspace/src/github.com/dolthub/dolt/go/cmd/dolt/cli/command.go:193 +0x4b8
main.runMain()
        /c/Users/zachmu/liquidata/go-workspace/src/github.com/dolthub/dolt/go/cmd/dolt/dolt.go:545 +0x2a1e
main.main()
        /c/Users/zachmu/liquidata/go-workspace/src/github.com/dolthub/dolt/go/cmd/dolt/dolt.go:204 +0x19
zachmu@zachmu-thinkpad:dolt-scratch/b6365/backup%

I'm fixing the panic and updating the docs, and I'll close this when I have.

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

Successfully merging a pull request may close this issue.

5 participants