You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Kengo Seki (Jira)" <ji...@apache.org> on 2019/10/04 14:49:00 UTC

[jira] [Created] (THRIFT-4967) Node.js tutorial server fails if the zip function invoked

Kengo Seki created THRIFT-4967:
----------------------------------

             Summary: Node.js tutorial server fails if the zip function invoked
                 Key: THRIFT-4967
                 URL: https://issues.apache.org/jira/browse/THRIFT-4967
             Project: Thrift
          Issue Type: Bug
          Components: Tutorial
            Reporter: Kengo Seki


I tried the Node.js tutorial server with the Ruby client, but the server failed as follows:

{code:title=console #1}
thrift/tutorial/nodejs$ make tutorialserver
NODE_PATH="../../lib/nodejs:../../lib/nodejs/lib:" /usr/bin/nodejs NodeServer.js
{code}

{code:title=console #2}
thrift/tutorial/rb$ make tutorialclient
/home/sekikn/repos/thrift/compiler/cpp/thrift --gen rb -r ../../tutorial/tutorial.thrift
/home/sekikn/.rbenv/shims/ruby RubyClient.rb
Unable to load thrift_native extension. Defaulting to pure Ruby libraries.
ping()
/home/sekikn/repos/thrift/lib/rb/lib/thrift/protocol/base_protocol.rb:256: warning: constant ::Fixnum is deprecated
/home/sekikn/repos/thrift/lib/rb/lib/thrift/protocol/base_protocol.rb:296: warning: constant ::Fixnum is deprecated
1+1=2
1+4=5
15-10=5
Log: 5
InvalidOperation: Cannot divide by 0
zip
{code}

{code:title=console #1}
ping()
add( 1 , 1 )
add( 1 , 4 )
calculate( 1 , { num1: 15, num2: 10, op: 2, comment: null } )
getStruct( 1 )
calculate( 1 , { num1: 1, num2: 0, op: 4, comment: null } )
zip()
events.js:183
      throw er; // Unhandled 'error' event
      ^

ReferenceError: result is not defined
    at Object.zip (/home/sekikn/repos/thrift/tutorial/nodejs/NodeServer.js:80:5)
    at exports.Processor.CalculatorProcessor.process_zip (/home/sekikn/repos/thrift/tutorial/nodejs/gen-nodejs/Calculator.js:731:17)
    at exports.Processor.CalculatorProcessor.process (/home/sekikn/repos/thrift/tutorial/nodejs/gen-nodejs/Calculator.js:599:39)
    at /home/sekikn/repos/thrift/lib/nodejs/lib/thrift/server.js:67:21
    at Socket.<anonymous> (/home/sekikn/repos/thrift/lib/nodejs/lib/thrift/buffered_transport.js:59:5)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at Socket.Readable.push (_stream_readable.js:208:10)
Makefile:639: recipe for target 'tutorialserver' failed
make: *** [tutorialserver] Error 1
{code}

{{result}} is undefined here, because {{zip}} is a one-way function and {{result}} is not passed to it.

{code:title=thrift/tutorial/nodejs/NodeServer.js}
 78   zip: function() {
 79     console.log("zip()");
 80     result(null);
 81   }
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)