[issue14134] xmlrpc.client.ServerProxy needs timeout parameter

Andrej A Antonov report at bugs.python.org
Tue Dec 16 10:56:55 CET 2014


Andrej A Antonov added the comment:

@demian.brecht , for high probably to catch *infinite_freeze* (at GNU/Linux) -- if we may will run requests of "xmlrpc.client.ServerProxy" -- parallely:


(when running next code -- need to make some network-disconnections on "network-router-computer")



    #!/usr/bin/env python3

    import threading
    from xmlrpc.client import ServerProxy

    ITERATION_COUNT = 100
    THREAD_COUNT = 100

    def thread_func(thread_name):
        for i in range(ITERATION_COUNT):
            try:
                server = ServerProxy("http://betty.userland.com")
                rpc_result = server.examples.getStateName(41)
                print('{}/iter_{} {!r}'.format(thread_name, i, rpc_result))
            except Exception as e:
                print('{}/iter_{} error: {} {}'.format(thread_name, i, type(e), str(e)))

    def main():
        print('***** testing begin *****')
        
        thread_list = []
        
        for i in range(THREAD_COUNT):
            thread_name = 'thread_{}'.format(i)
            thread_list.append(threading.Thread(target=thread_func, args=(thread_name,)))
        
        for thr in thread_list:
            thr.start()
        
        for thr in thread_list:
            thr.join()
        
        print('***** testing end *****')

    if __name__ == '__main__':
        main()

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14134>
_______________________________________


More information about the Python-bugs-list mailing list