New submission from Michael L. Boom <mikeb...@mikeboom.com>:

The client doesn't reconnect automatically, or explicitly.  I just get 
BrokenPipeError over and over.


Manager:
    import multiprocessing.managers, os, sys, time
    class TestClass(object):
        def test_method(self):
            print("In test_method")
            return "TEST"

    class TestManager(multiprocessing.managers.BaseManager):
        pass

    address = ("127.0.0.1", 54321)
    TestManager.register("Test", TestClass)
    manager = TestManager(address = address, authkey = "1234".encode("utf-8"))
    manager.get_server().serve_forever()


Client:
    import multiprocessing.managers, os, sys, time

    class TestManager(multiprocessing.managers.BaseManager):
        pass

    address = ("127.0.0.1", 54321)
    TestManager.register("Test")
    manager = TestManager(address = address, authkey = "1234".encode("utf-8"))
    manager.connect()
    test_class = manager.Test()

    def call_it():
        time.sleep(1)
        result = test_class.test_method()
        print("result: '" + str(type(result)) + ", " + str(result) + "'")

    call_it()

    print("Kill and restart the server and press return")
    sys.stdin.readline()

    error = False
    while (True):
        try:
            if (error):
                print("Reconnecting")
                manager.connect()
                test_class = manager.Test()
            call_it()
            error = False
        except Exception as e:
            print("Got exception " + str(type(e)) + ", " + repr(e))
            error = True
        time.sleep(1)

----------
components: Library (Lib)
messages: 387726
nosy: boom0192
priority: normal
severity: normal
status: open
title: Multiprocessing Manager Client Not Reconnecting
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43329>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to