Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uwsgi.send_message does not exist, though API documents it; myadmin script is broken #429

Closed
gthb opened this issue Oct 25, 2013 · 2 comments

Comments

@gthb
Copy link

gthb commented Oct 25, 2013

Based on http://uwsgi-docs.readthedocs.org/en/latest/ManagementFlag.html I just tried to do this:

uwsgi --no-server -w myadmin --pyargv "127.0.0.1:3157 15"

inside the tests directory of the git repo, checked out to the tip of the uwsgi-1.9.18 branch.

But it fails because there is no send_message function in the uwsgi module:

*** Starting uWSGI 1.9.18.3 (64bit) on [Fri Oct 25 16:40:23 2013] ***
compiled with version: 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79) on 25 October 2013 16:25:00
os: Darwin-13.0.0 Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64
nodename: toodee.local
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 8
current working directory: /Users/gthb/extsvn/uwsgi/tests
detected binary path: /Users/gthb/pyenv/DJANGO15/bin/uwsgi
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 709
your memory page size is 4096 bytes
detected max file descriptor number: 256
lock engine: OSX spinlocks
thunder lock: disabled (you can enable it with --thunder-lock)
Python version: 2.7.5 (default, Oct 24 2013, 03:39:03)  [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x7fa040500380
your mercy for graceful operations on workers is 60 seconds
*** Operational MODE: no-workers ***
['uwsgi', '127.0.0.1:3157', '15']
Traceback (most recent call last):
  File "./myadmin.py", line 9, in <module>
    chunks = uwsgi.send_message(sys.argv[1], 10, int(sys.argv[2]), '')
AttributeError: 'module' object has no attribute 'send_message'
unable to load app 0 (mountpoint='') (callable not found or import error)
no-server mode requested. Goodbye.```

But there should be, according to http://uwsgi-docs.readthedocs.org/en/latest/PythonModule.html

In uwsgi.h there is this declaration:

ssize_t uwsgi_send_message(int, uint8_t, uint8_t, char *, uint16_t, int, ssize_t, int);

... which is then not implemented anywhere.

I added a print statement to dump out sorted(dir(uwsgi)) module:

['SPOOL_IGNORE', 'SPOOL_OK', 'SPOOL_RETRY', '__doc__', '__name__',
'__package__', 'add_cron', 'add_file_monitor', 'add_rb_timer', 'add_timer',
'alarm', 'applications', 'async_connect', 'async_sleep', 'buffer_size',
'cache_clear', 'cache_dec', 'cache_del', 'cache_div', 'cache_exists',
'cache_get', 'cache_inc', 'cache_keys', 'cache_mul', 'cache_num', 'cache_set',
'cache_update', 'call', 'chunked_read', 'chunked_read_nb', 'cl', 'close',
'connect', 'connection_fd', 'cores', 'disconnect', 'embedded_data', 'extract',
'farm_get_msg', 'farm_msg', 'get_logvar', 'get_option', 'getoption',
'green_schedule', 'has_hook', 'has_threads', 'hostname', 'i_am_the_lord',
'i_am_the_spooler', 'in_farm', 'is_a_reload', 'is_connected', 'is_locked',
'listen_queue', 'lock', 'log', 'log_this_request', 'logsize', 'loop',
'lord_scroll', 'magic_table', 'masterpid', 'mem', 'mule_get_msg', 'mule_id',
'mule_msg', 'numproc', 'offload', 'opt', 'parsefile', 'ready', 'ready_fd',
'recv', 'recv_block', 'register_rpc', 'register_signal', 'reload',
'request_id', 'route', 'rpc', 'rpc_list', 'scrolls', 'send', 'sendfile',
'set_logvar', 'set_option', 'set_user_harakiri', 'set_warning_message',
'setoption', 'setprocname', 'signal', 'signal_received', 'signal_registered',
'signal_wait', 'sorry_i_need_to_block', 'start_response', 'started_on', 'stop',
'suspend', 'total_requests', 'unbit', 'unlock', 'version', 'version_info',
'wait_fd_read', 'wait_fd_write', 'websocket_handshake', 'websocket_recv',
'websocket_recv_nb', 'websocket_send', 'worker_id', 'workers']
@unbit
Copy link
Owner

unbit commented Oct 26, 2013

this has been removed in 1.9 while waiting for a better subsystem (no more based on number-as-key)

See issue #55

@unbit unbit closed this as completed Jan 8, 2014
@cipri-tom
Copy link

Hi,

There used to be set_option in the python module which, albeit complicated, could have had a light idea of setting some options outside of the config file. Now this function is gone. Is it for the same reason as above ?

I'm asking because I want to increase the number of locks on uWSGI. However, I think it would be a good idea to keep it to a minimum (please correct me if I'm wrong). So, in my python app I define which "kind" of locks I want, I assign an id to each, and then I use them. But the number of locks has to be correctly configured with uWSGI, and it could fall out of sync with the defined locks.

I was thinking of doing something like: uwsgi.set_option(locks=len(LockTypes)). Any advice?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants