StackStorm / StackStorm/st2

SSL Error with st2 sensor connection redis

Open
#5,337 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stale
Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

Getting these errors while connecting to redis with SSL. A normal action runs fine, sensor seems to be having problem. I did try to use the fixes mentioned in https://github.com/eventlet/eventlet/issues/371 but none of the different combinations of library versions seem to work for my case.

lib versions tried:
redis==latest/3.3.5
eventlet==latest/0.17.4
Flask-SocketIO==4.2.1
dnspython==latest/1.16.0

021-08-17 14:32:25,839 WARNING [-] Sensor "XYZSensor" run method raised an exception: Error while reading from socket: ('timed out',).
Traceback (most recent call last):
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/redis/connection.py", line 198, in _read_from_socket
    data = recv(self._sock, socket_read_size)
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/redis/_compat.py", line 72, in recv
    return sock.recv(*args, **kwargs)
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/eventlet/green/ssl.py", line 231, in recv
    return self._base_recv(buflen, flags, into=False)
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/eventlet/green/ssl.py", line 258, in _base_recv
    read = self.read(nbytes)
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/eventlet/green/ssl.py", line 176, in read
    super(GreenSSLSocket, self).read, *args, **kwargs)
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/eventlet/green/ssl.py", line 156, in _call_trampolining
    timeout_exc=timeout_exc('timed out'))
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/eventlet/hubs/__init__.py", line 159, in trampoline
    return hub.switch()
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/eventlet/hubs/hub.py", line 298, in switch
    return self.greenlet.switch()
ssl.SSLError: ('timed out',)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/st2reactor/container/sensor_wrapper.py", line 229, in run
    self._sensor_instance.run()
  File "/opt/stackstorm/packs/st2sensors/sensors/vmc_event_notification_sensor.py", line 56, in run
    self.pubsub.subscribe('XYZEvents')
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/redis/client.py", line 3580, in subscribe
    ret_val = self.execute_command('SUBSCRIBE', *iterkeys(new_channels))
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/redis/client.py", line 3468, in execute_command
    self.shard_hint
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/redis/connection.py", line 1203, in get_connection
    if connection.can_read():
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/redis/connection.py", line 734, in can_read
    return self._parser.can_read(timeout)
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/redis/connection.py", line 321, in can_read
    return self._buffer and self._buffer.can_read(timeout)
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/redis/connection.py", line 231, in can_read
    raise_on_timeout=False)
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/redis/connection.py", line 223, in _read_from_socket
    (ex.args,))
    ```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with st2reactor/container/sensor_wrapper.py and the sensor entry point shown at /opt/stackstorm/packs/st2sensors/sensors/vmc_event_notification_sensor.py:56, then trace the Redis subscription through redis/client.py and redis/connection.py. Reproduce the SSL connection timeout and determine whether the sensor path differs from the working normal action. Done means the sensor can subscribe over SSL without the reported timeout, with the relevant behavior covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, redis
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.