title: Hive - Thrift - Missing version in readMessageBegin, old client?
body: <p>Hello I'm trying to build a nodejs client for querying my hive database using thrift but I'm facing a strange issue ... I've generated my nodejs client API with thrift (<code>thrift -r --gen js:node TCLIService.thrift</code> with TCLIService being the thrift file defining the Hive services) and now I try to connect to Hive but my OpenSession is pending ... Maybe I'me not doing the right call but I don't find anything recent on the net (every thrift / node / hive project is 4 or 5 years old). Can you take a look and tell me if I'm doing it wrong ? Thanks </p>
  
  <p>TCLIService.thrift : </p>
  
  <pre><code>// OpenSession()
  //
  // Open a session (connection) on the server against
  // which operations may be executed.
  struct TOpenSessionReq {
      // The version of the HiveServer2 protocol that the client is using.
      1: required TProtocolVersion client_protocol = TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V8
  
      // Username and password for authentication.
      // Depending on the authentication scheme being used,
      // this information may instead be provided by a lower
      // protocol layer, in which case these fields may be
      // left unset.
      2: optional string username
      3: optional string password
  
      // Configuration overlay which is applied when the session is
      // first created.
      4: optional map&lt;string, string&gt; configuration
  }
  
  service TCLIService {
      TOpenSessionResp OpenSession(1:TOpenSessionReq req);
  }
  </code></pre>
  
  <p>Nodejs code : 
  
      var sessionHandle = '';</p>
  
  <pre><code>function openSession(config) {
      openSessReq = new ttypes.TOpenSessionReq();
      openSessReq.client_protocol = ttypes.TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V8;
      openSessReq.username = config.hiveUser;
      openSessReq.password = config.hivePassword;
      console.log("openSessReq = " + JSON.stringify(openSessReq));
      console.log("Before OpenSession : sessionHandle = " + sessionHandle);
      sessionHandle = client.OpenSession(openSessReq, function (err, result){
          console.log('handler fired ... ');
          if (err) {
              console.error("error : " + err);
          } else {
              console.log("result : " + result);
          }
      });
      console.log("After OpenSession : sessionHandle = " + sessionHandle);
  }
  
  connection.on('error', function(err) {
      /*Error detected, print the error*/
      console.error(err);
      /*Close the program with error code*/
      process.exit(1)
  });
  
  console.log('Error handler registered ...')
  
  connection.on('connect', function(){
      console.log('Connected ...');
      /*Init session*/
      console.log(client);
      openSession(config);
  }
  </code></pre>
  
  <p>My output is the following : </p>
  
  <pre><code>CreateConnection DONE ...
  Error handler registered ...
  Connect handler registered ...
  Connected ...
  { output:
     TBufferedTransport {
       defaultReadBufferSize: 1024,
       writeBufferSize: 512,
       inBuf: &lt;Buffer e8 19 2b 03 00 00 00 00 b0 1a 2b 03 00 00 00 00 e8 18 2b 03 00 00 00 00 f0 18 2b 03 00 00 00 00 b0 19 2b 03 00 00 00 00 78 1a 2b 03 00 00 00 00 70 1d ... &gt;,
       readCursor: 0,
       writeCursor: 0,
       outBuffers: [],
       outCount: 0,
       onFlush: [Function],
       client: [Circular] },
    pClass: [Function: TBinaryProtocol],
    _seqid: 0,
    _reqs: {} }
  openSessReq = {"client_protocol":7,"username":"root","password":"root","configuration":null}
  Before OpenSession : sessionHandle =
  After OpenSession : sessionHandle = undefined
  ^C
  </code></pre>
  
  <p>The script is running indefinitely ... If I change the port or shutdown HiveServer I'm facing an error so the connection is working but I can't find out why the openSession isn't ! Thanks for your help </p>
  
  <p>EDIT : 
  I've checked my logs and the NOSASL identification was the issue ... I've fixed (I think) this issue and now getting the following error :</p>
  
  <p>Client : </p>
  
  <pre><code>{ [Error: write EPIPE]
   code: 'EPIPE',
   errno: 'EPIPE',
   syscall: 'write',
   address: undefined }
  </code></pre>
  
  <p>Server : </p>
  
  <pre><code>2016-02-17 13:36:37,152 ERROR org.apache.thrift.server.TThreadPoolServer: [HiveServer2-Handler-Pool: Thread-24]: Thrift error occurred during processing of message.
      org.apache.thrift.protocol.TProtocolException: Missing version in readMessageBegin, old client?
          at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:228)
          at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:27)
          at org.apache.hive.service.auth.TSetIpAddressProcessor.process(TSetIpAddressProcessor.java:56)
          at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:285)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
          at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>I've read that the issue must be raised by using the wrong protocol layer ... I'm using TBinaryProtocol is it a problem ? </p>