HIRANO Satoshi created THRIFT-3328:
--------------------------------------

             Summary: A callback is not called when a server is down.
                 Key: THRIFT-3328
                 URL: https://issues.apache.org/jira/browse/THRIFT-3328
             Project: Thrift
          Issue Type: Bug
          Components: JavaScript - Library
            Reporter: HIRANO Satoshi


When an async method is called in a JS client for a server which is down, the 
call should call a supplied callback. 

Actually the async call fails with the following error and the callback not 
called.

OPTIONS http://xxxx net::ERR_CONNECTION_REFUSED

Note that the above OPTIONS is because I use HTTP OPTIONS. Don't mind.

Thrift.TXHRTransport.flush() has the following fragment.

        if (callback) {
            //Ignore XHR callbacks until the data arrives, then call the
            //  client's callback
            xreq.onreadystatechange = 
              (function() {
                var clientCallback = callback;    
                return function() {
                  if (this.readyState == 4 && this.status == 200) {
                    self.setRecvBuffer(this.responseText);
                    clientCallback();
                  }
                };
              }());
        }

I think the reason why the callback is not called is that "this.status == 200" 
ignores fatal statuses and skips clientCallback().




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to