Shevitz, Daniel W | 23 May 23:48

newbie question with daemonize and too many uwsgi processes

Howdy,

 

I am just learning how to use uwsgi and have a sample django application running under Nginx.

I am running from an Upstart script on Ubuntu.  My Upstart script I lifted from the web from Jeremy Bowers:

 

description "uWSGI server for Project Foo"

start on runlevel [2345]

stop on runlevel [!2345]

respawn

exec /usr/sbin/uwsgi --socket /opt/run/foo.sock\

--chmod-socket --module wsgi_app\

--pythonpath /opt/django-projects/foo/uwsgi\

-p 1

 

Notice “–p 1” I believe this should give me one process, which in fact it does. I know this from the output of “ps –A |grep uwsgi”

 

But if I add the flag

--daemonize /opt/log/uwsgi/uwsgi.log

 

And then run “ps –A|grep uwsgi” I have ten processes running. I assume this a feature, not a bug. So how do I control the number of processes running in daemonize mode?

 

Thanks,

Danny

 

_______________________________________________
uWSGI mailing list
uWSGI@...
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
Roberto De Ioris | 23 May 20:59
Picon
Favicon

Re: Early socket close?


> Happy vacation, Roberto!
> Thanks for the quick fix but isn`t it would be better to make
> uwsgi.disconnect() behave the same way as return or yield ''  i.e. -
> not closing socket untill data send? I understand wsgi sepcification
> but uwsgi.disconnect() is not a part of it and it would be more
> natural to make it behave like return or yield '' imo.
> Additional option --start_response-nodelay seems like redundant in
> this case. I suppose it is very unlikely that someone ever will want
> to start_response() and then uwsgi.disconnect() to not send anything
> in response. (which is default now without --start_response-nodelay.)
>
>

Honestly i do it in a couple of apps where i have a blacklist and i want
to reject peers as soon as possibile without paying for bandwidth :)

By the way, uwsgi.disconnect() can be used in other standard (like Web3 or
Pump) or in other plugins, like the codestring feature of the fastrouter,
so making it so smart to maintain track of start_reponse() status will be
a lot hard.

I am with you, the old non-standard approach looked more "natural" :(
--

-- 
Roberto De Ioris
http://unbit.it
Roberto De Ioris | 23 May 20:27
Picon
Favicon

EuroPython 2012

Someone going to europython 2012 on July ?

--

-- 
Roberto De Ioris
http://unbit.it
林刚 | 23 May 11:19

site error log

HI:

The site error log information, I ask why?

May 23 16:55:39 www tool.com: no mem for new parser
May 23 16:55:43 www tool.com: SDS: Out Of Memory (SDS_ABORT_ON_OOM defined)

--
林刚 Lin Gang
_______________________________________________
uWSGI mailing list
uWSGI@...
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
Roberto De Ioris | 22 May 21:47
Picon
Favicon

Re: Early socket close?


> Hello.
>     I just run into issue with uwsgi 1.2.3
>     When i do start_response() with status code "302 Found"
>     and header [('Connection', 'close'), ('Content-Type',
> 'text/html'), ('Location', 'http://ru.wikipedia.org/wiki/IPad')]
>     and then uwsgi.disconnect() after that nginx says 502 and spits
> out to error log:
>
> 2012/05/22 16:38:12 [error] 54019#0: *132735 upstream prematurely
> closed connection while reading response header from upstream, client:
> 81.19.90.149, server: localhost, request: "GET
> /cl?rex=0317D303E1FD2880&block=serp&st=1337690100&id=title_2&rnd=0.9527389095164835&_URL=http%3A//ru.wikipedia.org/wiki/IPad&yid=1337690100161757-1049739571324732019445193-4-009-XML&ruid=0000001D4F7D452C7D2C470D00000201
> HTTP/1.1", upstream: "uwsgi://unix:/var/run/uwsgi_hypernova.sock:",
> host: "....ru", referrer: "http://....ru/serp?query=ipad"
>
> Same application works ok with uwsgi 1.1.2.
>

Quick fix:

add --start_response-nodelay

or add

yield ""

after start_reponse() call in your code.

Boring reason for the change:

Older uWSGI releases had a non-standard start_rensponse() implementation.
WSGI says start_response has to not send output to the client til the
function returns or yield. Calling uwsgi.disconnect() will now result in
non sending the output generated by start_response().

You can be sure --start_response-nodelay will remains in uWSGI as i need
to use it for other projects too.

--

-- 
Roberto De Ioris
http://unbit.it
Picon

[PATCH] log the correct function that gives error in uwsgi_proto_uwsgi_parser

Hello,

the logs may say read() when recvmsg() was called instead. Not a big 
deal but still. :)

cheers,
riccardo
_______________________________________________
uWSGI mailing list
uWSGI@...
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
Evgeny Turnaev | 22 May 14:49
Picon
Gravatar

Early socket close?

Hello.
    I just run into issue with uwsgi 1.2.3
    When i do start_response() with status code "302 Found"
    and header [('Connection', 'close'), ('Content-Type',
'text/html'), ('Location', 'http://ru.wikipedia.org/wiki/IPad')]
    and then uwsgi.disconnect() after that nginx says 502 and spits
out to error log:

2012/05/22 16:38:12 [error] 54019#0: *132735 upstream prematurely
closed connection while reading response header from upstream, client:
81.19.90.149, server: localhost, request: "GET
/cl?rex=0317D303E1FD2880&block=serp&st=1337690100&id=title_2&rnd=0.9527389095164835&_URL=http%3A//ru.wikipedia.org/wiki/IPad&yid=1337690100161757-1049739571324732019445193-4-009-XML&ruid=0000001D4F7D452C7D2C470D00000201
HTTP/1.1", upstream: "uwsgi://unix:/var/run/uwsgi_hypernova.sock:",
host: "....ru", referrer: "http://....ru/serp?query=ipad"

Same application works ok with uwsgi 1.1.2.

Sysinfo:
FreeBSD 8.1-20100727-SNAP
Python 2.7.2
nginx/1.1.16
--

-- 
--------------------------------------------
Турнаев Евгений Викторович
+7 906 875 09 43
--------------------------------------------
_______________________________________________
uWSGI mailing list
uWSGI <at> lists.unbit.it
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
Łukasz Mierzwa | 21 May 16:36
Picon
Gravatar

Cron eating some resources?

I've left cron running every minute for whole week and it seems that it 
managed to eat all of some resources leaving all of my apps dying all the 
time:

pthread_create(): Resource temporarily unavailable [protocol.c line 1981]
DAMN ! worker 1 (pid: 2) died :( trying respawn ...
Respawned uWSGI worker 1 (new pid: 3)
pthread_create(): Resource temporarily unavailable [protocol.c line 1981]
DAMN ! worker 1 (pid: 3) died :( trying respawn ...
Respawned uWSGI worker 1 (new pid: 4)
pthread_create(): Resource temporarily unavailable [protocol.c line 1981]
DAMN ! worker 1 (pid: 4) died :( trying respawn ...
Respawned uWSGI worker 1 (new pid: 5)
pthread_create(): Resource temporarily unavailable [protocol.c line 1981]
[...]

I also noticed those messages:

fork(): Resource temporarily unavailable [master_utils.c line 507]
waitpid(): No child processes [master.c line 786]
something horrible happened...
...brutally killing workers...

pthread_create(): Resource temporarily unavailable [master.c line 411]
falling back to non-threaded logger...

OVERLOAD !!! unable to offload static file serving

I see that I have ~8k zombie processes:
www-data  1228  0.0  0.0      0     0 ?        Zs   16:09   0:00 [sh] 
<defunct>
And those look like cron command leftovers. I've changed cron command to 
"date" (I case it was my cron script issue) but after a while I see those 
zombie processes again.
Any hints on how to debug it?

Łukasz Mierzwa
_______________________________________________
uWSGI mailing list
uWSGI <at> lists.unbit.it
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
Roberto De Ioris | 19 May 11:36
Picon
Favicon

new feature: custom options


http://projects.unbit.it/uwsgi/wiki/CustomOptions

Feel free to add your ideas/implementations (with credits if you want) to
the wiki page

--

-- 
Roberto De Ioris
http://unbit.it

502 badgateway error help

hello i have this configuration 

[program:lab]
command=/usr/local/bin/uwsgi
  --socket /home/ubuntu/xxx/lab/lab.sock
  --pythonpath /home/ubuntu/xxx/lab
  --master
  --processes 2
  --module juego.deploy_wsgi
  --socket-timeout 18000
  --listen 64
  --post-buffering 16384
  --disable-logging
  --max-requests 100
directory=/home/ubuntu/DJANGO/lab
user=ubuntu
master = 1
autostart=true
autorestart=true
stdout_logfile=/home/ubuntu/xxx/lab/lab.log
redirect_stderr=true
stopsignal=QUIT

but i have many 502 every time helpme i dont not understand
_______________________________________________
uWSGI mailing list
uWSGI@...
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
树上 | 18 May 09:50
Picon

use --limit-as opetion, i got this error:“libgcc_s.so.1 must be installed for pthread_cancel to work ”

environments:
ubuntu 12.04 server LTS
python 2.7
uwsgi 1.2.3
web.py

use --limit-as 128 start uwsgi:
$ uwsgi -x /etc/uwsgi/apps-enabled/app.xml --limit-as 128
[uWSGI] parsing config file /etc/uwsgi/apps-enabled/shuofr.xml
*** Starting uWSGI 1.2.3 (64bit) on [Fri May 18 07:03:00 2012] ***
compiled with version: 4.6.3 on 18 May 2012 06:51:07
   ...
   ...
   ...
spawned uWSGI master process (pid: 29231)
spawned uWSGI worker 1 (pid: 29232, cores: 1)
spawned uWSGI worker 2 (pid: 29233, cores: 1)
spawned uWSGI worker 3 (pid: 29234, cores: 1)
libgcc_s.so.1 must be installed for pthread_cancel to work               <-- got error on here.
DAMN ! worker 1 (pid: 29232) died, killed by signal 6 :( trying respawn ...
Respawned uWSGI worker 1 (new pid: 29237)
^CSIGINT/SIGQUIT received...killing workers...
goodbye to uWSGI.

 i was installed libgcc_s.so.1.
$ ldd /usr/local/bin/uwsgi
        linux-vdso.so.1 =>  (0x00007fff018ab000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f982c8f5000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f982c5fb000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f982c3f6000)
        libxml2.so.2 => /usr/lib/x86_64-linux-gnu/libxml2.so.2 (0x00007f982c09b000)
        libpython2.7.so.1.0 => /usr/lib/libpython2.7.so.1.0 (0x00007f982bb9e000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f982b7e0000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f982cb1a000)
        libz.so.1 => /usr/local/lib/libz.so.1 (0x00007f982b5c7000)
        libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007f982b36b000)
        libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007f982afa2000)
        libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f982ad9f000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f982ab89000)  <--- installed libgcc_s.so.1


how about it?



--
树上 <at> Beijing

# weibo:   <at> __树上__    
# twitter:   <at> cnpopeye


_______________________________________________
uWSGI mailing list
uWSGI@...
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Gmane