Liru/tumblr-downloader

error when run linux build

Closed this issue · 10 comments

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x40832e]

goroutine 1 [running]:
main.setupDatabase.func1(0xc8200a4000, 0x0, 0x0)
        /home/liru/go/src/github.com/liru/tumblr-downloader/database.go:27 +0x25e
github.com/boltdb/bolt.(*DB).Update(0xc82009e000, 0xc820047de8, 0x0, 0x0)
        /home/liru/go/src/github.com/boltdb/bolt/db.go:568 +0xb3
main.setupDatabase(0xc8200183c0, 0x7, 0xc)
        /home/liru/go/src/github.com/liru/tumblr-downloader/database.go:43 +0x19e
main.main()
        /home/liru/go/src/github.com/liru/tumblr-downloader/main.go:133 +0x9c

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
        /usr/lib/go/src/runtime/asm_amd64.s:1696 +0x1

goroutine 5 [syscall]:
os/signal.loop()
        /usr/lib/go/src/os/signal/signal_unix.go:22 +0x18
created by os/signal.init.1
        /usr/lib/go/src/os/signal/signal_unix.go:28 +0x37

Liru commented

Do you have any more details? What version are you using? What were you downloading? Did anything appear before that?

I suggest you mistaken the path. I think this app can only run in your PC

Liru commented

If you're talking about the error message, the paths are hard-coded in as a reference to the source code during compilation. In Golang, it's the way you can see where the error occurred in the code. It has nothing to do with loading something from an absolute directory. I've verified that it can run on other computers under different usernames.

What's odd is where the error is occurring. At that point in the code, everything should be fine, but apparently there's a condition that makes it not fine. I'm trying to isolate that.

@busfool : I run app in PC, under Fedora 7
@Liru I used v1.4.1 build download in this link version, in linux repo: fedora 7.
Im using command [root@quannt tumblr-downloader-linux]#./tumblr-downloader kumar0283 --ignore-audio --ignore-videoto download only image. and result like a first post.

More information: i download the zip file and extract to /root/tumblr-downloader-linux/tumblr-downloader-linux then chmod 777 `tumblr-downloader to allow tool to run.

Sorry for late reply.

@Liru I've tried on my Ubuntu PC using linux version again, it works. Thanks a lot!
last time I am using Windows version.

@busfool : Can u using the build for windows OS. What's your windows version ?

Liru commented

@kiemrong08 The problem is due to me not keeping up with supporting usernames in the command line, due to the sheer number that my own list now has. Try putting the blog you want to download into download.txt and run ./tumblr-downloader -ignore-audio -ignore-videos to get around this for now.

Also, unrelated to the downloader, but make a non-root user account for yourself. It's a good thing to do on Linux.

What's wrong with always being root?

@Liru thank for your support. it works like a charm.
MyPC is a VMware and i using this PC for test environment. So dont worry about security or etc :)

I also got this error when I run 1.5.3. Same with newly build binary from code.

 	Scanning directory
Done scanning.
2017/03/12 13:56:12 Version string empty
Current version is 1.5.3
2017/03/12 13:56:12 Checking entire tumblrblog due to new version.
xxx is on page 1 / 1
Done scraping for xxx ( 1 pages )
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x8155abc]

goroutine 18 [running]:
sync/atomic.AddUint64(0x1877b63c, 0x1, 0x0, 0x1, 0x1)
	/usr/lib/go/src/sync/atomic/asm_386.s:112 +0xc
main.(*User).incrementFilesFound(0x1877b600, 0x1)
	/home/liru/go/src/github.com/liru/tumblr-downloader/user.go:161 +0x5a
main.(*User).Queue(0x1877b600, 0x18a8c420, 0xc, 0x18a8c4d0, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/home/liru/go/src/github.com/liru/tumblr-downloader/user.go:123 +0x6e
main.scrape.func1(0x1877b600, 0x189c5c80, 0x18a05c00)
	/home/liru/go/src/github.com/liru/tumblr-downloader/scraper.go:251 +0xf2b
created by main.scrape
	/home/liru/go/src/github.com/liru/tumblr-downloader/scraper.go:261 +0x8f
    ....

uname -a:
Linux leetom.centos 2.6.32-042stab116.1 #1 SMP Wed May 4 16:21:02 MSK 2016 i686 i686 i386 GNU/Linux

It turns out this line atomic.AddUint64(&u.filesProcessed, 1) doesn't support 32bit OS.

You have to move the filesProcessed field to the aligned position in User struct, according to this link