sentry icon indicating copy to clipboard operation
sentry copied to clipboard

django.core.exceptions.ImproperlyConfigured: smtp doesn't look like a module path

Open JSchwerberg opened this issue 10 years ago • 8 comments

New installation, on CentOS 7. Using supervisorctl.

Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web Traceback (most recent call last):
Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web   File "/www/sentry/lib/python2.7/site-packages/raven/middleware.py", line 35, in __call__
Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web     iterable = self.application(environ, start_response)
Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web   File "/www/sentry/lib/python2.7/site-packages/sentry/wsgi.py", line 40, in __call__
Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web     response = super(FileWrapperWSGIHandler, self).__call__(environ, start_response)
Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web   File "/www/sentry/lib/python2.7/site-packages/sentry/../django/core/handlers/wsgi.py", line 206, in __call__
Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web     response = self.get_response(request)
Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web   File "/www/sentry/lib/python2.7/site-packages/sentry/../django/core/handlers/base.py", line 176, in get_response
Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web     security_logger.error(force_text(e))
Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web   File "/usr/lib64/python2.7/logging/__init__.py", line 1175, in error
Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web     self._log(ERROR, msg, args, **kwargs)
Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web   File "/usr/lib64/python2.7/logging/__init__.py", line 1268, in _log
Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web     self.handle(record)
Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web   File "/usr/lib64/python2.7/logging/__init__.py", line 1278, in handle
Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web     self.callHandlers(record)
Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web   File "/usr/lib64/python2.7/logging/__init__.py", line 1318, in callHandlers
Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web     hdlr.handle(record)
Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web   File "/usr/lib64/python2.7/logging/__init__.py", line 749, in handle
Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web     self.emit(record)
Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web   File "/www/sentry/lib/python2.7/site-packages/sentry/../django/utils/log.py", line 122, in emit
Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web     connection=self.connection())
Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web   File "/www/sentry/lib/python2.7/site-packages/sentry/../django/utils/log.py", line 125, in connection
Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web     return get_connection(backend=self.email_backend, fail_silently=True)
Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web   File "/www/sentry/lib/python2.7/site-packages/sentry/../django/core/mail/__init__.py", line 29, in get_connection
Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web     klass = import_by_path(backend or settings.EMAIL_BACKEND)
Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web   File "/www/sentry/lib/python2.7/site-packages/sentry/../django/utils/module_loading.py", line 19, in import_by_path
Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web     error_prefix, dotted_path))
Apr  5 16:38:38 WMSCB002-APP03 supervisord: sentry-web django.core.exceptions.ImproperlyConfigured: smtp doesn't look like a module path

All pages fail to load, and throw this error.

JSchwerberg avatar Apr 05 '16 21:04 JSchwerberg

Hey @JSchwerberg Is there more that was spit out? This is a side effect of another error and/or other things failing. This specific error though is fixed by https://github.com/getsentry/sentry/pull/2989

mattrobenolt avatar Apr 05 '16 21:04 mattrobenolt

Also, as a workaround, you can put:

mail.backend: django.core.mail.backends.smtp.EmailBackend

Into your config.yml.

But as I said, this is a side effect of another error and just happens to be the last one shown. :)

mattrobenolt avatar Apr 05 '16 21:04 mattrobenolt

That is actually all that it spits out.

Full log:

(sentry) [root@WMSCB002-APP03 sentry]# SENTRY_CONF=/etc/sentry sentry start
Running service: 'http'
*** Starting uWSGI 2.0.12 (64bit) on [Tue Apr  5 22:24:22 2016] ***
compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-4) on 05 April 2016 17:18:12
os: Linux-3.10.0-229.20.1.el7.x86_64 #1 SMP Tue Nov 3 19:10:07 UTC 2015
nodename: WMSCB002-APP03.WMSCB002.local
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 2
current working directory: /etc/sentry
detected binary path: /www/sentry/bin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
your processes number limit is 15094
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: enabled
uwsgi socket 0 bound to TCP address 0.0.0.0:9000 fd 3
Python version: 2.7.10 (default, Apr  5 2016, 16:51:43)  [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)]
Set PythonHome to /www/sentry
Python main interpreter initialized at 0x2856760
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
setting request body buffering size to 65536 bytes
mapped 1922048 bytes (1877 KB) for 12 cores
*** Operational MODE: preforking+threaded ***
spawned uWSGI master process (pid: 4119)
spawned uWSGI worker 1 (pid: 4125, cores: 4)
spawned uWSGI worker 2 (pid: 4126, cores: 4)
spawned uWSGI worker 3 (pid: 4127, cores: 4)
WSGI app 0 (mountpoint='') ready in 2 seconds on interpreter 0x2856760 pid: 4126 (default app)
WSGI app 0 (mountpoint='') ready in 3 seconds on interpreter 0x2856760 pid: 4127 (default app)
WSGI app 0 (mountpoint='') ready in 3 seconds on interpreter 0x2856760 pid: 4125 (default app)
Traceback (most recent call last):
  File "/www/sentry/lib/python2.7/site-packages/raven/middleware.py", line 35, in __call__
    iterable = self.application(environ, start_response)
  File "/www/sentry/lib/python2.7/site-packages/sentry/wsgi.py", line 40, in __call__
    response = super(FileWrapperWSGIHandler, self).__call__(environ, start_response)
  File "/www/sentry/lib/python2.7/site-packages/sentry/../django/core/handlers/wsgi.py", line 206, in __call__
    response = self.get_response(request)
  File "/www/sentry/lib/python2.7/site-packages/sentry/../django/core/handlers/base.py", line 176, in get_response
    security_logger.error(force_text(e))
  File "/usr/local/lib/python2.7/logging/__init__.py", line 1191, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/usr/local/lib/python2.7/logging/__init__.py", line 1284, in _log
    self.handle(record)
  File "/usr/local/lib/python2.7/logging/__init__.py", line 1294, in handle
    self.callHandlers(record)
  File "/usr/local/lib/python2.7/logging/__init__.py", line 1334, in callHandlers
    hdlr.handle(record)
  File "/usr/local/lib/python2.7/logging/__init__.py", line 757, in handle
    self.emit(record)
  File "/www/sentry/lib/python2.7/site-packages/sentry/../django/utils/log.py", line 122, in emit
    connection=self.connection())
  File "/www/sentry/lib/python2.7/site-packages/sentry/../django/utils/log.py", line 125, in connection
    return get_connection(backend=self.email_backend, fail_silently=True)
  File "/www/sentry/lib/python2.7/site-packages/sentry/../django/core/mail/__init__.py", line 29, in get_connection
    klass = import_by_path(backend or settings.EMAIL_BACKEND)
  File "/www/sentry/lib/python2.7/site-packages/sentry/../django/utils/module_loading.py", line 19, in import_by_path
    error_prefix, dotted_path))
django.core.exceptions.ImproperlyConfigured: smtp doesn't look like a module path
127.0.0.1 - - [05/Apr/2016:22:24:26 +0000] "GET / HTTP/1.0" 500 0 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; Trident/7.0; rv:11.0) like Gecko"

Additionally, when I make the change above, I get different output -- where my requests are failing with an http 400 error:

Running service: 'http'
*** Starting uWSGI 2.0.12 (64bit) on [Tue Apr  5 22:23:33 2016] ***
compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-4) on 05 April 2016 17:18:12
os: Linux-3.10.0-229.20.1.el7.x86_64 #1 SMP Tue Nov 3 19:10:07 UTC 2015
nodename: WMSCB002-APP03.WMSCB002.local
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 2
current working directory: /etc/sentry
detected binary path: /www/sentry/bin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
your processes number limit is 15094
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: enabled
uwsgi socket 0 bound to TCP address 0.0.0.0:9000 fd 3
Python version: 2.7.10 (default, Apr  5 2016, 16:51:43)  [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)]
Set PythonHome to /www/sentry
Python main interpreter initialized at 0x14c1760
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
setting request body buffering size to 65536 bytes
mapped 1922048 bytes (1877 KB) for 12 cores
*** Operational MODE: preforking+threaded ***
spawned uWSGI master process (pid: 4082)
spawned uWSGI worker 1 (pid: 4089, cores: 4)
spawned uWSGI worker 2 (pid: 4090, cores: 4)
spawned uWSGI worker 3 (pid: 4091, cores: 4)
WSGI app 0 (mountpoint='') ready in 2 seconds on interpreter 0x14c1760 pid: 4091 (default app)
127.0.0.1 - - [05/Apr/2016:22:23:35 +0000] "GET / HTTP/1.0" 400 147 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; Trident/7.0; rv:11.0) like Gecko"
WSGI app 0 (mountpoint='') ready in 3 seconds on interpreter 0x14c1760 pid: 4089 (default app)
WSGI app 0 (mountpoint='') ready in 3 seconds on interpreter 0x14c1760 pid: 4090 (default app)
104.xxx.xxx.62 - - [05/Apr/2016:22:23:40 +0000] "GET / HTTP/1.1" 400 147 "-" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; Trident/7.0; rv:11.0) like Gecko"
^CSIGINT/SIGQUIT received...killing workers...
[deadlock-detector] a process holding a robust mutex died. recovering...
worker 1 buried after 1 seconds
worker 2 buried after 1 seconds
worker 3 buried after 1 seconds
goodbye to uWSGI.

JSchwerberg avatar Apr 05 '16 22:04 JSchwerberg

I see, so the error is actually from the 400, then it's erroring trying to log the 400. :) This is becuase of a bad system.url-prefix setting.

Verify that sentry config get system.url-prefix matches the url you're trying to access with.

mattrobenolt avatar Apr 05 '16 22:04 mattrobenolt

I just changed the system.url-prefix setting to the correct setting with SENTRY_CONF=/etc/sentry sentry config set system.url-prefix http://correctsubdomain.mydomain.local and verified that the setting took. I restarted supervisor, and continue to get 400 errors -- logs are identical to those I pasted above.

JSchwerberg avatar Apr 05 '16 22:04 JSchwerberg

Are you sure the correct Host header is being passed along with the request? That's all this validates against.

mattrobenolt avatar Apr 05 '16 22:04 mattrobenolt

Welp, let me just go ahead and close this issue... interestingly, my other uwsgi apps on the same box/ip don't have that issue.

Thanks for the assistance.

JSchwerberg avatar Apr 05 '16 22:04 JSchwerberg

:) I'm going to be releasing an 8.3.1 today which addresses the confusing first error fwiw.

mattrobenolt avatar Apr 05 '16 22:04 mattrobenolt