SIGSEGV: segmentation violation caused by restore

#1

Greetings,
I was able to cause a segmentation fault, by executing:

$ influxd restore -portable -newdb e1 .\influxdb-backup2
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x96eaf6]

goroutine 1 [running]:
github\influxdata\influxdb\cmd\influxd\restore.(*Command).updateMetaPortable(0xc4201de000, 0x0, 0xf0)
\go\src\github.com\influxdata\influxdb\cmd\influxd\restore\restore.go:316 +0x86
github\influxdata\influxdb\cmd\influxd\restore.(*Command).runOnlinePortable(0xc4201de000, 0xc4200100e0, 0x4)
\go\src\github.com\influxdata\influxdb\cmd\influxd\restore\restore.go:104 +0x2f
github\influxdata\influxdb\cmd\influxd\restore.(*Command).Run(0xc4201de000, 0xc4200100e0, 0x4, 0x4, 0xc420074200, 0xc4200742a0)
\go\src\github\influxdata\influxdb\cmd\influxd\restore\restore.go:78 +0x209
main.(*Main).Run(0xc420197f40, 0xc4200100d0, 0x4, 0x4, 0x5ab753d6, 0x1073f8cb)
\go\src\github\influxdata\influxdb\cmd\influxd\main.go:115 +0xf04
main.main()
\go\src\github\influxdata\influxdb\cmd\influxd\main.go:45 +0x16a

$ influx -version
InfluxDB shell version: 1.5.0
$ uname -a
Linux runner 3.10.0-693.21.1.el7.x86_64 #1 SMP Wed Mar 7 19:03:37 UTC 2018 x86_64 x86_64 x86_64 GNU\Linux

show diagnostics
name: build
Branch Build Time Commit Version


1.5 6ac835404e7e64ea7299a6eebcce1ab1ef15fe3c 1.5.0

name: config
bind-address reporting-disabled


127.0.0.1:8088 true

#2

It shouldn’t be possible to segfault in backup/restore. @aanthony1243 can you help out here?

#3

with a quick look seems to be caused by the backslash in the pathname, which is probably a typo. try:

influxd restore -portable -newdb e1 ./influxdb-backup2

I’ll look into why that would cause a segfault instead of an error message, though.

#4

edit: I found the issue. A segfault may occur if the file *.manifest file is not present in the backup dir. @bofh what type of backup did you take, did you use the -portable flag?

#5

No, I didn’t use -portable, while doing backup, hence no manifest in the backup directory. Apologies for the “” - I got an error about newbies not being able to post more than two links and bulk replaced “/” with “”, including the one in the path.

Do you considered this as a bug or just a general type of mis-usage?

#6

Hi @bofh it’s a bug in the sense that there should be no segfault, and we will fix in the next minor release. Since you did not use ‘-portable’ when backing up, the expected behavior should have been an error message and a clean exit. In your case you should have used the -online flag instead to use the live restore features.

I also noticed that you use -newdb without a corresponding -db parameter. This doesn’t make much sense for the application, as -db specifies the db you want to restore, and -newdb specifies how you would like to rename it.

#7

Fine by me, thanks for your time.