This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author boom0192
Recipients boom0192
Date 2021-02-26.14:31:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1614349902.25.0.128405443976.issue43329@roundup.psfhosted.org>
In-reply-to
Content
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)
History
Date User Action Args
2021-02-26 14:31:42boom0192setrecipients: + boom0192
2021-02-26 14:31:42boom0192setmessageid: <1614349902.25.0.128405443976.issue43329@roundup.psfhosted.org>
2021-02-26 14:31:42boom0192linkissue43329 messages
2021-02-26 14:31:42boom0192create