JamesHarrison / openob

The Open Outside Broadcast project for radio contribution links and studio-transmitter links.
158 stars 34 forks source link

Error with OpenOB 4.0.2 and Raspbian Stretch Lite #38

Closed LyonelB closed 6 years ago

LyonelB commented 6 years ago

pi@raspberrypi:~ $ openob 192.168.1.109 recepteur transmission rx 2018-08-20 15:09:35,519 - openob.link.transmission.config - INFO - Connecting to configuration host 192.168.1.109 Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/redis/connection.py", line 484, in connect sock = self._connect() File "/usr/local/lib/python3.5/dist-packages/redis/connection.py", line 541, in _connect raise err File "/usr/local/lib/python3.5/dist-packages/redis/connection.py", line 529, in _connect sock.connect(socket_address) ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/redis/client.py", line 667, in execute_command connection.send_command(args) File "/usr/local/lib/python3.5/dist-packages/redis/connection.py", line 610, in send_command self.send_packed_command(self.pack_command(args)) File "/usr/local/lib/python3.5/dist-packages/redis/connection.py", line 585, in send_packed_command self.connect() File "/usr/local/lib/python3.5/dist-packages/redis/connection.py", line 489, in connect raise ConnectionError(self._error_message(e)) redis.exceptions.ConnectionError: Error 111 connecting to 192.168.1.109:6379. Connection refused.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/redis/connection.py", line 484, in connect sock = self._connect() File "/usr/local/lib/python3.5/dist-packages/redis/connection.py", line 541, in _connect raise err File "/usr/local/lib/python3.5/dist-packages/redis/connection.py", line 529, in _connect sock.connect(socket_address) ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/bin/openob", line 81, in link_config.set_from_argparse(opts) File "/usr/local/lib/python3.5/dist-packages/openob/link_config.py", line 83, in set_from_argparse self.set("name", opts.link_name) File "/usr/local/lib/python3.5/dist-packages/openob/link_config.py", line 51, in set self.redis.set(scoped_key, value) File "/usr/local/lib/python3.5/dist-packages/redis/client.py", line 1171, in set return self.execute_command('SET', pieces) File "/usr/local/lib/python3.5/dist-packages/redis/client.py", line 673, in execute_command connection.send_command(args) File "/usr/local/lib/python3.5/dist-packages/redis/connection.py", line 610, in send_command self.send_packed_command(self.pack_command(*args)) File "/usr/local/lib/python3.5/dist-packages/redis/connection.py", line 585, in send_packed_command self.connect() File "/usr/local/lib/python3.5/dist-packages/redis/connection.py", line 489, in connect raise ConnectionError(self._error_message(e)) redis.exceptions.ConnectionError: Error 111 connecting to 192.168.1.109:6379. Connection refused.

JamesHarrison commented 6 years ago

This looks like a network connection issue, not an issue with the new version - those errors are saying that the server (192.168.1.109) running redis is refusing to talk with you, which usually means you've not set redis to listen on all interfaces or aren't running redis.

LyonelB commented 6 years ago

Redis seems to work: ● redis-server.service - Advanced key-value store Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2018-08-20 15:42:59 UTC; 18h ago Docs: http://redis.io/documentation, man:redis-server(1) Process: 531 ExecStartPost=/bin/run-parts --verbose /etc/redis/redis-server.post-up.d (code=exited, status=0/SUCC Process: 488 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS) Process: 470 ExecStartPre=/bin/run-parts --verbose /etc/redis/redis-server.pre-up.d (code=exited, status=0/SUCCES Main PID: 530 (redis-server) CGroup: /system.slice/redis-server.service └─530 /usr/bin/redis-server 0.0.0.0:6379

Aug 20 15:42:58 raspberrypi systemd[1]: Starting Advanced key-value store... Aug 20 15:42:59 raspberrypi run-parts[470]: run-parts: executing /etc/redis/redis-server.pre-up.d/00_example Aug 20 15:42:59 raspberrypi run-parts[531]: run-parts: executing /etc/redis/redis-server.post-up.d/00_example Aug 20 15:42:59 raspberrypi systemd[1]: Started Advanced key-value store.


pi@raspberrypi:~ $ redis-server 754:C 21 Aug 10:28:49.311 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf 754:M 21 Aug 10:28:49.319 Increased maximum number of open files to 10032 (it was originally set to 1024). 754:M 21 Aug 10:28:49.320 # Creating Server TCP listening socket :6379: bind: Address already in use

JamesHarrison commented 6 years ago

Sure, but is it listening externally? What does ss -napl | grep redis see? Can you post your redis config?

JamesHarrison commented 6 years ago

Looking at this in a bit more detail - if you're using 4.0 you may find protected-mode yes in your config ifle. This appears to be a new security feature Redis has introduced. If you set protected-mode no this should fix it immediately; really though we should look to support authenticated connections for Redis which is a better fix...

LyonelB commented 6 years ago

What does ss -napl | grep redis see?

pi@raspberrypi:~ $ ss -napl | grep redis pi@raspberrypi:~ $

Can you post your redis config?

bind 0.0.0.0 protected-mode no (after change it) port 6379 tcp-backlog 511 timeout 0 tcp-keepalive 300 daemonize yes supervised no pidfile /var/run/redis/redis-server.pid loglevel notice logfile /var/log/redis/redis-server.log databases 16 save 900 1 save 300 10 save 60 10000 stop-writes-on-bgsave-error yes rdbcompression yes rdbchecksum yes dbfilename dump.rdb dir /var/lib/redis slave-serve-stale-data yes slave-read-only yes repl-diskless-sync no repl-diskless-sync-delay 5 repl-disable-tcp-nodelay no slave-priority 100 appendonly no appendfilename "appendonly.aof" appendfsync everysec auto-aof-rewrite-percentage 100 auto-aof-rewrite-min-size 64mb aof-load-truncated yes lua-time-limit 5000 slowlog-max-len 128 latency-monitor-threshold 0 notify-keyspace-events "" hash-max-ziplist-entries 512 hash-max-ziplist-value 64 list-max-ziplist-size -2 list-compress-depth 0 set-max-intset-entries 512 zset-max-ziplist-entries 128 zset-max-ziplist-value 64 hll-sparse-max-bytes 3000 activerehashing yes client-output-buffer-limit normal 0 0 0 client-output-buffer-limit slave 256mb 64mb 60 client-output-buffer-limit pubsub 32mb 8mb 60 hz 10 aof-rewrite-incremental-fsync yes

protected-mode no

I do it and restart redis-server but i still have the error and OpenOB don't work

jonty-comp commented 6 years ago

Another helpful test would be to run redis-cli -h 192.168.1.109 -p 6379 from your openob client, and see if that can connect.

LyonelB commented 6 years ago

192.168.1.109 → recepter 192.168.1.161 → emetter

On the recepter (192.168.1.109) pi@raspberrypi:~ $ redis-cli -h 192.168.1.109 -p 6379 Could not connect to Redis at 192.168.1.109:6379: Connection refused Could not connect to Redis at 192.168.1.109:6379: Connection refused not connected>

JamesHarrison commented 6 years ago

OK, that's very certainly not an OpenOB issue then - if redis can't talk to redis, it's probably redis or a firewall! Does your machine have a firewall, is port 6379 open?

LyonelB commented 6 years ago

Both raspberry are plugged into the same network switch. I do not understand why it worked by installing with: sudo pip install git + https://github.com/jonty-comp/openob.git@gst1.0

and that it does not work with OpenOB 4.0

JamesHarrison commented 6 years ago

OK - if you can't connect to redis from the client then OpenOB certainly won't work, regardless of branch. If you can get to the point where that redis-cli command succeeds but OpenOB doesn't, then further investigation will be needed.

LyonelB commented 6 years ago

"bind: Address already in use" → Is it ok ?

pi@raspberrypi:~ $ redis-server 920:C 22 Aug 10:14:15.293 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf 920:M 22 Aug 10:14:15.301 Increased maximum number of open files to 10032 (it was originally set to 1024). 920:M 22 Aug 10:14:15.302 # Creating Server TCP listening socket :6379: bind: Address already in use

JamesHarrison commented 6 years ago

That suggests there's already something using port 6379 - probably your OS running redis-server through systemd.

LyonelB commented 6 years ago

must redis-server be installed only on the receiving machine?

JamesHarrison commented 6 years ago

It can be installed on either, but must be present on and running on at least one, and both clients pointed at that server. I'm going to close this, as it's not a bug/code issue but a redis/config issue - the mailing list is a better place to discuss.

LyonelB commented 6 years ago

I do not know why but since last night everything works! I updated the tutorial on the site technic2radio.fr: https://technic2radio.fr/openob-liaison-ip-par-raspberry-pi/