Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-4437

JS WebSocket client callbacks invoked twice on parallel requests

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.11.0
    • 0.12.0
    • JavaScript - Library
    • None

    Description

      When using a WebSocket Transport and doing two service calls immediately, without waiting for the first to return, e.g. like this:

      const t = new Thrift.TWebSocketTransport('ws://localhost:8338/hello');
      	const p = new Thrift.TJSONProtocol(t);
      	const client = new HelloSvcClient(p);
      
      	t.open();
      
      	client.test(function (res) {
      		console.log(1, res);
      	});
      	client.test(function (res) {
      		console.log(2, res);
      	});
      

      The callback to the first invocation is called twice, and the second never, i.e. console shows:

      1 "test result"
      1 "test result"
      

      instead of the expected

      1 "test result"
      2 "test result"
      

      I suspect this bug was introduced with the patch for https://issues.apache.org/jira/browse/THRIFT-4131 where for some reason the callback registered twice when set: https://github.com/apache/thrift/pull/1372/files

      Attachments

        Issue Links

          Activity

            People

              jking3 James E. King III
              bananer Philip Frank
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: