Skip to content

The client hangs after multiple calls #4

@sztomi

Description

@sztomi

I tried a server implementations like this:

import msgpackrpc

class TestServer(object):
    def Add(self, a, b):
        print("Add({}, {}) called".format(a, b))
        return a + b

    def Mul(self, a, b):
        print("Mul({}, {}) called".format(a, b))
        return a * b

server = msgpackrpc.Server(TestServer())
server.listen(msgpackrpc.Address("localhost", 8070))
server.start()

The client looked like this:

    public partial class Form1 : Form
    {
        private RpcClientConfiguration _clientConfig = new RpcClientConfiguration();
        private dynamic _rpcProxy;

        public Form1()
        {
            InitializeComponent();
            _rpcProxy = new DynamicRpcProxy(new DnsEndPoint("127.0.0.1", 8070), _clientConfig);
        }

        ~Form1()
        {
            _rpcProxy.Dispose();
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < 50; ++i)
            {
                var result = (int) _rpcProxy.Add(Convert.ToInt32(i), Convert.ToInt32(tbB.Text));
                lblResult.Text = String.Format("Result: {0}", result);
                Thread.Sleep(100);
            }
        }

        private void btnMul_Click(object sender, EventArgs e)
        {
            var result = (float)_rpcProxy.Mul(Convert.ToSingle(tbA.Text), Convert.ToSingle(tbB.Text));
            lblResult.Text = String.Format("Result: {0}", result);
        }
    }

(I also tried a C++ server implementation but I'll omit that for brevity; I had the same results with it.)

What happens is after the 10th or so call the application hangs. It always hangs on this line: https://github.com/yfakariya/msgpack-rpc-cli/blob/master/src/MsgPack.Rpc.Client/Rpc/Client/AsyncResult.cs#L224

I does not matter how much I wait between the calls, it can even be as long as two seconds per call.
Am I doing something wrong with the client or is this a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions