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

sendProcessStdin() always raises INCORRECT_PARAMETERS on Python 3 #835

Closed
mnaberez opened this issue Oct 9, 2016 · 0 comments · Fixed by #1029
Closed

sendProcessStdin() always raises INCORRECT_PARAMETERS on Python 3 #835

mnaberez opened this issue Oct 9, 2016 · 0 comments · Fixed by #1029

Comments

@mnaberez
Copy link
Member

mnaberez commented Oct 9, 2016

Start supervisord in the foreground with a subprocess running:

$ python --version
Python 3.5.2

$ cat supervisord.conf
[supervisord]
loglevel = blather
nodaemon = true

[inet_http_server]
port = 127.0.0.1:9001

[supervisorctl]
serverurl = http://127.0.0.1:9001

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[program:cat]
command = /bin/cat

$ supervisord -c supervisord.conf

In another terminal, try the XML-RPC method sendProcessStdin:

$ python
Python 3.5.2 (default, Sep 10 2016, 08:21:44)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from xmlrpc.client import ServerProxy
>>> server = ServerProxy('http://127.0.0.1:9001/RPC2', verbose=True)
>>> server.supervisor.sendProcessStdin('cat', 'hello')
send: b'POST /RPC2 HTTP/1.1\r\nHost: 127.0.0.1:9001\r\nAccept-Encoding: gzip\r\nContent-Type: text/xml\r\nUser-Agent: Python-xmlrpc/3.5\r\nContent-Length: 229\r\n\r\n'
send: b"<?xml version='1.0'?>\n<methodCall>\n<methodName>supervisor.sendProcessStdin</methodName>\n<params>\n<param>\n<value><string>cat</string></value>\n</param>\n<param>\n<value><string>hello</string></value>\n</param>\n</params>\n</methodCall>\n"
reply: 'HTTP/1.1 200 OK\r\n'
header: Content-Type header: Content-Length header: Date header: Server body: b"<?xml version='1.0'?>\n<methodResponse>\n<fault>\n<value><struct>\n<member>\n<name>faultString</name>\n<value><string>INCORRECT_PARAMETERS</string></value>\n</member>\n<member>\n<name>faultCode</name>\n<value><int>2</int></value>\n</member>\n</struct></value>\n</fault>\n</methodResponse>\n"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.5/xmlrpc/client.py", line 1092, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python3.5/xmlrpc/client.py", line 1432, in __request
    verbose=self.__verbose
  File "/usr/lib/python3.5/xmlrpc/client.py", line 1134, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python3.5/xmlrpc/client.py", line 1150, in single_request
    return self.parse_response(resp)
  File "/usr/lib/python3.5/xmlrpc/client.py", line 1322, in parse_response
    return u.close()
  File "/usr/lib/python3.5/xmlrpc/client.py", line 655, in close
    raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault 2: 'INCORRECT_PARAMETERS'>

supervisord log output:

2016-10-09 10:09:10,394 TRAC 127.0.0.1:Medusa (V1.12) started at Sun Oct  9 10:09:10 2016
    Hostname: localhost
    Port:9001
2016-10-09 10:09:10,400 INFO RPC interface 'supervisor' initialized
2016-10-09 10:09:10,400 CRIT Server 'inet_http_server' running without any HTTP authentication checking
2016-10-09 10:09:10,401 INFO supervisord started with pid 10016
2016-10-09 10:09:11,404 INFO spawned: 'cat' with pid 10019
2016-10-09 10:09:12,408 INFO success: cat entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2016-10-09 10:09:13,773 BLAT read event caused by <supervisor.http.supervisor_af_inet_http_server listening 127.0.0.1:9001 at 0x7f8684bf2128>
2016-10-09 10:09:13,774 BLAT read event caused by <supervisor.http.deferring_http_channel connected 127.0.0.1:37458 at 0x7f8684baf198 channel#: 0 requests:0>
2016-10-09 10:09:13,775 TRAC XML-RPC method called: supervisor.sendProcessStdin()
2016-10-09 10:09:13,775 TRAC XML-RPC method supervisor.sendProcessStdin() returned fault: [2] INCORRECT_PARAMETERS
2016-10-09 10:09:13,775 TRAC 127.0.0.1:37458 - - [09/Oct/2016:17:09:13 -0800] "POST /RPC2 HTTP/1.1" 200 397
2016-10-09 10:09:13,776 BLAT write event caused by <supervisor.http.deferring_http_channel connected 127.0.0.1:37458 at 0x7f8684baf198 channel#: 0 requests:1>

Tested on e73d017. The INCORRECT_PARAMETERS fault comes from the traverse function in xmlrpc.py catching a TypeError. It is the same exception seen #663 (comment). Once that is fixed, we should try the above again to be sure sendProcessStdin is also fixed.

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

Successfully merging a pull request may close this issue.

1 participant