Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uwsgi problem #2

Closed
Joe-Heffer-Shef opened this issue May 17, 2023 · 4 comments
Closed

uwsgi problem #2

Joe-Heffer-Shef opened this issue May 17, 2023 · 4 comments
Assignees

Comments

@Joe-Heffer-Shef
Copy link
Contributor

NGINX is running fine. UWSGI is running but has these errors:

sa_cs1jsth@ufdlsrv01:~$ sudo journalctl -u data_logger_server.service --since 2023-05-12

May 12 14:23:23 ufdlsrv01 systemd[1]: Started Data Logger Server uWSGI service.
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: [uWSGI] getting INI configuration from /opt/wsgi/data_logger_server.ini
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: *** Starting uWSGI 2.0.20 (64bit) on [Fri May 12 14:23:23 2023] ***
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: compiled with version: 9.3.0 on 01 November 2021 13:29:59
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: os: Linux-5.4.0-148-generic #165-Ubuntu SMP Tue Apr 18 08:53:12 UTC 2023
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: nodename: ufdlsrv01
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: machine: x86_64
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: clock source: unix
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: detected number of CPU cores: 2
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: current working directory: /opt/data_logger_server
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: detected binary path: /opt/data_logger_server/venv/bin/uwsgi
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: !!! no internal routing support, rebuild with pcre support !!!
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: your processes number limit is 7562
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: your memory page size is 4096 bytes
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: detected max file descriptor number: 1024
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: lock engine: pthread robust mutexes
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: thunder lock: disabled (you can enable it with --thunder-lock)
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: uwsgi socket 0 bound to UNIX address /run/dlsrv/wsgi.sock fd 3
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: Python version: 3.9.5 (default, Nov 23 2021, 15:27:38)  [GCC 9.3.0]
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: Python main interpreter initialized at 0x5643ca6d14a0
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: python threads support enabled
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: your server socket listen backlog is limited to 100 connections
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: your mercy for graceful operations on workers is 60 seconds
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: mapped 416720 bytes (406 KB) for 8 cores
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: *** Operational MODE: preforking+threaded ***
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: Traceback (most recent call last):
May 12 14:23:23 ufdlsrv01 uwsgi[48202]:   File "/opt/data_logger_server/./wsgi.py", line 8, in <module>
May 12 14:23:23 ufdlsrv01 uwsgi[48202]:     app = app_factory.create_app()
May 12 14:23:23 ufdlsrv01 uwsgi[48202]:   File "/opt/data_logger_server/./app_factory.py", line 14, in create_app
May 12 14:23:23 ufdlsrv01 uwsgi[48202]:     with open(settings.RESPONSE_TEMPLATE_PATH) as file:
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: AttributeError: module 'settings' has no attribute 'RESPONSE_TEMPLATE_PATH'
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: unable to load app 0 (mountpoint='') (callable not found or import error)
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: *** no app loaded. going in full dynamic mode ***
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: *** uWSGI is running in multiple interpreter mode ***
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: spawned uWSGI master process (pid: 48202)
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: spawned uWSGI worker 1 (pid: 48220, cores: 2)
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: spawned uWSGI worker 2 (pid: 48221, cores: 2)
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: spawned uWSGI worker 3 (pid: 48222, cores: 2)
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: spawned uWSGI worker 4 (pid: 48224, cores: 2)
May 12 14:24:43 ufdlsrv01 uwsgi[48220]: --- no python application found, check your startup logs for errors ---
May 12 14:24:43 ufdlsrv01 uwsgi[48220]: [pid: 48220|app: -1|req: -1/1] 172.30.10.151 () {40 vars in 616 bytes} [Fri May 12 14:24:43 2023] POST /ott/?stationid=1234&action=senddata => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (1 switches on core 0)
May 12 14:27:20 ufdlsrv01 uwsgi[48222]: --- no python application found, check your startup logs for errors ---
May 12 14:27:20 ufdlsrv01 uwsgi[48222]: [pid: 48222|app: -1|req: -1/2] 172.30.10.151 () {40 vars in 616 bytes} [Fri May 12 14:27:20 2023] POST /ott/?stationid=1234&action=senddata => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (1 switches on core 0)
May 12 15:21:15 ufdlsrv01 uwsgi[48222]: --- no python application found, check your startup logs for errors ---
May 12 15:21:15 ufdlsrv01 uwsgi[48222]: [pid: 48222|app: -1|req: -1/3] 172.30.10.151 () {42 vars in 615 bytes} [Fri May 12 15:21:15 2023] POST /ott/?stationid=1234 => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (1 switches on core 1)
May 12 15:24:49 ufdlsrv01 uwsgi[48220]: --- no python application found, check your startup logs for errors ---
May 12 15:24:49 ufdlsrv01 uwsgi[48220]: [pid: 48220|app: -1|req: -1/4] 172.30.10.151 () {42 vars in 615 bytes} [Fri May 12 15:24:49 2023] POST /ott/?stationid=1234 => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (1 switches on core 1)
May 12 15:24:59 ufdlsrv01 uwsgi[48220]: --- no python application found, check your startup logs for errors ---
May 12 15:24:59 ufdlsrv01 uwsgi[48220]: [pid: 48220|app: -1|req: -1/5] 172.30.10.151 () {42 vars in 615 bytes} [Fri May 12 15:24:59 2023] POST /ott/?stationid=1234 => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)
May 12 15:25:01 ufdlsrv01 uwsgi[48220]: --- no python application found, check your startup logs for errors ---
May 12 15:25:01 ufdlsrv01 uwsgi[48220]: [pid: 48220|app: -1|req: -1/6] 172.30.10.151 () {42 vars in 615 bytes} [Fri May 12 15:25:01 2023] POST /ott/?stationid=1234 => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 1)
May 12 15:25:27 ufdlsrv01 uwsgi[48224]: --- no python application found, check your startup logs for errors ---
May 12 15:25:27 ufdlsrv01 uwsgi[48224]: [pid: 48224|app: -1|req: -1/7] 172.30.10.151 () {42 vars in 613 bytes} [Fri May 12 15:25:27 2023] POST /ott?stationid=1234 => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)
May 12 15:37:28 ufdlsrv01 uwsgi[48224]: --- no python application found, check your startup logs for errors ---
May 12 15:37:28 ufdlsrv01 uwsgi[48224]: [pid: 48224|app: -1|req: -1/8] 172.30.10.151 () {36 vars in 441 bytes} [Fri May 12 15:37:28 2023] HEAD /ping => generated 21 bytes in 11 msecs (HTTP/1.1 500) 2 headers in 83 bytes (1 switches on core 1)
May 12 15:37:34 ufdlsrv01 uwsgi[48221]: --- no python application found, check your startup logs for errors ---
May 12 15:37:34 ufdlsrv01 uwsgi[48221]: [pid: 48221|app: -1|req: -1/9] 172.30.10.151 () {36 vars in 441 bytes} [Fri May 12 15:37:34 2023] HEAD /ping => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)
May 12 15:38:18 ufdlsrv01 uwsgi[48220]: --- no python application found, check your startup logs for errors ---
May 12 15:38:18 ufdlsrv01 uwsgi[48220]: [pid: 48220|app: -1|req: -1/10] 172.30.10.151 () {36 vars in 441 bytes} [Fri May 12 15:38:18 2023] HEAD /ping => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)
May 12 15:38:23 ufdlsrv01 uwsgi[48222]: --- no python application found, check your startup logs for errors ---
May 12 15:38:23 ufdlsrv01 uwsgi[48222]: [pid: 48222|app: -1|req: -1/11] 172.30.10.151 () {36 vars in 441 bytes} [Fri May 12 15:38:23 2023] HEAD /ping => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)

@Joe-Heffer-Shef Joe-Heffer-Shef self-assigned this May 17, 2023
@Joe-Heffer-Shef
Copy link
Contributor Author

Joe-Heffer-Shef commented May 17, 2023

It looks like there is a setting variable missing

May 12 14:23:23 ufdlsrv01 uwsgi[48202]: Traceback (most recent call last):
May 12 14:23:23 ufdlsrv01 uwsgi[48202]:   File "/opt/data_logger_server/./wsgi.py", line 8, in <module>
May 12 14:23:23 ufdlsrv01 uwsgi[48202]:     app = app_factory.create_app()
May 12 14:23:23 ufdlsrv01 uwsgi[48202]:   File "/opt/data_logger_server/./app_factory.py", line 14, in create_app
May 12 14:23:23 ufdlsrv01 uwsgi[48202]:     with open(settings.RESPONSE_TEMPLATE_PATH) as file:
May 12 14:23:23 ufdlsrv01 uwsgi[48202]: AttributeError: module 'settings' has no attribute 'RESPONSE_TEMPLATE_PATH'

The settings file looks like this:

sa_cs1jsth@ufdlsrv01:/opt/data_logger_server$ more settings*.py
::::::::::::::
settings_local.py
::::::::::::::
"""
Machine-specific configuration files
"""

import pathlib

ROOT_DIR = pathlib.Path('/home/uflo/data/rawData/dlsrv')

# Subdirectories
DATA_DIR = ROOT_DIR.joinpath('senddata')
ALARM_DIR = ROOT_DIR.joinpath('sendalarm')
::::::::::::::
settings.py
::::::::::::::
"""
Machine-specific configuration files
"""

import pathlib

ROOT_DIR = pathlib.Path('/home/uflo/data/rawData/dlsrv')
RESPONSE_TEMPLATE = ''
# Subdirectories
DATA_DIR = ROOT_DIR.joinpath('senddata')
ALARM_DIR = ROOT_DIR.joinpath('sendalarm')

This file is installed by the install script
https://github.com/urban-flows/data-logger-server/blob/master/install.sh#L56

@Joe-Heffer-Shef
Copy link
Contributor Author

Joe-Heffer-Shef commented May 17, 2023

I restarted UWSGI to attempt to reproduce the error:

sa_cs1jsth@ufdlsrv01:/opt/data_logger_server$ sudo systemctl restart data_logger_server.service
sa_cs1jsth@ufdlsrv01:/opt/data_logger_server$ sudo journalctl -u data_logger_server.service --since today --follow
-- Logs begin at Tue 2022-10-18 15:16:23 BST. --
May 17 11:40:17 ufdlsrv01 systemd[1]: Stopping Data Logger Server uWSGI service...
May 17 11:40:17 ufdlsrv01 uwsgi[48202]: SIGINT/SIGTERM received...killing workers...
May 17 11:40:18 ufdlsrv01 uwsgi[48202]: worker 1 buried after 1 seconds
May 17 11:40:18 ufdlsrv01 uwsgi[48202]: worker 2 buried after 1 seconds
May 17 11:40:18 ufdlsrv01 uwsgi[48202]: worker 3 buried after 1 seconds
May 17 11:40:18 ufdlsrv01 uwsgi[48202]: worker 4 buried after 1 seconds
May 17 11:40:18 ufdlsrv01 uwsgi[48202]: goodbye to uWSGI.
May 17 11:40:18 ufdlsrv01 uwsgi[48202]: VACUUM: unix socket /run/dlsrv/wsgi.sock removed.
May 17 11:40:18 ufdlsrv01 systemd[1]: data_logger_server.service: Succeeded.
May 17 11:40:18 ufdlsrv01 systemd[1]: Stopped Data Logger Server uWSGI service.
May 17 11:40:18 ufdlsrv01 systemd[1]: Started Data Logger Server uWSGI service.
May 17 11:40:18 ufdlsrv01 uwsgi[98215]: [uWSGI] getting INI configuration from /opt/wsgi/data_logger_server.ini
May 17 11:40:18 ufdlsrv01 uwsgi[98215]: *** Starting uWSGI 2.0.20 (64bit) on [Wed May 17 11:40:18 2023] ***
May 17 11:40:18 ufdlsrv01 uwsgi[98215]: compiled with version: 9.3.0 on 01 November 2021 13:29:59
May 17 11:40:18 ufdlsrv01 uwsgi[98215]: os: Linux-5.4.0-148-generic #165-Ubuntu SMP Tue Apr 18 08:53:12 UTC 2023
May 17 11:40:18 ufdlsrv01 uwsgi[98215]: nodename: ufdlsrv01
May 17 11:40:18 ufdlsrv01 uwsgi[98215]: machine: x86_64
May 17 11:40:18 ufdlsrv01 uwsgi[98215]: clock source: unix
May 17 11:40:18 ufdlsrv01 uwsgi[98215]: detected number of CPU cores: 2
May 17 11:40:18 ufdlsrv01 uwsgi[98215]: current working directory: /opt/data_logger_server
May 17 11:40:18 ufdlsrv01 uwsgi[98215]: detected binary path: /opt/data_logger_server/venv/bin/uwsgi
May 17 11:40:18 ufdlsrv01 uwsgi[98215]: !!! no internal routing support, rebuild with pcre support !!!
May 17 11:40:18 ufdlsrv01 uwsgi[98215]: your processes number limit is 7562
May 17 11:40:18 ufdlsrv01 uwsgi[98215]: your memory page size is 4096 bytes
May 17 11:40:18 ufdlsrv01 uwsgi[98215]: detected max file descriptor number: 1024
May 17 11:40:18 ufdlsrv01 uwsgi[98215]: lock engine: pthread robust mutexes
May 17 11:40:18 ufdlsrv01 uwsgi[98215]: thunder lock: disabled (you can enable it with --thunder-lock)
May 17 11:40:18 ufdlsrv01 uwsgi[98215]: uwsgi socket 0 bound to UNIX address /run/dlsrv/wsgi.sock fd 3
May 17 11:40:18 ufdlsrv01 uwsgi[98215]: Python version: 3.9.5 (default, Nov 23 2021, 15:27:38)  [GCC 9.3.0]
May 17 11:40:19 ufdlsrv01 uwsgi[98215]: Python main interpreter initialized at 0x55bf30ebb4a0
May 17 11:40:19 ufdlsrv01 uwsgi[98215]: python threads support enabled
May 17 11:40:19 ufdlsrv01 uwsgi[98215]: your server socket listen backlog is limited to 100 connections
May 17 11:40:19 ufdlsrv01 uwsgi[98215]: your mercy for graceful operations on workers is 60 seconds
May 17 11:40:19 ufdlsrv01 uwsgi[98215]: mapped 416720 bytes (406 KB) for 8 cores
May 17 11:40:19 ufdlsrv01 uwsgi[98215]: *** Operational MODE: preforking+threaded ***
May 17 11:40:21 ufdlsrv01 uwsgi[98215]: Traceback (most recent call last):
May 17 11:40:21 ufdlsrv01 uwsgi[98215]:   File "/opt/data_logger_server/./wsgi.py", line 8, in <module>
May 17 11:40:21 ufdlsrv01 uwsgi[98215]:     app = app_factory.create_app()
May 17 11:40:21 ufdlsrv01 uwsgi[98215]:   File "/opt/data_logger_server/./app_factory.py", line 14, in create_app
May 17 11:40:21 ufdlsrv01 uwsgi[98215]:     with open(settings.RESPONSE_TEMPLATE_PATH) as file:
May 17 11:40:21 ufdlsrv01 uwsgi[98215]: AttributeError: module 'settings' has no attribute 'RESPONSE_TEMPLATE_PATH'
May 17 11:40:21 ufdlsrv01 uwsgi[98215]: unable to load app 0 (mountpoint='') (callable not found or import error)
May 17 11:40:21 ufdlsrv01 uwsgi[98215]: *** no app loaded. going in full dynamic mode ***
May 17 11:40:21 ufdlsrv01 uwsgi[98215]: *** uWSGI is running in multiple interpreter mode ***
May 17 11:40:21 ufdlsrv01 uwsgi[98215]: spawned uWSGI master process (pid: 98215)
May 17 11:40:21 ufdlsrv01 uwsgi[98215]: spawned uWSGI worker 1 (pid: 98230, cores: 2)
May 17 11:40:21 ufdlsrv01 uwsgi[98215]: spawned uWSGI worker 2 (pid: 98231, cores: 2)
May 17 11:40:21 ufdlsrv01 uwsgi[98215]: spawned uWSGI worker 3 (pid: 98233, cores: 2)
May 17 11:40:21 ufdlsrv01 uwsgi[98215]: spawned uWSGI worker 4 (pid: 98234, cores: 2)
sa_cs1jsth@ufdlsrv01:/opt/data_logger_server$ sudo systemctl stop data_logger_server.service

@Joe-Heffer-Shef
Copy link
Contributor Author

Joe-Heffer-Shef commented May 17, 2023

The settings feature in settings.py should use environment variables, not Python variables.
see: #5

@Joe-Heffer-Shef
Copy link
Contributor Author

Manually edited the settings files

sa_cs1jsth@ufdlsrv01:/opt/data_logger_server$ more settings*.py
::::::::::::::
settings_local.py
::::::::::::::
"""
Machine-specific configuration files
"""

import pathlib

ROOT_DIR = pathlib.Path('/home/uflo/data/rawData/dlsrv')

# Subdirectories
DATA_DIR = ROOT_DIR.joinpath('senddata')
ALARM_DIR = ROOT_DIR.joinpath('sendalarm')
::::::::::::::
settings.py
::::::::::::::
"""
Machine-specific configuration files
"""

import pathlib

ROOT_DIR = pathlib.Path('/home/uflo/data/rawData/dlsrv')
RESPONSE_TEMPLATE_PATH = '/opt/data_logger_server/response_template.xml'
# Subdirectories
DATA_DIR = ROOT_DIR.joinpath('senddata')
ALARM_DIR = ROOT_DIR.joinpath('sendalarm')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant