Buonasera a tutti,
la settimana scorsa mi sono successi 3 casi problematici di deploy di applicazioni django con uwsgi identici e per me assolutamente inspiegabili al momento. Gradirei molto lumi su come procedere per indagare cosa sia la causa. Nella stessa settimana 3 applicazioni django ancora con Python 2, che stavano funzionando correttamente da mesi/anni su server Debian jessie (2) e Ubuntu 16.04 (1) con uwsgi-emperor ad un reload di uwsgi (touch del file .ini) o al reboot accidentale del server (ubuntu) hanno smesso di funzionare scrivendo nei log che non trovavano alcuni pachetti (vedi sotto). Nello stesso momento anche reinstallando il risultato era il medesimo, mentre applicazioni con Python3 continuavano a funzionare e la soluzione è stata di fare il porting a Python3. In un caso ho un server di test dove funziona ancora la versione con python2 ed ho analizzato con grande cura ogni dettaglio per capire le differenze senza trovarle. È facile pensare che ci sia stato un aggiornamento di software che ha impattato negativamente ma ho verificato con meticolosità ogni cosa che mi viene in mente ed inoltre django con il suo runserver funziona senza problema (dj check, dj shell, dj runserver...), ho anche verificato che il problema sussiste sia con uwsgi 2.0.7, 2.0.12 e 2.0.17 Scrivo di seguito il dettaglio della configurazione di uwsgi ed il file django.wsgi che uso. La configurazione ha funzionato egregiamente per tanti anni e sta funzionando per svariate decine di altri server. Apprezzo qualunque suggerimento di analisi da provare. Non sapere cosa succeda mi lascia molto sulle spine... sandro *:-) Conf uwsgi ---------- [uwsgi] env = DJANGO_SETTINGS_MODULE=web.settings env = HOME=/tmp env = LC_ALL=it_IT.UTF-8 prj_dir = /home/www/www2015.xxx.it wsgi-file = %(prj_dir)/bin/django.wsgi socket = /var/run/uwsgi/extra.sock pidfile = /var/run/uwsgi/extra.pid socket-timeout = 200 buffer-size = 10000 processes = 2 threads = 1 uid = www-data gid = www-data req-logger = file:/var/log/uwsgi/extra-access.log logger = file:/var/log/uwsgi/extra-errors.log touch-logreopen = /var/log/uwsgi/touch-logrotate chmod-socket = 664 plugins = python,logfile django.wsgi ----------- #!/home/www/.base2/bin/python import sys sys.path[0:0] = [ '/home/www/.buildout/eggs/Django-1.8.16-py2.7.egg', '/home/www/.buildout/eggs/ipython-2.4.1-py2.7.egg', '/home/www/.buildout/eggs/Sphinx-1.4.6-py2.7.egg', '/home/www/.buildout/eggs/nose-1.3.7-py2.7.egg', '/home/www/.buildout/eggs/ipdb-0.10.1-py2.7.egg', '/home/www/.buildout/eggs/ipdbplugin-1.4.5-py2.7.egg', '/home/www/.buildout/eggs/django_nose-1.4.4-py2.7.egg', '/home/www/.buildout/eggs/psycopg2-2.6.2-py2.7-linux-x86_64.egg', '/home/www/.buildout/eggs/django_debug_toolbar-1.5-py2.7.egg', '/home/www/.buildout/eggs/Werkzeug-0.11.11-py2.7.egg', '/home/www/.buildout/eggs/cloud_sptheme-1.7.1-py2.7.egg', ... '/home/www/.buildout/eggs/django_appconf-1.0.1-py2.7.egg', '/home/www/.buildout/eggs/contextlib2-0.5.4-py2.7.egg', '/home/www/.buildout/eggs/pytz-2016.6.1-py2.7.egg', '/home/www/.buildout/eggs/MarkupSafe-0.23-py2.7-linux-x86_64.egg', '/home/www/.buildout/eggs/PyYAML-3.12-py2.7-linux-x86_64.egg', '/home/www/.buildout/eggs/cssselect-0.9.2-py2.7.egg', '/home/www/.buildout/eggs/lxml-3.6.4-py2.7-linux-x86_64.egg', '/home/www/.buildout/eggs/python_dateutil-2.6.0-py2.7.egg', '/home/www/www2015.unicasim.it/web/apps', ] import djangorecipe.binscripts application = djangorecipe.binscripts.wsgi('web.settings', logfile='') ------------------------------------------------------------------------- interprete django (equivalente a manage.py) = quello che funziona ------------------------------------------------------------------------- identico al precedente tranne per il finale: if __name__ == '__main__': sys.exit(djangorecipe.binscripts.manage('web.settings')) -------------------------------------------------- il log dell'errore di uwsgi -------------------------------------------------- Mon Mar 26 21:05:31 2018 - received message 0 from emperor SIGINT/SIGQUIT received...killing workers... worker 1 buried after 1 seconds worker 2 buried after 1 seconds goodbye to uWSGI. *** Starting uWSGI 2.0.17 (64bit) on [Mon Mar 26 21:05:38 2018] *** compiled with version: 4.9.2 on 26 March 2018 13:42:02 os: Linux-3.16.0-4-amd64 #1 SMP Debian 3.16.39-1 (2016-12-30) nodename: template-web machine: x86_64 clock source: unix detected number of CPU cores: 1 current working directory: /etc/uwsgi-emperor/vassals-enabled writing pidfile to /var/run/uwsgi/extra.pid detected binary path: /usr/local/bin/uwsgi !!! no internal routing support, rebuild with pcre support !!! your processes number limit is 11962 your memory page size is 4096 bytes detected max file descriptor number: 1024 lock engine: pthread robust mutexes thunder lock: disabled (you can enable it with --thunder-lock) uwsgi socket 0 bound to UNIX address /var/run/uwsgi/extra.sock fd 9 Python version: 2.7.9 (default, Jun 29 2016, 13:11:10) [GCC 4.9.2] Python main interpreter initialized at 0x26b9550 python threads support enabled your server socket listen backlog is limited to 100 connections your mercy for graceful operations on workers is 60 seconds mapped 236472 bytes (230 KB) for 2 cores *** Operational MODE: preforking *** Traceback (most recent call last): File "/home/www/www2015.xxx.it/bin/django.wsgi", line 82, in <module> application = djangorecipe.binscripts.wsgi('web.settings', logfile='') File "/home/www/.buildout/eggs/djangorecipe-2.2.1-py2.7.egg/djangorecipe/binscripts.py", line 61, in wsgi return get_wsgi_application() File "/home/www/.buildout/eggs/Django-1.8.16-py2.7.egg/django/core/wsgi.py", line 14, in get_wsgi_application django.setup() File "/home/www/.buildout/eggs/Django-1.8.16-py2.7.egg/django/__init__.py", line 17, in setup configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) File "/home/www/.buildout/eggs/Django-1.8.16-py2.7.egg/django/conf/__init__.py", line 48, in __getattr__ self._setup(name) File "/home/www/.buildout/eggs/Django-1.8.16-py2.7.egg/django/conf/__init__.py", line 44, in _setup self._wrapped = Settings(settings_module) File "/home/www/.buildout/eggs/Django-1.8.16-py2.7.egg/django/conf/__init__.py", line 92, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE) File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) File "/home/www/www2015.xxx.it/web/settings/__init__.py", line 18, in <module> from jmb.core import monkey ImportError: No module named core unable to load app 0 (mountpoint='') (callable not found or import error) *** no app loaded. going in full dynamic mode *** *** uWSGI is running in multiple interpreter mode *** spawned uWSGI master process (pid: 15746) spawned uWSGI worker 1 (pid: 15749, cores: 1) spawned uWSGI worker 2 (pid: 15750, cores: 1) unable to stat() /var/log/uwsgi/touch-logrotate, events will be triggered as soon as the file is created _______________________________________________ Python mailing list Python@lists.python.it https://lists.python.it/mailman/listinfo/python