self-hosted icon indicating copy to clipboard operation
self-hosted copied to clipboard

uWSGI Segmentation Fault

Open aqtfox opened this issue 1 month ago • 5 comments

Self-Hosted Version

25.10.0

CPU Architecture

x86_64

Docker Version

28.1.1, build 4eba37

Docker Compose Version

2.35.1

Machine Specification

  • [x] My system meets the minimum system requirements of Sentry

Steps to Reproduce

The crash happens everyday, this might be related to: /sentry/sentry.conf.py: "max-worker-lifetime": 86400, lowering it makes it trigger more frequently, besides that I have no concrete way to trigger it.

I did set:

    "http-keepalive": 15,
    "workers": 2,
    "threads": 2,

I have ssl/tls on: SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') USE_X_FORWARDED_HOST = True SESSION_COOKIE_SECURE = True CSRF_COOKIE_SECURE = True SOCIAL_AUTH_REDIRECT_IS_HTTPS = True

Expected Result

To not crash

Actual Result

sentry_instal_log.txt

i have attached the install log and relevant web-1 log:

web-1  | 09:52:22 [INFO] sentry.access.api: api.access (method='GET' view='sentry.web.frontend.home.HomeView' response='302' is_frontend_request='False' path='/' caller_ip='127.0.0.1' user_agent='curl/8.14.1' rate_limited='False' request_duration_seconds='0.003969907760620117' rate_limit_type='DNE')
web-1  | ...The work of process 16659 is done. Seeya!
web-1  | !!! uWSGI process 16659 got Segmentation Fault !!!
web-1  | *** backtrace of 16659 ***
web-1  | /.venv/lib/python3.13/site-packages/pyuwsgi.cpython-313-x86_64-linux-gnu.so(uwsgi_backtrace+0x2f) [0x7fa156bfd31f]
web-1  | /.venv/lib/python3.13/site-packages/pyuwsgi.cpython-313-x86_64-linux-gnu.so(uwsgi_segfault+0x2f) [0x7fa156bfd71f]
web-1  | /lib/x86_64-linux-gnu/libc.so.6(+0x3c050) [0x7fa157138050]
web-1  | /usr/local/bin/../lib/libpython3.13.so.1.0(+0x1c69bf) [0x7fa1574a69bf]
web-1  | /usr/local/lib/python3.13/lib-dynload/_ssl.cpython-313-x86_64-linux-gnu.so(+0x14d0f) [0x7fa1561b3d0f]
web-1  | /usr/local/lib/python3.13/lib-dynload/_ssl.cpython-313-x86_64-linux-gnu.so(+0x17a41) [0x7fa1561b6a41]
web-1  | /usr/local/lib/python3.13/lib-dynload/_ssl.cpython-313-x86_64-linux-gnu.so(+0x1c13c) [0x7fa1561bb13c]
web-1  | /usr/local/lib/python3.13/lib-dynload/_ssl.cpython-313-x86_64-linux-gnu.so(+0x1c836) [0x7fa1561bb836]
web-1  | /usr/local/bin/../lib/libpython3.13.so.1.0(+0x1d4e4d) [0x7fa1574b4e4d]
web-1  | /usr/local/bin/../lib/libpython3.13.so.1.0(PyObject_Vectorcall+0x58) [0x7fa15746a318]
web-1  | /usr/local/bin/../lib/libpython3.13.so.1.0(_PyEval_EvalFrameDefault+0x95bb) [0x7fa1574819fb]
web-1  | /usr/local/bin/../lib/libpython3.13.so.1.0(+0x1d925a) [0x7fa1574b925a]
web-1  | /usr/local/bin/../lib/libpython3.13.so.1.0(+0x1c6b23) [0x7fa1574a6b23]
web-1  | /usr/local/bin/../lib/libpython3.13.so.1.0(_PyEval_EvalFrameDefault+0x57f9) [0x7fa15747dc39]
web-1  | /usr/local/bin/../lib/libpython3.13.so.1.0(+0x1d925a) [0x7fa1574b925a]
web-1  | /usr/local/bin/../lib/libpython3.13.so.1.0(+0x1c6b23) [0x7fa1574a6b23]
web-1  | /usr/local/bin/../lib/libpython3.13.so.1.0(_PyEval_EvalFrameDefault+0x57f9) [0x7fa15747dc39]
web-1  | /usr/local/bin/../lib/libpython3.13.so.1.0(+0x1d92d6) [0x7fa1574b92d6]
web-1  | /usr/local/bin/../lib/libpython3.13.so.1.0(_PyEval_EvalFrameDefault+0x57f9) [0x7fa15747dc39]
web-1  | /usr/local/bin/../lib/libpython3.13.so.1.0(+0x1d92d6) [0x7fa1574b92d6]
web-1  | /usr/local/bin/../lib/libpython3.13.so.1.0(+0x2a78a3) [0x7fa1575878a3]
web-1  | /usr/local/bin/../lib/libpython3.13.so.1.0(+0x21d298) [0x7fa1574fd298]
web-1  | /lib/x86_64-linux-gnu/libc.so.6(+0x891f5) [0x7fa1571851f5]
web-1  | /lib/x86_64-linux-gnu/libc.so.6(__clone+0x40) [0x7fa157204b40]
web-1  | *** end of backtrace ***
web-1  | worker 1 killed successfully (pid: 16659)
web-1  | Respawned uWSGI worker 1 (new pid: 36273)
web-1  | WSGI app 0 (mountpoint='') ready in 21 seconds on interpreter 0x7fa1577d8a70 pid: 36273 (default app)

-- cut --

web-1  | 10:18:56 [INFO] sentry.access.api: api.access (method='GET' view='sentry.web.frontend.home.HomeView' response='302' is_frontend_request='False' path='/' caller_ip='127.0.0.1' user_agent='curl/8.14.1' rate_limited='False' request_duration_seconds='0.0036325454711914062' rate_limit_type='DNE')
web-1  | ...The work of process 16660 is done. Seeya!
web-1  | 10:19:27 [INFO] sentry.access.api: api.access (method='GET' view='sentry.web.frontend.home.HomeView' response='302' is_frontend_request='False' path='/' caller_ip='127.0.0.1' user_agent='curl/8.14.1' rate_limited='False' request_duration_seconds='0.004575967788696289' rate_limit_type='DNE')
web-1  | Traceback (most recent call last):
web-1  |   File "/.venv/lib/python3.13/site-packages/sentry_sdk/transport.py", line 541, in send_envelope_wrapper
web-1  |     self._send_envelope(envelope)
web-1  |     ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
web-1  |   File "/.venv/lib/python3.13/site-packages/sentry_sdk/transport.py", line 474, in _send_envelope
web-1  |     self._send_request(
web-1  |     ~~~~~~~~~~~~~~~~~~^
web-1  |         body.getvalue(),
web-1  |         ^^^^^^^^^^^^^^^^
web-1  |     ...<2 lines>...
web-1  |         envelope=envelope,
web-1  |         ^^^^^^^^^^^^^^^^^^
web-1  |     )
web-1  |     ^
web-1  |   File "/usr/src/sentry/src/sentry/utils/sdk.py", line 286, in patched_send_request
web-1  |     return _send_request(*args, **kwargs)
web-1  |   File "/.venv/lib/python3.13/site-packages/sentry_sdk/transport.py", line 332, in _send_request
web-1  |     response = self._request(
web-1  |         "POST",
web-1  |     ...<2 lines>...
web-1  |         headers,
web-1  |     )
web-1  |   File "/.venv/lib/python3.13/site-packages/sentry_sdk/transport.py", line 744, in _request
web-1  |     response = self._pool.request(
web-1  |         method,
web-1  |     ...<10 lines>...
web-1  |         },
web-1  |     )
web-1  |   File "/.venv/lib/python3.13/site-packages/httpcore/_sync/interfaces.py", line 45, in request
web-1  |     response = self.handle_request(request)
web-1  |   File "/.venv/lib/python3.13/site-packages/httpcore/_sync/connection_pool.py", line 256, in handle_request
web-1  |     raise exc from None
web-1  |   File "/.venv/lib/python3.13/site-packages/httpcore/_sync/connection_pool.py", line 236, in handle_request
web-1  |     response = connection.handle_request(
web-1  |         pool_request.request
web-1  |     )
web-1  |   File "/.venv/lib/python3.13/site-packages/httpcore/_sync/connection.py", line 101, in handle_request
web-1  |     raise exc
web-1  |   File "/.venv/lib/python3.13/site-packages/httpcore/_sync/connection.py", line 78, in handle_request
web-1  |     stream = self._connect(request)
web-1  |   File "/.venv/lib/python3.13/site-packages/httpcore/_sync/connection.py", line 156, in _connect
web-1  |     stream = stream.start_tls(**kwargs)
web-1  |   File "/.venv/lib/python3.13/site-packages/httpcore/_backends/sync.py", line 170, in start_tls
web-1  |     raise exc
web-1  |   File "/.venv/lib/python3.13/site-packages/httpcore/_backends/sync.py", line 165, in start_tls
web-1  |     sock = ssl_context.wrap_socket(
web-1  |         self._sock, server_hostname=server_hostname
web-1  |     )
web-1  |   File "/usr/local/lib/python3.13/ssl.py", line 455, in wrap_socket
web-1  |     return self.sslsocket_class._create(
web-1  |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
web-1  |         sock=sock,
web-1  |         ^^^^^^^^^^
web-1  |     ...<5 lines>...
web-1  |         session=session
web-1  |         ^^^^^^^^^^^^^^^
web-1  |     )
web-1  |     ^
web-1  |   File "/usr/local/lib/python3.13/ssl.py", line 1067, in _create
web-1  |     self._sslobj = self._context._wrap_socket(
web-1  |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~^
web-1  |         self, server_side, self.server_hostname,
web-1  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
web-1  |         owner=self, session=self._session,
web-1  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
web-1  |     )
web-1  |     ^
web-1  | TypeError: 'str' object is not callable
web-1  | 10:19:29 [ERROR] sentry_sdk.errors: Internal error in sentry_sdk
web-1  | panicked at /rustc/1159e78c4747b02ef996e55082b704c09b970588/library/std/src/thread/local.rs:281:25:
web-1  |
web-1  | thread panicked while processing panic. aborting.
web-1  | worker 2 killed successfully (pid: 16660)
web-1  | Respawned uWSGI worker 2 (new pid: 36660)
web-1  | WSGI app 0 (mountpoint='') ready in 20 seconds on interpreter 0x7fa1577d8a70 pid: 36660 (default app)

Event ID

No response

aqtfox avatar Nov 19 '25 11:11 aqtfox

I have ssl/tls on: SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') USE_X_FORWARDED_HOST = True SESSION_COOKIE_SECURE = True CSRF_COOKIE_SECURE = True SOCIAL_AUTH_REDIRECT_IS_HTTPS = True

How did you setup TLS? Is it behind a reverse proxy, or did you embed the TLS certificate into Django?

web-1  | ...The work of process 16659 is done. Seeya!
web-1  | !!! uWSGI process 16659 got Segmentation Fault !!!
web-1  | *** backtrace of 16659 ***
............
web-1  | *** end of backtrace ***
web-1  | worker 1 killed successfully (pid: 16659)
web-1  | Respawned uWSGI worker 1 (new pid: 36273)

👆 The worker respawned itself, are you unable to open the web UI?

web-1  | Traceback (most recent call last):
web-1  |   File "/.venv/lib/python3.13/site-packages/sentry_sdk/transport.py", line 541, in send_envelope_wrapper
web-1  |     self._send_envelope(envelope)
web-1  |     ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
............
web-1  |   File "/.venv/lib/python3.13/site-packages/httpcore/_backends/sync.py", line 165, in start_tls
web-1  |     sock = ssl_context.wrap_socket(
web-1  |         self._sock, server_hostname=server_hostname
web-1  |     )
web-1  |   File "/usr/local/lib/python3.13/ssl.py", line 455, in wrap_socket
web-1  |     return self.sslsocket_class._create(
web-1  |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
web-1  |         sock=sock,
web-1  |         ^^^^^^^^^^
web-1  |     ...<5 lines>...
web-1  |         session=session
web-1  |         ^^^^^^^^^^^^^^^
web-1  |     )
web-1  |     ^
web-1  |   File "/usr/local/lib/python3.13/ssl.py", line 1067, in _create
web-1  |     self._sslobj = self._context._wrap_socket(
web-1  |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~^
web-1  |         self, server_side, self.server_hostname,
web-1  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
web-1  |         owner=self, session=self._session,
web-1  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
web-1  |     )
web-1  |     ^
web-1  | TypeError: 'str' object is not callable
web-1  | 10:19:29 [ERROR] sentry_sdk.errors: Internal error in sentry_sdk

👆 the Sentry SDK (Python) that wants to report to some upstream DSN that uses TLS, fails to create the HTTPS session. This is fine.

aldy505 avatar Nov 24 '25 14:11 aldy505

Thank you for your reply.

It is behind a reverse proxy running on Apache, I've attached the virtual host config below:

<VirtualHost *:80>
    ServerName sentry.redacted_domain
    RewriteEngine on
    RewriteCond %{SERVER_NAME} =sentry.redacted_domain
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

<VirtualHost *:443>
    ServerName sentry.redacted_domain

    ServerAdmin webmaster@localhost

    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/sentry.redacted_domain/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/sentry.redacted_domain/privkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf

    ProxyPreserveHost On
    ProxyPass "/" "http://127.0.0.1:9000/"
    ProxyPassReverse / http://127.0.0.1:9000/
    ProxyTimeout 20

    RequestHeader set X-Forwarded-Proto "https"
    RequestHeader set X-Request-ID "%{UNIQUE_UUID}e"
    RequestHeader set X-Forwarded-For "%{REMOTE_ADDR}s"
    ProxyRequests Off

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

👆 The worker respawned itself, are you unable to open the web UI?

I am able to access the web UI, I checked this ~34 minutes later after the crash happened.

aqtfox avatar Nov 24 '25 16:11 aqtfox

Here is the full sentry.conf.py,

# This file is just Python, with a touch of Django which means
# you can inherit and tweak settings to your hearts content.

from sentry.conf.server import *  # NOQA

BYTE_MULTIPLIER = 1024
UNITS = ("K", "M", "G")


def unit_text_to_bytes(text):
    unit = text[-1].upper()
    power = UNITS.index(unit) + 1
    return float(text[:-1]) * (BYTE_MULTIPLIER**power)


# Generously adapted from pynetlinux: https://github.com/rlisagor/pynetlinux/blob/e3f16978855c6649685f0c43d4c3fcf768427ae5/pynetlinux/ifconfig.py#L197-L223
def get_internal_network():
    import ctypes
    import fcntl
    import math
    import socket
    import struct

    iface = b"eth0"
    sockfd = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    ifreq = struct.pack(b"16sH14s", iface, socket.AF_INET, b"\x00" * 14)

    try:
        ip = struct.unpack(
            b"!I", struct.unpack(b"16sH2x4s8x", fcntl.ioctl(sockfd, 0x8915, ifreq))[2]
        )[0]
        netmask = socket.ntohl(
            struct.unpack(b"16sH2xI8x", fcntl.ioctl(sockfd, 0x891B, ifreq))[2]
        )
    except IOError:
        return ()
    base = socket.inet_ntoa(struct.pack(b"!I", ip & netmask))
    netmask_bits = 32 - int(round(math.log(ctypes.c_uint32(~netmask).value + 1, 2), 1))
    return "{0:s}/{1:d}".format(base, netmask_bits)


INTERNAL_SYSTEM_IPS = (get_internal_network(),)


DATABASES = {
    "default": {
        "ENGINE": "sentry.db.postgres",
        "NAME": "postgres",
        "USER": "postgres",
        "PASSWORD": "",
        "HOST": "pgbouncer",
        "PORT": "",
    }
}

# If you're expecting any kind of real traffic on Sentry, we highly recommend
# configuring the CACHES and Redis settings

###########
# General #
###########

# Instruct Sentry that this install intends to be run by a single organization
# and thus various UI optimizations should be enabled.
SENTRY_SINGLE_ORGANIZATION = True

# Sentry event retention days specifies how long events are retained in the database.
# This should be set on your `.env` or `.env.custom` file, instead of modifying
# the value here.
# NOTE: The longer the days, the more disk space is required.
SENTRY_OPTIONS["system.event-retention-days"] = int(
    env("SENTRY_EVENT_RETENTION_DAYS", "90")
)

# The secret key is being used for various cryptographic operations, such as
# generating a CSRF token, session token, and registering Relay instances.
# The secret key value should be set on your `.env` or `.env.custom` file
# instead of modifying the value here.
#
# If the key ever becomes compromised, it's important to generate a new key.
# Changing this value will result in all current sessions being invalidated.
# A new key can be generated with `$ sentry config generate-secret-key`
if env("SENTRY_SYSTEM_SECRET_KEY"):
    SENTRY_OPTIONS["system.secret-key"] = env("SENTRY_SYSTEM_SECRET_KEY", "")

# Self-hosted Sentry infamously has a lot of Docker containers required to make
# all the features work. Oftentimes, users don't use the full feature set that
# requires all the containers. This is a way to enable only the error monitoring
# feature which also reduces the amount of containers required to run Sentry.
#
# To make Sentry work with all features, set `COMPOSE_PROFILES` to `feature-complete`
# in your `.env` file. To enable only the error monitoring feature, set
# `COMPOSE_PROFILES` to `errors-only`.
#
# See https://develop.sentry.dev/self-hosted/experimental/errors-only/
SENTRY_SELF_HOSTED_ERRORS_ONLY = env("COMPOSE_PROFILES") != "feature-complete"

# When running in an air-gapped environment, set this to True to entirely disable
# external network calls and features that require Internet connectivity.
#
# Setting the value to False while running in an air-gapped environment will
# cause some containers to raise exceptions. One known example is fetching
# AI model prices from various public APIs.
SENTRY_AIR_GAP = False

################
# Node Storage #
################

# Sentry uses an abstraction layer called "node storage" to store raw events.
# Previously, it used PostgreSQL as the backend, but this didn't scale for
# high-throughput environments. Read more about this in the documentation:
# https://develop.sentry.dev/backend/application-domains/nodestore/
#
# Through this setting, you can use the provided blob storage or
# your own S3-compatible API from your infrastructure.
# Other backend implementations for node storage developed by the community
# are available in public GitHub repositories.

SENTRY_NODESTORE = "sentry_nodestore_s3.S3PassthroughDjangoNodeStorage"
SENTRY_NODESTORE_OPTIONS = {
    "compression": True,
    "endpoint_url": "http://seaweedfs:8333",
    "bucket_path": "nodestore",
    "bucket_name": "nodestore",
    "region_name": "us-east-1",
    "aws_access_key_id": "sentry",
    "aws_secret_access_key": "sentry",
}

#########
# Redis #
#########

# Generic Redis configuration used as defaults for various things including:
# Buffers, Quotas, TSDB

SENTRY_OPTIONS["redis.clusters"] = {
    "default": {
        "hosts": {0: {"host": "redis", "password": "", "port": "6379", "db": "0"}}
    }
}

#########
# Cache #
#########

# Sentry currently utilizes two separate mechanisms. While CACHES is not a
# requirement, it will optimize several high throughput patterns.

CACHES = {
    "default": {
        "BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache",
        "LOCATION": ["memcached:11211"],
        "TIMEOUT": 3600,
        "OPTIONS": {"ignore_exc": True},
    }
}

# A primary cache is required for things such as processing events
SENTRY_CACHE = "sentry.cache.redis.RedisCache"

DEFAULT_KAFKA_OPTIONS = {
    "bootstrap.servers": "kafka:9092",
    "message.max.bytes": 50000000,
    "socket.timeout.ms": 1000,
}

SENTRY_EVENTSTREAM = "sentry.eventstream.kafka.KafkaEventStream"
SENTRY_EVENTSTREAM_OPTIONS = {"producer_configuration": DEFAULT_KAFKA_OPTIONS}

KAFKA_CLUSTERS["default"] = DEFAULT_KAFKA_OPTIONS

###############
# Rate Limits #
###############

# Rate limits apply to notification handlers and are enforced per-project
# automatically.

SENTRY_RATELIMITER = "sentry.ratelimits.redis.RedisRateLimiter"

##################
# Update Buffers #
##################

# Buffers (combined with queueing) act as an intermediate layer between the
# database and the storage API. They will greatly improve efficiency on large
# numbers of the same events being sent to the API in a short amount of time.
# (read: if you send any kind of real data to Sentry, you should enable buffers)

SENTRY_BUFFER = "sentry.buffer.redis.RedisBuffer"

##########
# Quotas #
##########

# Quotas allow you to rate limit individual projects or the Sentry install as
# a whole.

SENTRY_QUOTAS = "sentry.quotas.redis.RedisQuota"

########
# TSDB #
########

# The TSDB is used for building charts as well as making things like per-rate
# alerts possible.

SENTRY_TSDB = "sentry.tsdb.redissnuba.RedisSnubaTSDB"

#########
# SNUBA #
#########

SENTRY_SEARCH = "sentry.search.snuba.EventsDatasetSnubaSearchBackend"
SENTRY_SEARCH_OPTIONS = {}
SENTRY_TAGSTORE_OPTIONS = {}

###########
# Digests #
###########

# The digest backend powers notification summaries.

SENTRY_DIGESTS = "sentry.digests.backends.redis.RedisBackend"

##############
# Web Server #
##############

SENTRY_WEB_HOST = "0.0.0.0"
SENTRY_WEB_PORT = 9000
SENTRY_WEB_OPTIONS = {
    "http": "%s:%s" % (SENTRY_WEB_HOST, SENTRY_WEB_PORT),
    "protocol": "uwsgi",
    # This is needed in order to prevent https://github.com/getsentry/sentry/blob/c6f9660e37fcd9c1bbda8ff4af1dcfd0442f5155/src/sentry/services/http.py#L70
    "uwsgi-socket": None,
    "so-keepalive": True,
    # Keep this between 15s-75s as that's what Relay supports
    "http-keepalive": 15,
    "http-chunked-input": True,
    # the number of web workers
    "workers": 2,
    "threads": 2,
    "memory-report": False,
    # The `harakiri` option terminates requests that take longer than the
    # defined amount of time (in seconds) which can help avoid stuck workers
    # caused by GIL issues or deadlocks.
    # Ensure nginx `proxy_read_timeout` configuration (default: 30)
    # on your `nginx.conf` file to be at least 5 seconds longer than this.
    "harakiri": 15,
    # Some stuff so uwsgi will cycle workers sensibly
    "max-requests": 100000,
    "max-requests-delta": 500,
    "max-worker-lifetime": 86400,
    # Duplicate options from sentry default just so we don't get
    # bit by sentry changing a default value that we depend on.
    "thunder-lock": True,
    "log-x-forwarded-for": False,
    "buffer-size": 32768,
    "limit-post": 209715200,
    "disable-logging": True,
    "reload-on-rss": 600,
    "ignore-sigpipe": True,
    "ignore-write-errors": True,
    "disable-write-exception": True,
}

###########
# SSL/TLS #
###########

# If you're using a reverse SSL proxy, you should enable the X-Forwarded-Proto
# header and enable the settings below

SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
USE_X_FORWARDED_HOST = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
SOCIAL_AUTH_REDIRECT_IS_HTTPS = True

# End of SSL/TLS settings

########
# Mail #
########

SENTRY_OPTIONS["mail.list-namespace"] = env("SENTRY_MAIL_HOST", "localhost")
SENTRY_OPTIONS["mail.from"] = f"sentry@{SENTRY_OPTIONS['mail.list-namespace']}"

############
# Features #
############

# Sentry uses feature flags to enable certain features. Some features may
# require additional configuration or containers. To learn more about how
# Sentry uses feature flags, see https://develop.sentry.dev/backend/application-domains/feature-flags/
#
# The features listed here are stable and generally available on SaaS.
# To enable preview features, see https://develop.sentry.dev/self-hosted/configuration/#enabling-preview-features

SENTRY_FEATURES["projects:sample-events"] = False
SENTRY_FEATURES.update(
    {
        feature: True
        for feature in (
            "organizations:discover",
            "organizations:global-views",
            "organizations:issue-views",
            "organizations:incidents",
            "organizations:integrations-issue-basic",
            "organizations:integrations-issue-sync",
            "organizations:invite-members",
            "organizations:sso-basic",
            "organizations:sso-saml2",
            "organizations:advanced-search",
            "organizations:issue-platform",
            "organizations:monitors",
            "organizations:dashboards-mep",
            "organizations:mep-rollout-flag",
            "organizations:dashboards-rh-widget",
            "organizations:dynamic-sampling",
            "projects:custom-inbound-filters",
            "projects:data-forwarding",
            "projects:discard-groups",
            "projects:plugins",
            "projects:rate-limits",
            "projects:servicehooks",
        )
        # Performance/Tracing/Spans related flags
        + (
            "organizations:performance-view",
            "organizations:span-stats",
            "organizations:visibility-explore-view",
            "organizations:visibility-explore-range-high",
            "organizations:transaction-metrics-extraction",
            "organizations:indexed-spans-extraction",
            "organizations:insights-entry-points",
            "organizations:insights-initial-modules",
            "organizations:insights-addon-modules",
            "organizations:insights-modules-use-eap",
            "organizations:standalone-span-ingestion",
            "organizations:starfish-mobile-appstart",
            "projects:span-metrics-extraction",
            "projects:span-metrics-extraction-addons",
        )
        # Session Replay related flags
        + (
            "organizations:session-replay",
        )
        # User Feedback related flags
        + (
            "organizations:user-feedback-ui",
        )
        # Profiling related flags
        + (
            "organizations:profiling",
            "organizations:profiling-view",
        )
        # Continuous Profiling related flags
        + (
            "organizations:continuous-profiling",
            "organizations:continuous-profiling-stats",
        )
        # Uptime Monitoring related flags
        + (
            "organizations:uptime",
            "organizations:uptime-create-issues",
        )
        # Logs related flags
        + (
            "organizations:ourlogs-enabled",
            "organizations:ourlogs-ingestion",
            "organizations:ourlogs-stats",
            "organizations:ourlogs-replay-ui",
        )
    }
)

#######################
# MaxMind Integration #
#######################

GEOIP_PATH_MMDB = "/geoip/GeoLite2-City.mmdb"

#########################
# Bitbucket Integration #
#########################

# BITBUCKET_CONSUMER_KEY = 'YOUR_BITBUCKET_CONSUMER_KEY'
# BITBUCKET_CONSUMER_SECRET = 'YOUR_BITBUCKET_CONSUMER_SECRET'

##############################################
# Content Security Policy settings
##############################################

# CSP_REPORT_URI = "https://{your-sentry-installation}/api/{csp-project}/security/?sentry_key={sentry-key}"
CSP_REPORT_ONLY = True

# optional extra permissions
# https://django-csp.readthedocs.io/en/latest/configuration.html
# CSP_SCRIPT_SRC += ["example.com"]

############################
# Sentry Endpoint Settings #
############################

# If your Sentry installation has different hostnames for ingestion and web UI,
# in which your web UI is accessible via private corporate network, yet your
# ingestion hostname is accessible from the public internet, you can uncomment
# this following options in order to have the ingestion hostname rendered
# correctly on the SDK configuration UI.
#
# SENTRY_ENDPOINT = "https://sentry.ingest.example.com"

#################
# CSRF Settings #
#################

# Since version 24.1.0, Sentry migrated to Django 4 which contains stricter CSRF protection.
# If you are accessing Sentry from multiple domains behind a reverse proxy, you should set
# this to match your IPs/domains. Ports should be included if you are using custom ports.
# https://docs.djangoproject.com/en/4.2/ref/settings/#std-setting-CSRF_TRUSTED_ORIGINS

# CSRF_TRUSTED_ORIGINS = ["https://example.com", "http://127.0.0.1:9000"]

#################
# JS SDK Loader #
#################

# Configure Sentry JS SDK bundle URL template for Loader Scripts.
# Learn more about the Loader Scripts: https://docs.sentry.io/platforms/javascript/install/loader/
# If you wish to host your own JS SDK bundles, set `SETUP_JS_SDK_ASSETS` environment variable to `1`
# on your `.env` or `.env.custom` file. Then, replace the value below with your own public URL.
# For example: "https://sentry.example.com/js-sdk/%s/bundle%s.min.js"
#
# By default, the previous JS SDK assets version will be pruned during upgrades, if you wish
# to keep the old assets, set `SETUP_JS_SDK_KEEP_OLD_ASSETS` environment variable to any value on
# your `.env` or `.env.custom` file. The files should only be a few KBs, and this might be useful
# if you're using it directly like a CDN instead of using the loader script.
JS_SDK_LOADER_DEFAULT_SDK_URL = "https://browser.sentry-cdn.com/%s/bundle%s.min.js"

#####################
# Insights Settings #
#####################

# Since version 24.3.0, Insights features are available on self-hosted. For Requests module,
# there are scrubbing logic done on Relay to prevent high cardinality of stored HTTP hosts.
# However in self-hosted scenario, the amount of stored HTTP hosts might be consistent,
# and you may have allow list of hosts that you want to keep. Uncomment the following line
# to allow specific hosts. It might be IP addresses or domain names (without `http://` or `https://`).

# SENTRY_OPTIONS["relay.span-normalization.allowed_hosts"] = ["example.com", "192.168.10.1"]

##############
# Monitoring #
##############

# By default, Sentry uses dummy statsd monitoring backend that is a no-op.
# If you have a statsd server, you can utilize that to monitor self-hosted
# Sentry for "sentry"-related containers.
#
# To start, uncomment the following line and adjust the options as needed.

# SENTRY_METRICS_BACKEND = 'sentry.metrics.statsd.StatsdMetricsBackend'
# SENTRY_METRICS_OPTIONS: dict[str, Any] = {
#     'host': '100.100.123.123', # It is recommended to use IP address instead of domain name
#     'port': 8125,
# }
# SENTRY_METRICS_SAMPLE_RATE = 1.0   # Adjust this to your needs, default is 1.0
# SENTRY_METRICS_PREFIX = "sentry."  # Adjust this to your needs, default is "sentry."

aqtfox avatar Nov 24 '25 16:11 aqtfox

Just another hunch, did you delete the internal project on your Sentry?

If that's the case, can you try create a new project to report internal errors, and set SENTRY_DSN environment variable to the new project's DSN? You should add it on your docker-compose.yml: https://github.com/getsentry/self-hosted/blob/c9aa6268f54db434c200d2ce79912aba9413dd18/docker-compose.yml#L53-L72

Becomes:

x-sentry-defaults: &sentry_defaults
  # ...
  environment:
    # ...
    SENTRY_DSN: "your new  DSN here"

aldy505 avatar Nov 30 '25 02:11 aldy505

Image

Unfortunately not the internal project is there :(

aqtfox avatar Nov 30 '25 10:11 aqtfox