'NoneType' object has no attribute 'get_size' in "schedule_auto_resolution" and "schedule_auto_transition_to_ongoing"
- Dominant language
- Python
- Stars
- 44.8k
- Forks
- 4.9k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 624
Description
### Environment
self-hosted (https://develop.sentry.dev/self-hosted/)
### Steps to Reproduce
1. Deploy self hosted sentry using an external redis with SSL enabled
2. Set a BROKER_URL with the `rediss` schema. According to https://github.com/getsentry/sentry/issues/11309 , this is now supported.
3. A recurring couple of errors will now appear on the `internal` project, the "Crons" page as well as the sentry-worker logs, related to the `schedule_auto_resolution` and `schedule_auto_transition_to_ongoing` cron tasks.
### Expected Result
All sentry features should be working normally when using redis with SSL enabled and a BROKER_URL with the rediss schema.
### Actual Result
`sentry-worker` log excerpts:
```
14:28:00 [ERROR] celery.app.trace: Task sentry.tasks.schedule_auto_transition_to_ongoing[e4626d8a-5988-491e-9b8d-3b004a916579] raised unexpected: AttributeError("'NoneType' object has no attribute 'get_size'") (data={'hostname': 'workist-sentry-worker-dfddb5467-l67nb', 'id': 'e4626d8a-5988-491e-9b8d-3b004a916579', 'name': 'sentry.tasks.schedule_auto_transition_to_ongoing', 'exc': 'AttributeError("\'NoneType\' object has no attribute \'get_size\'")', 'traceback': 'Traceback (most recent call last):\n File "/usr/local/lib/python3.8/site-packages/celery/app/trace.py", line 412, in trace_task\n R = retval = fun(*args, **kwargs)\n File "/usr/local/lib/python3.8/site-packages/sentry_sdk/integrations/celery.py", line 280, in _inner\n reraise(*exc_info)\n File "/usr/local/lib/python3.8/site-packages/sentry_sdk/_compat.py", line 99, in reraise\n raise value\n File "/usr/local/lib/python3.8/site-packages/sentry_sdk/integrations/celery.py", line 275, in _inner\n return f(*args, **kwargs)\n File "/usr/local/lib/python3.8/site-packages/celery/app/trace.py", line 704, in __protected_call__\n return self.run(*args, **kwargs)\n File "/usr/local/lib/python3.8/site-packages/sentry/silo/base.py", line 160, in override\n return original_method(*args, **kwargs)\n File "/usr/local/lib/python3.8/site-packages/sentry/tasks/base.py", line 126, in _wrapped\n result = func(*args, **kwargs)\n File "/usr/local/lib/python3.8/site-packages/sentry/tasks/base.py", line 163, in wrapped\n return func(*args, **kwargs)\n File "/usr/local/lib/python3.8/contextlib.py", line 75, in inner\n return func(*args, **kwds)\n File "/usr/local/lib/python3.8/site-packages/sentry/tasks/auto_ongoing_issues.py", line 37, in wrapped\n queue_size = backend.get_size(CELERY_ISSUE_STATES_QUEUE.name)\nAttributeError: \'NoneType\' object has no attribute \'get_size\'\n', 'args': '()', 'kwargs': '{}', 'description': 'raised unexpected', 'internal': False})
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/celery/app/trace.py", line 412, in trace_task
R = retval = fun(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/sentry_sdk/integrations/celery.py", line 280, in _inner
reraise(*exc_info)
File "/usr/local/lib/python3.8/site-packages/sentry_sdk/_compat.py", line 99, in reraise
raise value
File "/usr/local/lib/python3.8/site-packages/sentry_sdk/integrations/celery.py", line 275, in _inner
return f(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/celery/app/trace.py", line 704, in __protected_call__
return self.run(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/sentry/silo/base.py", line 160, in override
return original_method(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/sentry/tasks/base.py", line 126, in _wrapped
result = func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/sentry/tasks/base.py", line 163, in wrapped
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/contextlib.py", line 75, in inner
return func(*args, **kwds)
File "/usr/local/lib/python3.8/site-packages/sentry/tasks/auto_ongoing_issues.py", line 37, in wrapped
queue_size = backend.get_size(CELERY_ISSUE_STATES_QUEUE.name)
AttributeError: 'NoneType' object has no attribute 'get_size'
14:29:00 [ERROR] celery.app.trace: Task sentry.tasks.schedule_auto_transition_to_ongoing[ab87b856-f2fb-42cb-a82a-29564d0ff0de] raised unexpected: AttributeError("'NoneType' object has no attribute 'get_size'") (data={'hostname': 'workist-sentry-worker-dfddb5467-l67nb', 'id': 'ab87b856-f2fb-42cb-a82a-29564d0ff0de', 'name': 'sentry.tasks.schedule_auto_transition_to_ongoing', 'exc': 'AttributeError("\'NoneType\' object has no attribute \'get_size\'")', 'traceback': 'Traceback (most recent call last):\n File "/usr/local/lib/python3.8/site-packages/celery/app/trace.py", line 412, in trace_task\n R = retval = fun(*args, **kwargs)\n File "/usr/local/lib/python3.8/site-packages/sentry_sdk/integrations/celery.py", line 280, in _inner\n reraise(*exc_info)\n File "/usr/local/lib/python3.8/site-packages/sentry_sdk/_compat.py", line 99, in reraise\n raise value\n File "/usr/local/lib/python3.8/site-packages/sentry_sdk/integrations/celery.py", line 275, in _inner\n return f(*args, **kwargs)\n File "/usr/local/lib/python3.8/site-packages/celery/app/trace.py", line 704, in __protected_call__\n return self.run(*args, **kwargs)\n File "/usr/local/lib/python3.8/site-packages/sentry/silo/base.py", line 160, in override\n return original_method(*args, **kwargs)\n File "/usr/local/lib/python3.8/site-packages/sentry/tasks/base.py", line 126, in _wrapped\n result = func(*args, **kwargs)\n File "/usr/local/lib/python3.8/site-packages/sentry/tasks/base.py", line 163, in wrapped\n return func(*args, **kwargs)\n File "/usr/local/lib/python3.8/contextlib.py", line 75, in inner\n return func(*args, **kwds)\n File "/usr/local/lib/python3.8/site-packages/sentry/tasks/auto_ongoing_issues.py", line 37, in wrapped\n queue_size = backend.get_size(CELERY_ISSUE_STATES_QUEUE.name)\nAttributeError: \'NoneType\' object has no attribute \'get_size\'\n', 'args': '()', 'kwargs': '{}', 'description': 'raised unexpected', 'internal': False})
14:29:03 [INFO] sentry.tasks.groupowner: process_suspect_commits.skipped (reason='no_commit')
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/celery/app/trace.py", line 412, in trace_task
R = retval = fun(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/sentry_sdk/integrations/celery.py", line 280, in _inner
reraise(*exc_info)
File "/usr/local/lib/python3.8/site-packages/sentry_sdk/_compat.py", line 99, in reraise
raise value
File "/usr/local/lib/python3.8/site-packages/sentry_sdk/integrations/celery.py", line 275, in _inner
return f(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/celery/app/trace.py", line 704, in __protected_call__
return self.run(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/sentry/silo/base.py", line 160, in override
return original_method(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/sentry/tasks/base.py", line 126, in _wrapped
result = func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/sentry/tasks/auto_ongoing_issues.py", line 37, in wrapped
queue_size = backend.get_size(CELERY_ISSUE_STATES_QUEUE.name)
AttributeError: 'NoneType' object has no attribute 'get_size'
14:30:00 [ERROR] celery.app.trace: Task sentry.tasks.schedule_auto_resolution[7a8b13fe-9873-4e50-946b-23a68f8b42f0] raised unexpected: AttributeError("'NoneType' object has no attribute 'get_size'") (data={'hostname': 'workist-sentry-worker-dfddb5467-l67nb', 'id': '7a8b13fe-9873-4e50-946b-23a68f8b42f0', 'name': 'sentry.tasks.schedule_auto_resolution', 'exc': 'AttributeError("\'NoneType\' object has no attribute \'get_size\'")', 'traceback': 'Traceback (most recent call last):\n File "/usr/local/lib/python3.8/site-packages/celery/app/trace.py", line 412, in trace_task\n R = retval = fun(*args, **kwargs)\n File "/usr/local/lib/python3.8/site-packages/sentry_sdk/integrations/celery.py", line 280, in _inner\n reraise(*exc_info)\n File "/usr/local/lib/python3.8/site-packages/sentry_sdk/_compat.py", line 99, in reraise\n raise value\n File "/usr/local/lib/python3.8/site-packages/sentry_sdk/integrations/celery.py", line 275, in _inner\n return f(*args, **kwargs)\n File "/usr/local/lib/python3.8/site-packages/celery/app/trace.py", line 704, in __protected_call__\n return self.run(*args, **kwargs)\n File "/usr/local/lib/python3.8/site-packages/sentry/silo/base.py", line 160, in override\n return original_method(*args, **kwargs)\n File "/usr/local/lib/python3.8/site-packages/sentry/tasks/base.py", line 126, in _wrapped\n result = func(*args, **kwargs)\n File "/usr/local/lib/python3.8/site-packages/sentry/tasks/auto_ongoing_issues.py", line 37, in wrapped\n queue_size = backend.get_size(CELERY_ISSUE_STATES_QUEUE.name)\nAttributeError: \'NoneType\' object has no attribute \'get_size\'\n', 'args': '()', 'kwargs': '{}', 'description': 'raised unexpected', 'internal': False})
```
These lines occur every time these tasks are invoked.
Screenshots:
JSON export of the sentry issue in the internal project:
[issue.txt](https://github.com/getsentry/sentry/files/12804709/issue.txt)
It seems that the issue originates in https://github.com/getsentry/sentry/blob/a3412c9b502083d935564cf2dd184cc054527143/src/sentry/monitoring/queues.py#L91 Since the `rediss` schema doesn't map to any of the `Backend` classes.
### Product Area
Unknown
### Link
_No response_
### DSN
_No response_
### Version
23.9.1
Contributor guide
Assessment
This issue has not been assessed yet.