On 07/07/2012 7:33, Roberto De Ioris wrote:
I have enabled POSIX semaphores on my uwsgi-1.2.3 installation on my NetBSD-5.1 server.According to the man page, setting pshared to 1 should cause an errorbut it does not.Looking through the sem_init code, the pshared value is just discardedand never used.So my question is this - how can I test to see if the locking in uwsgiactually works on NetBSD like so as it seems to work fine for me. But my website is quite lightweight.Looks like pshared in NetBSD is not supported but if you want to check ityou can use that (start uWSGI with two processes) def application(e, s): uwsgi.lock() print "i am worker %d" % uwsgi.worker_id() time.sleep(100) uwsgi.unlock()send two requests to the app and check logs. If it works you only need tosee on "i am worker..." line, otherwise you will get two.
How exactly do I do that test? It looks like python, so I created a file /tmp/test and the above verbatim.
I then started it like so: uwsgi-2.5 --http :9090 --wsgi-file /tmp/test And a call to 127.0.0.1:9090 produces this: *** Operational MODE: single process ***WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x7f7ffc61d1c0 pid: 3244 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 3244, cores: 1)
Traceback (most recent call last):
File "/tmp/test", line 2, in application
uwsgi.lock()
NameError: global name 'uwsgi' is not defined
[pid: 3244|app: 0|req: 1/1] 127.0.0.1 () {28 vars in 323 bytes} [Tue
Jul 10 09:49:28 2012] GET / => generated 0 bytes in
0 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)I'm not much of a python or uwsgi guru so any pointers on how to make the test work would be appreciated :)
Thanks Roy _______________________________________________ uWSGI mailing list [email protected] http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
