merbanan / rtl_433

Program to decode radio transmissions from devices on the ISM bands (and other frequencies)
GNU General Public License v2.0
6.16k stars 1.33k forks source link

`[Input] Input device start failed, exiting!` #3081

Open dcousens opened 3 weeks ago

dcousens commented 3 weeks ago

Followup to https://github.com/merbanan/rtl_433/issues/3080. Similar to https://github.com/merbanan/rtl_433/issues/2621, git checkout 22.11 is OK. 23.11 and master are producing the same error.

This process is not operating with network access, if that's relevant.

> ./src/rtl_433 -vvv -R 142
rtl_433 version 23.11-171-g0b426692 branch master at 202410261548 inputs file rtl_tcp RTL-SDR SoapySDR with TLS
...
[Protocols] Registered 1 out of 266 device decoding protocols
[Input] The internals of input handling changed, read about and report problems on PR #1978
[SDR] Found 1 device(s)
[SDR] trying device 0: Realtek, RTL2838UHIDIR, SN: 00000001
Found Rafael Micro R820T tuner
[SDR] Using device 0: Realtek, RTL2838UHIDIR, SN: 00000001, "Generic RTL2832U OEM"
Exact sample rate is: 250000.000414 Hz
[R82XX] PLL not locked!
[SDR] Sample rate set to 250000 S/s.
[Input] Bit detection level set to 0.0 (Auto).
[SDR] Tuner gain set to Auto.
[Input] Reading samples in async mode...
[SDR] rtlsdr_set_center_freq 433920000 = 0
[SDR] Tuned to 433.920MHz.
[acquire_thread] acquire_thread enter...
[Input] Input device start failed, exiting!
[sdr_stop] EXITING...
[sdr_stop] JOINING...
[rtlsdr_read_loop] rtlsdr_read_async done
[acquire_thread] acquire_thread async stop...
[acquire_thread] acquire_thread done...
[sdr_stop] EXITED.
[rtl_433] stopping...
[sdr_stop] EXITING...
[sdr_stop] Already exiting.
[sdr_stop] EXITING...
[sdr_stop] Already exiting.
(exits)

Compiled cleanly with

cmake .
make
dcousens commented 3 weeks ago

@zuckschwerdt unblocking UDP outbound to loopback resolves this problem. Is something in rtl_433 trying to send on UDP loopback?

edit: yes, seemingly sending to itself

> ss -natup
udp  ESTAB  0  0  127.0.0.1:44847  127.0.0.1:57884  users:(("rtl_433",pid=945337,fd=9))
udp  ESTAB  0  0  127.0.0.1:57884  127.0.0.1:44847  users:(("rtl_433",pid=945337,fd=8))
zuckschwerdt commented 3 weeks ago

unblocking UDP outbound to loopback resolves this problem.

Ah yes, actually the same error as in the referenced issue. The Mongoose network lib uses an internal socket to message across threads.

See https://github.com/merbanan/rtl_433/blob/master/include/mongoose.h#L3976

dcousens commented 3 weeks ago

Ah, sorry I missed part of your comment in https://github.com/merbanan/rtl_433/issues/2621#issuecomment-1727776776 - the thread was quite dense and I didn't pick up on it, my bad. Oh well, documentation of threading library quirks for posterity :white_check_mark:.

zuckschwerdt commented 3 weeks ago

I wanted to refactor to just mutexes or conditions, but our (Mongoose) event loop is based on select(2) and thus needs to be triggered with an fd. As far as I can see we are stuck with Mongoose's broadcast mechanism.