Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

uWSGI - monitor list of open connections in listen queue

Tags:

python

uwsgi

I'm receiving the error

"* uWSGI listen queue of socket ":8000" (fd: 3) full !!! (101/100) *"

When it happens, it seems like something gets stuck and no requests are being served.

Is there a way for me to dump the current requests or a list of the pending requests for me to debug that?

like image 934
user972014 Avatar asked Dec 01 '20 09:12

user972014


1 Answers

I don't think you can dump the current requests, but you can configure uWSGI to log them.

There are lots of different ways you can do this, depending on what's most convenient for you. Docs on dealing with uWSGI are here, and they are quite clear relative to the detail in the question (including examples), so I'm not going to belabour them in detail. The docs go through writing to files, creating Unix-style syslogs on remote machines, etc. They also talk about (relevant for you) how you can use pluggable loggers to log only certain events.

There is a section specifically devoted to request logs in the docs, as well as a section called "the uWSGI caching cookbook" which might help speed things up.

Because you're interested in only certain aspects of your logs, you might also want to write a custom-format for the logs so you can easily get at the information you're interested in.

I would guess what's going on is that you are too popular, some part of responding to requests is taking too long , or a combination -- maybe a part of your code needs to be optimized (hopefully the logs would help you determine which requests are taking a long time to process and so diagnose that issue). In any case, hopefully looking at a request when it comes in, and determining what is being requested and how long it takes your codebase to respond, will help you understand what is causing the issue.

In case diving into logging is a bit too heady, you might want to take a look at the more "foundational" information on how to manage a uWSGI server here.

like image 54
NotAnAmbiTurner Avatar answered Nov 07 '22 11:11

NotAnAmbiTurner