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

rtl_tcp dies, doesn't get restarted #10

Closed
pashdown opened this issue Oct 12, 2021 · 5 comments
Closed

rtl_tcp dies, doesn't get restarted #10

pashdown opened this issue Oct 12, 2021 · 5 comments

Comments

@pashdown
Copy link

My rtl_tcp has a bad habit of dying on a daily basis. It doesn't get restarted when this happens and rtlamr has nothing to connect to. Would it be possible to have an rtl_tcp watchdog?

08:11:45.658190 decode.go:59: Protocols: scm
08:11:45.658209 decode.go:60: Preambles: 111110010101001100000
08:11:45.658230 main.go:124: GainCount: 29
08:11:50.662190 main.go:343: Receiver context cancelled.
08:11:50.662793 main.go:320: read tcp 127.0.0.1:52638->127.0.0.1:1234: i/o timeout
io.ReadFull
main.(*Receiver).Run.func2
	/go/pkg/mod/github.com/bemasher/rtlamr@v0.9.3/main.go:181
runtime.goexit
	/usr/lib/go/src/runtime/asm_amd64.s:1371
08:12:50.676234 decode.go:45: CenterFreq: 912600155
08:12:50.676603 decode.go:46: SampleRate: 2359296
08:12:50.676624 decode.go:47: DataRate: 32768
08:12:50.676636 decode.go:48: ChipLength: 72
08:12:50.676646 decode.go:49: PreambleSymbols: 21
08:12:50.676656 decode.go:50: PreambleLength: 3024
08:12:50.676667 decode.go:51: PacketSymbols: 96
08:12:50.676678 decode.go:52: PacketLength: 13824
08:12:50.676691 decode.go:59: Protocols: scm
08:12:50.676704 decode.go:60: Preambles: 111110010101001100000
08:12:50.676716 main.go:124: GainCount: 29
08:12:55.679475 main.go:343: Receiver context cancelled.
08:12:55.679904 main.go:320: read tcp 127.0.0.1:53012->127.0.0.1:1234: read: connection reset by peer
io.ReadFull
main.(*Receiver).Run.func2
	/go/pkg/mod/github.com/bemasher/rtlamr@v0.9.3/main.go:181
runtime.goexit
	/usr/lib/go/src/runtime/asm_amd64.s:1371
08:13:55.692265 decode.go:45: CenterFreq: 912600155
08:13:55.692353 decode.go:46: SampleRate: 2359296
08:13:55.692359 decode.go:47: DataRate: 32768
08:13:55.692362 decode.go:48: ChipLength: 72
08:13:55.692364 decode.go:49: PreambleSymbols: 21
08:13:55.692374 decode.go:50: PreambleLength: 3024
08:13:55.692377 decode.go:51: PacketSymbols: 96
08:13:55.692380 decode.go:52: PacketLength: 13824
08:13:55.692384 decode.go:59: Protocols: scm
08:13:55.692387 decode.go:60: Preambles: 111110010101001100000
08:13:55.692390 main.go:124: GainCount: 29
08:14:00.696871 main.go:343: Receiver context cancelled.
08:14:00.697428 main.go:320: read tcp 127.0.0.1:53400->127.0.0.1:1234: i/o timeout
io.ReadFull
main.(*Receiver).Run.func2
	/go/pkg/mod/github.com/bemasher/rtlamr@v0.9.3/main.go:181
runtime.goexit
	/usr/lib/go/src/runtime/asm_amd64.s:1371
08:15:00.708316 decode.go:45: CenterFreq: 912600155
08:15:00.708688 decode.go:46: SampleRate: 2359296
08:15:00.708714 decode.go:47: DataRate: 32768
08:15:00.708728 decode.go:48: ChipLength: 72
08:15:00.708740 decode.go:49: PreambleSymbols: 21
08:15:00.708753 decode.go:50: PreambleLength: 3024
08:15:00.708766 decode.go:51: PacketSymbols: 96
08:15:00.708779 decode.go:52: PacketLength: 13824
08:15:00.708797 decode.go:59: Protocols: scm
08:15:00.708814 decode.go:60: Preambles: 111110010101001100000
08:15:00.708830 main.go:124: GainCount: 29
08:15:05.710015 main.go:343: Receiver context cancelled.
08:15:05.710131 main.go:320: read tcp 127.0.0.1:53860->127.0.0.1:1234: i/o timeout
io.ReadFull
main.(*Receiver).Run.func2
	/go/pkg/mod/github.com/bemasher/rtlamr@v0.9.3/main.go:181
runtime.goexit
	/usr/lib/go/src/runtime/asm_amd64.s:1371
08:16:05.718234 decode.go:45: CenterFreq: 912600155
08:16:05.718561 decode.go:46: SampleRate: 2359296
08:16:05.718586 decode.go:47: DataRate: 32768
08:16:05.718600 decode.go:48: ChipLength: 72
08:16:05.718614 decode.go:49: PreambleSymbols: 21
08:16:05.718628 decode.go:50: PreambleLength: 3024
08:16:05.718641 decode.go:51: PacketSymbols: 96
08:16:05.718656 decode.go:52: PacketLength: 13824
08:16:05.718675 decode.go:59: Protocols: scm
08:16:05.718694 decode.go:60: Preambles: 111110010101001100000
08:16:05.718711 main.go:124: GainCount: 29
08:16:10.723719 main.go:343: Receiver context cancelled.
08:16:10.724229 main.go:320: read tcp 127.0.0.1:54304->127.0.0.1:1234: i/o timeout
io.ReadFull
main.(*Receiver).Run.func2
	/go/pkg/mod/github.com/bemasher/rtlamr@v0.9.3/main.go:181
runtime.goexit
	/usr/lib/go/src/runtime/asm_amd64.s:1371
08:17:10.729891 decode.go:45: CenterFreq: 912600155
08:17:10.729946 decode.go:46: SampleRate: 2359296
08:17:10.729949 decode.go:47: DataRate: 32768
08:17:10.729951 decode.go:48: ChipLength: 72
08:17:10.729953 decode.go:49: PreambleSymbols: 21
08:17:10.729954 decode.go:50: PreambleLength: 3024
08:17:10.729956 decode.go:51: PacketSymbols: 96
08:17:10.729957 decode.go:52: PacketLength: 13824
08:17:10.729960 decode.go:59: Protocols: scm
08:17:10.729962 decode.go:60: Preambles: 111110010101001100000
08:17:10.729964 main.go:124: GainCount: 29
08:17:15.733466 main.go:343: Receiver context cancelled.
08:17:15.733657 main.go:320: read tcp 127.0.0.1:54664->127.0.0.1:1234: i/o timeout
io.ReadFull
main.(*Receiver).Run.func2
	/go/pkg/mod/github.com/bemasher/rtlamr@v0.9.3/main.go:181
runtime.goexit
	/usr/lib/go/src/runtime/asm_amd64.s:1371
@jdeath
Copy link
Owner

jdeath commented Oct 13, 2021

I guess you could add a "while true; do" before the rtl_tcp command and a "done" and the end of the code. Can you try that in the rtl2mqtt.sh ? It will be in \config\rtlamr2mqtt\ accessible via SMB

Restart the addon, and report back if it helps. Also, try a hard power-down of your homeassistant, then restart. Could be a sign of the hardware failing, I'm on my 3rd sdr!

@hacsjalano
Copy link

This happens to me as well - it can go from anywhere from 12 hours to 7 days. In each case, I have to either physically remove the USB dongle or power cycle the box (raspberry pi4 in my case). Unfortunately this is the one issue that prevents me from running this inside a virtual server; rebooting the virtual machine does nothing. I have to physically remove the USB dongle which I can't do programmatically.

In my case I watch if there is no output for 5 minutes, then I reboot the box. :( If anyone has other ideas I'm open!

@pashdown
Copy link
Author

pashdown commented Nov 9, 2021

I eventually traced this back to a bad dongle. These things generate a lot of heat, and if they're not built for it, they're not built for 24/7 operation. Don't buy the NooElec NESDR Nano 2 Plus for one. Buy a quality dongle with a good heat-sink. It also may be worth considering the Elonics E4000 based dongles rather than R820T2 as they seem to run a lot cooler.

@hacsjalano
Copy link

This works for me:

/usr/sbin/usb_modeswitch -v 0x0bda -p 0x2838 --reset-usb

the -v and -p parameters can be found by typing "lsusb". I'm still working around on how to detect this, but if I see there is no output found after some time when I should be expecting it, I can run this command and the next time rtl_tcp starts up again everything works fine again, for another week or so.

I agree about the dongle quality - I'm currently using the one sold by rtl-sdr.com and I've run them 24x7 and they last anywhere from 9 months to 2 years on average. My most recent one has been going for 2 years so far.

@jdeath
Copy link
Owner

jdeath commented Nov 11, 2021

Thanks for the usb_modeswitch. It seemed to work for me. However, it needs to be run on the host system, the binary is not in the homeassistant container and many people do not have host access. I added it to this container, to support a future option to call it. It is better than having to shutdown the system.

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

No branches or pull requests

3 participants