InvenTree: Error 503 during large/fast API access

Please verify that this bug has NOT been raised before.

  • I checked and didn’t find similar issue

Describe the bug*

When accessing the API for e.g. going through all parts and modifying a parameter using inventree python library, we receive error 503 html page. It happens randomly. The server is running apache2 and gunicorn. Any tuning of timeout parameters or number of gunicorn / worker process was not successful. In the plugin settings only the “Enable * integration” are activated. No other plugins.

The only working setup is to disable plugin support (False) in config.yaml before starting the servers

For me it looks like there is an other process that “blocks” API access from time to time - but only if plugin sub-system is enabled

Steps to Reproduce

Bare metal with production setup - apache2 and gunicorn inventree python module and several hundreds of API requests

Expected behavior

no error messages

Deployment Method

  • Docker
  • Bare metal

Version Information

inventree 0.7x, 8.0 python 3.10 with inventree

Relevant log output

couldn't find any useful debug messages

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (9 by maintainers)

Most upvoted comments

After I canceled the parallel stuck “python3 manage.py”, everything worked. The process was an artifact of a “docker exec” call to correct a syntax error in the configuration that prevented the container from restarting in the first place.

@SchrodingersGat, thanks for the helpful hints. Unfortunately I no longer have the messages from the console where you could see this. I think we’ll document it here for the next person who has problems with the keywords.

I have the same problem with a docker installation. Sporadic delivery of a html-page, displaying “The site is currently in maintenance and should be up again soon!” while api calls. after hours of fiddling with the inventree debug configuration i got no helpfull debug output adressing this issue.

inventree-server       | [2024-01-22 09:20:42 +0100] [45] [DEBUG] GET /api/order/po-line/
inventree-server       | (0.000) SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; args=None
inventree-server       | (0.000) SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; args=None
inventree-server       | (0.000) SELECT (1) AS `a` FROM `django_q_task` WHERE (`django_q_task`.`success` AND `django_q_task`.`started` >= '2024-01-22 08:10:42.546973') LIMIT 1; args=('2024-01-22 08:10:42.546973',)
inventree-server       | (0.000) SELECT `common_inventreesetting`.`id`, `common_inventreesetting`.`value`, `common_inventreesetting`.`key` FROM `common_inventreesetting` WHERE `common_inventreesetting`.`key` LIKE '\\_INVENTREE\\_LATEST\\_VERSION' ORDER BY `common_inventreesetting`.`id` ASC LIMIT 1; args=('\\_INVENTREE\\_LATEST\\_VERSION',)
inventree-server       | Saving setting 'InvenTreeSetting:_INVENTREE_LATEST_VERSION' to cache
inventree-server       | (0.001) SELECT `user_sessions_session`.`session_key`, `user_sessions_session`.`session_data`, `user_sessions_session`.`expire_date`, `user_sessions_session`.`user_id`, `user_sessions_session`.`user_agent`, `user_sessions_session`.`last_activity`, `user_sessions_session`.`ip` FROM `user_sessions_session` WHERE (`user_sessions_session`.`expire_date` > '2024-01-22 08:20:42.552807' AND `user_sessions_session`.`session_key` = 'omkmmbpyy41tn4zi6z61wnw25yakjuvl') LIMIT 21; args=('2024-01-22 08:20:42.552807', 'omkmmbpyy41tn4zi6z61wnw25yakjuvl')
inventree-server       | (0.000) SELECT `auth_user`.`id`, `auth_user`.`password`, `auth_user`.`last_login`, `auth_user`.`is_superuser`, `auth_user`.`username`, `auth_user`.`first_name`, `auth_user`.`last_name`, `auth_user`.`email`, `auth_user`.`is_staff`, `auth_user`.`is_active`, `auth_user`.`date_joined` FROM `auth_user` WHERE `auth_user`.`id` = 2 LIMIT 21; args=(2,)
inventree-server       | Service Unavailable: /api/order/po-line/
inventree-server       | Service Unavailable: /api/order/po-line/

the errors occur through all api endpoints. even if the gunicorn server only has to deliver files, the 503 error occurs sporadically.

i really don’t spot a pattern in the error. if you ask google about the sympton, only this one issue really comes up. i have already removed the “inventree-proxy” from the setup and am talking directly to the “inventree-server”.

i would like to solve the problem, but i have no idea how to get more information to narrow down the problem. changing “max_requests” to 0 does not fix the behavior.

the inventree version is 0.13.2. @SchrodingersGat can we re-open this issue und track it down?