Potential Bug when Running rclone off OpenWrt

Hello,

I have rclone running on a script that is called after a transmission download. In the log for the script, I keep getting this error:

+ rclone copy /mnt/sda1/Movies/Love Actually (2001).mkv gapps:Movies
fatal error: runtime: cannot reserve arena virtual address space
runtime: panic before malloc heap initialized

runtime stack:
runtime.throw(0x983f9d, 0x33)
	/opt/go/go1.9/src/runtime/panic.go:605 +0x70 fp=0xbea44ab4 sp=0xbea44aa8 pc=0x3c024
runtime.mallocinit()
	/opt/go/go1.9/src/runtime/malloc.go:360 +0x31c fp=0xbea44afc sp=0xbea44ab4 pc=0x1f958
runtime.schedinit()
	/opt/go/go1.9/src/runtime/proc.go:481 +0x30 fp=0xbea44b18 sp=0xbea44afc pc=0x3e72c
runtime.rt0_go(0xbea44b64, 0x18, 0xbea44cb2, 0xbea44cb9, 0xbea44cbe, 0xbea44cd9, 0xbea44cde, 0xbea44cee, 0xbea44cf4, 0xbea44cf8, ...)
	/opt/go/go1.9/src/runtime/asm_arm.s:61 +0x84 fp=0xbea44b58 sp=0xbea44b18 pc=0x6b034

Any idea? Thanks much for this project it’s awesome where can I donate?

This means that rclone has run out of virtual memory.

What do you see when you type ulimit -v on your box?

Assuming you aren’t running out of actual memory (which is a possibility) you should try to increase that ulimit value. Where exactly you do that in your system I’m not sure though…

Hmm, when I type that command it says “unlimited”

rclone runs just fine when I run it from ssh as root (it’s a headless machine). But whenever I put it in the script (which is run from the transmission-daemon user) it has that error.

OK, sounds like you need to investigate the ulimts the daemon gives it. You could try getting it to run a bash script with ulimit -v in to see what that says.

I’ll be damned, you’re right!

+ ulimit -v
250781

I guess I have to define it in the script, what should I set it to? Unlimited?

http://www.linuxhowtos.org/Tips%20and%20Tricks/ulimit.htm

Seems to suggest not to set it to unlimited.

unlimited is the tradtitional setting… Rclone uses a lot of virtual memory which it might not actually need backing with real RAM. So if you want a limit, set twice the actual amount of RAM maybe?

I fixed it here! https://github.com/openwrt/packages/issues/5628

However, now I’m getting this error:

2018/02/17 18:43:01 NOTICE: Config file "/.rclone.conf" not found - using defaults
2018/02/17 18:43:01 Failed to create file system for "gapps:Movies": didn't find section in config file

Obviously, I already setup rclone. Problem?

Try explicitly setting the config file location with --config=/path/to/file

That, along with a chmod 755, did the trick. Thanks.