jotta / jotta-cli-issues

45 stars 1 forks source link

jotta-cli archive gives panic: runtime error: integer divide by zero #71

Closed magnuhho closed 5 years ago

magnuhho commented 5 years ago

Make sure you are running the latest version of jotta-cli before reporting an issue.

jotta-cli release (jotta-cli version): 0.5.14050 jottad running as a service on Win10x64 1809, fully patched

Description of problem: When uploading files with jotta-cli archive, jotta-cli often terminates with "panic: runtime error: integer divide by zero" and gives the exit code 2

Expected: I expect jotta-cli to upload the file and exit with OK / exit code 0

jotta-cli status (jotta-cli status):

Relevant logs for the issue (cat ~/.jottad/jottabackup.log)

jotta-cli does not seem to log anything (than I can find) when jottad is run as local system
The output from jotta-cli is

panic: runtime error: integer divide by zero

goroutine 21 [running]:
git.jotta.us/devel/jottacli/jotta-cli/cmd/api.(*Cli).AddFile.func1(0xc32b40, 0xc042253080, 0xc34340, 0xc042253040, 0xc042044ba0, 0xc04207c000, 0x4a, 0xc042109c90, 0x2, 0x2)
        /go/src/git.jotta.us/devel/jottacli/jotta-cli/cmd/api/transfer.go:277 +0xfd9
created by git.jotta.us/devel/jottacli/jotta-cli/cmd/api.(*Cli).AddFile
        /go/src/git.jotta.us/devel/jottacli/jotta-cli/cmd/api/transfer.go:238 +0x3a7

or

panic: runtime error: integer divide by zero

goroutine 65 [running]:
git.jotta.us/devel/jottacli/jotta-cli/cmd/api.(*Cli).AddFile.func1(0xc32b40, 0xc0422a2020, 0xc34340, 0xc04225b040, 0xc0422f8000, 0xc04207e000, 0x4a, 0xc04210bc90, 0x2, 0x2)
        /go/src/git.jotta.us/devel/jottacli/jotta-cli/cmd/api/transfer.go:277 +0xfd9
created by git.jotta.us/devel/jottacli/jotta-cli/cmd/api.(*Cli).AddFile
        /go/src/git.jotta.us/devel/jottacli/jotta-cli/cmd/api/transfer.go:238 +0x3a7

or

panic: runtime error: integer divide by zero

goroutine 5 [running]:
git.jotta.us/devel/jottacli/jotta-cli/cmd/api.(*Cli).AddFile.func1(0xc32b40, 0xc0421a8ab0, 0xc34340, 0xc04221f070, 0xc042016240, 0xc04207e000, 0x4a, 0xc04210bc90, 0x2, 0x2)
        /go/src/git.jotta.us/devel/jottacli/jotta-cli/cmd/api/transfer.go:277 +0xfd9
created by git.jotta.us/devel/jottacli/jotta-cli/cmd/api.(*Cli).AddFile
        /go/src/git.jotta.us/devel/jottacli/jotta-cli/cmd/api/transfer.go:238 +0x3a7

or

goroutine 43 [running]:
git.jotta.us/devel/jottacli/jotta-cli/cmd/api.(*Cli).AddFile.func1(0xc32b40, 0xc0422690a0, 0xc34340, 0xc042269060, 0xc042250360, 0xc04207e000, 0x4a, 0xc04210bc90, 0x2, 0x2)
        /go/src/git.jotta.us/devel/jottacli/jotta-cli/cmd/api/transfer.go:277 +0xfd9
created by git.jotta.us/devel/jottacli/jotta-cli/cmd/api.(*Cli).AddFile
        /go/src/git.jotta.us/devel/jottacli/jotta-cli/cmd/api/transfer.go:238 +0x3a7

Only difference between the crashes seems to be the goroutine number 

Traceback

Additional info:

When retrying the upload, it seems as if the file was uploaded successfully at the first attempt (re-upload finishes in the blink of an eye). I'll see if I can confirm that

Kimbsen commented 5 years ago

Thanks for catching this.

What kind of size is the file you are uploading?

Does it happen immediately or as the upload is finishing?

It seems to be a timing issue of some kind. Somehow the timespent between two loops of ui-updates is 0ns. Not sure how that is possible, but i'm fairly sure i can prevent the panic.

magnuhho commented 5 years ago

I have not watched it closely - I' uploading alot of files and it happens every now and then. The fact that the re-upload finishes in a flash suggests that it happens as the upload is finishing up.

The size of the file it last happened to was 1183312 bytes.

Next time it happens, I will delete the file from the web gui and re-upload to see if its reproducible for the same file.

Another hunch: can it be related to jotta-cli's gui (percent uploaded/left calculation, for instance)?

magnuhho commented 5 years ago

1: the file was not uploaded successfully, but was shown in the web gui 2: downloading the file from the web gui gave a zip file which contained an empty folder with the same name as the file 3: re-uploading with jotta-cli archive worked as expected

magnuhho commented 5 years ago

Crashed again. Source size: 1444928 bytes

Kimbsen commented 5 years ago

It should be fixed in 0.5.14545