Open Lispython opened 7 years ago
The last code block looks exactly the same as the one you report hanging. Please post your config please
[uwsgi]
chdir=/usr/src/app/
env = APP_ROLE=dev_uwsgi
wsgi-file = /usr/src/app/flask_app.py
master=True
vacuum=True
max-requests=5000
harakiri=120
post-buffering=65536
workers=4
#enable-threads=True
#listen=4000
# socket=0.0.0.0:8997
stats=/tmp/uwsgi-app.stats
#logger=syslog:uwsgi_app_stage,local0
buffer-size=65536
http = 0.0.0.0:8051
thunder-lock=True
sharedarea=1
sharedarea=7
@xrmx sorry, I make mistake and duplicate hanging code. I fix last snippet.
@Lispython which version of python is this?
python:2.7.8
@xrmx snippet 1 is correct usage of locks?
I added example project to github https://github.com/Lispython/uwsgi_sharedmemory_tests
How I can make safe increment for float value without memoryview usage?
After some tests, I found that method used pthread_rwlock_rdlock and pthread_rwlock_rdlock return 35 code.
Hi. I testing sharedarea on simple flask application. This code increment 4 byte integer on every request. I added sharedarea_wlock, because another process can modify memory between uwsgi.sharedarea_read32 call and uwsgi.sharedarea_write32 call. First request work correctly, but second request hang process at this line https://github.com/unbit/uwsgi/blob/master/core/lock.c#L204
Code:
I testing this code without locks, and get wrong results. 30 rps during 1 minute increase counter to 1787 (uwsgi processed 1800 requests). After I locks, process hang on
As I can understand, uwsgi lock functions can be used only with memoryview, because py_uwsgi_sharedarea_memoryview don't use uwsgi_wlock inside for sharedarea id?
This code works correclty.
upd: I changed last code block.