[GitHub] thrift issue #1361: THRIFT-4329: Implement multiplexed processor that matche...

2017-09-20 Thread gadLinux
Github user gadLinux commented on the issue:

https://github.com/apache/thrift/pull/1361
  
@jeking3 Can you merge this, please?


---


[jira] [Commented] (THRIFT-4329) c_glib Doesn't have a multiplexed processor

2017-09-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4329?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16172843#comment-16172843
 ] 

ASF GitHub Bot commented on THRIFT-4329:


Github user gadLinux commented on the issue:

https://github.com/apache/thrift/pull/1361
  
@jeking3 Can you merge this, please?


> c_glib Doesn't have a multiplexed processor
> ---
>
> Key: THRIFT-4329
> URL: https://issues.apache.org/jira/browse/THRIFT-4329
> Project: Thrift
>  Issue Type: Bug
>  Components: C glib - Library
>Affects Versions: 1.0
>Reporter: Gonzalo Aguilar
>Assignee: Gonzalo Aguilar
> Fix For: 1.0
>
>
> It seems that multiplexed protocol only implements 
> thrift_multiplexed_protocol_write_message_begin that's ok for sending 
> messages to a multiplexed server but not for the C server. We also need a 
> multiplexed processor for the server.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Updated] (THRIFT-4336) TThreadedServer mode maybe lock and can't work

2017-09-20 Thread xiaomingzhongguo (JIRA)

 [ 
https://issues.apache.org/jira/browse/THRIFT-4336?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

xiaomingzhongguo updated THRIFT-4336:
-
Priority: Blocker  (was: Critical)

> TThreadedServer  mode maybe lock and can't work
> ---
>
> Key: THRIFT-4336
> URL: https://issues.apache.org/jira/browse/THRIFT-4336
> Project: Thrift
>  Issue Type: Bug
>  Components: C++ - Library
>Affects Versions: 0.9.3
> Environment: Linux 2.6.32 
>Reporter: xiaomingzhongguo
>Priority: Blocker
>  Labels: performance
>
> Run in TThreadedServer mode 
> run some times,thrift accept thread  lock at onClientConnected and can't work 
> call stack like this:
> #0  0x7f9f0f82efbe in __lll_lock_wait_private () from 
> /lib64/libpthread.so.0
> #1  0x7f9f0f828c9a in _L_lock_1834 () from /lib64/libpthread.so.0
> #2  0x7f9f0f8278ef in pthread_create@@GLIBC_2.2.5 () from 
> /lib64/libpthread.so.0
> #3  0x00db139e in apache::thrift::concurrency::PthreadThread::start() 
> ()
> #4  0x00dae7f7 in 
> apache::thrift::server::TThreadedServer::onClientConnected(boost::shared_ptr
>  const&) ()
> #5  0x00db1eef in 
> apache::thrift::server::TServerFramework::newlyConnectedClient(boost::shared_ptr
>  const&) ()
> #6  0x00db27e9 in apache::thrift::server::TServerFramework::serve() ()
> #7  0x00daeb77 in apache::thrift::server::TThreadedServer::serve() ()
> #8  0x00a3bec9 in ServerComm::run() ()
> #9  0x00900a88 in gseThread::run_helper(void*) ()
> #10 0x0099318c in tos::util_thread_start(void*) ()
> #11 0x7f9f0f8287f1 in start_thread () from /lib64/libpthread.so.0
> #12 0x7f9f0ebe0ccd in clone () from /lib64/libc.so.6



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Updated] (THRIFT-4336) TThreadedServer mode maybe lock and can't work

2017-09-20 Thread xiaomingzhongguo (JIRA)

 [ 
https://issues.apache.org/jira/browse/THRIFT-4336?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

xiaomingzhongguo updated THRIFT-4336:
-
Priority: Critical  (was: Blocker)

> TThreadedServer  mode maybe lock and can't work
> ---
>
> Key: THRIFT-4336
> URL: https://issues.apache.org/jira/browse/THRIFT-4336
> Project: Thrift
>  Issue Type: Bug
>  Components: C++ - Library
>Affects Versions: 0.9.3
> Environment: Linux 2.6.32 
>Reporter: xiaomingzhongguo
>Priority: Critical
>  Labels: performance
>
> Run in TThreadedServer mode 
> run some times,thrift accept thread  lock at onClientConnected and can't work 
> call stack like this:
> #0  0x7f9f0f82efbe in __lll_lock_wait_private () from 
> /lib64/libpthread.so.0
> #1  0x7f9f0f828c9a in _L_lock_1834 () from /lib64/libpthread.so.0
> #2  0x7f9f0f8278ef in pthread_create@@GLIBC_2.2.5 () from 
> /lib64/libpthread.so.0
> #3  0x00db139e in apache::thrift::concurrency::PthreadThread::start() 
> ()
> #4  0x00dae7f7 in 
> apache::thrift::server::TThreadedServer::onClientConnected(boost::shared_ptr
>  const&) ()
> #5  0x00db1eef in 
> apache::thrift::server::TServerFramework::newlyConnectedClient(boost::shared_ptr
>  const&) ()
> #6  0x00db27e9 in apache::thrift::server::TServerFramework::serve() ()
> #7  0x00daeb77 in apache::thrift::server::TThreadedServer::serve() ()
> #8  0x00a3bec9 in ServerComm::run() ()
> #9  0x00900a88 in gseThread::run_helper(void*) ()
> #10 0x0099318c in tos::util_thread_start(void*) ()
> #11 0x7f9f0f8287f1 in start_thread () from /lib64/libpthread.so.0
> #12 0x7f9f0ebe0ccd in clone () from /lib64/libc.so.6



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4333) All tutorial examples with port 9090.

2017-09-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4333?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16174191#comment-16174191
 ] 

ASF GitHub Bot commented on THRIFT-4333:


Github user walter-weinmann closed the pull request at:

https://github.com/apache/thrift/pull/1364


> All tutorial examples with port 9090. 
> --
>
> Key: THRIFT-4333
> URL: https://issues.apache.org/jira/browse/THRIFT-4333
> Project: Thrift
>  Issue Type: Improvement
>  Components: Tutorial
>Affects Versions: 0.10.0
>Reporter: Walter Weinmann
>Priority: Minor
>  Labels: Erlang, Tutorial
>
> All examples in the tutorial should use the same port (9090) to make it 
> easier to test with a mix of languages. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[GitHub] thrift pull request #1365: THRIFT-4312 Erlang client cannot connect to Pytho...

2017-09-20 Thread walter-weinmann
Github user walter-weinmann closed the pull request at:

https://github.com/apache/thrift/pull/1365


---


[GitHub] thrift pull request #1364: THRIFT-4333 All tutorial examples with port 9090.

2017-09-20 Thread walter-weinmann
Github user walter-weinmann closed the pull request at:

https://github.com/apache/thrift/pull/1364


---


[GitHub] thrift issue #1365: THRIFT-4312 Erlang client cannot connect to Python serve...

2017-09-20 Thread walter-weinmann
Github user walter-weinmann commented on the issue:

https://github.com/apache/thrift/pull/1365
  
Restart integration tests.


---


[GitHub] thrift issue #1364: THRIFT-4333 All tutorial examples with port 9090.

2017-09-20 Thread walter-weinmann
Github user walter-weinmann commented on the issue:

https://github.com/apache/thrift/pull/1364
  
Restart integration tests.


---


[jira] [Commented] (THRIFT-4333) All tutorial examples with port 9090.

2017-09-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4333?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16174192#comment-16174192
 ] 

ASF GitHub Bot commented on THRIFT-4333:


GitHub user walter-weinmann reopened a pull request:

https://github.com/apache/thrift/pull/1364

THRIFT-4333 All tutorial examples with port 9090.



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/walter-weinmann/thrift THRIFT-4333

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/thrift/pull/1364.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1364


commit 579fba9062c207cb742262c36c421ce951dc
Author: walter-weinmann 
Date:   2017-09-18T18:18:50Z

THRIFT-4333 All tutorial examples with port 9090.




> All tutorial examples with port 9090. 
> --
>
> Key: THRIFT-4333
> URL: https://issues.apache.org/jira/browse/THRIFT-4333
> Project: Thrift
>  Issue Type: Improvement
>  Components: Tutorial
>Affects Versions: 0.10.0
>Reporter: Walter Weinmann
>Priority: Minor
>  Labels: Erlang, Tutorial
>
> All examples in the tutorial should use the same port (9090) to make it 
> easier to test with a mix of languages. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[GitHub] thrift pull request #1365: THRIFT-4312 Erlang client cannot connect to Pytho...

2017-09-20 Thread walter-weinmann
GitHub user walter-weinmann reopened a pull request:

https://github.com/apache/thrift/pull/1365

THRIFT-4312 Erlang client cannot connect to Python server: exception …

…error: econnrefused

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/walter-weinmann/thrift THRIFT-4312

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/thrift/pull/1365.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1365


commit 7f7a182cb466301bb6f98075e0d10b3d0b45b8e5
Author: walter-weinmann 
Date:   2017-09-18T18:32:10Z

THRIFT-4312 Erlang client cannot connect to Python server: exception error: 
econnrefused




---


[GitHub] thrift pull request #1364: THRIFT-4333 All tutorial examples with port 9090.

2017-09-20 Thread walter-weinmann
GitHub user walter-weinmann reopened a pull request:

https://github.com/apache/thrift/pull/1364

THRIFT-4333 All tutorial examples with port 9090.



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/walter-weinmann/thrift THRIFT-4333

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/thrift/pull/1364.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1364


commit 579fba9062c207cb742262c36c421ce951dc
Author: walter-weinmann 
Date:   2017-09-18T18:18:50Z

THRIFT-4333 All tutorial examples with port 9090.




---


[jira] [Commented] (THRIFT-4333) All tutorial examples with port 9090.

2017-09-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4333?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16174190#comment-16174190
 ] 

ASF GitHub Bot commented on THRIFT-4333:


Github user walter-weinmann commented on the issue:

https://github.com/apache/thrift/pull/1364
  
Restart integration tests.


> All tutorial examples with port 9090. 
> --
>
> Key: THRIFT-4333
> URL: https://issues.apache.org/jira/browse/THRIFT-4333
> Project: Thrift
>  Issue Type: Improvement
>  Components: Tutorial
>Affects Versions: 0.10.0
>Reporter: Walter Weinmann
>Priority: Minor
>  Labels: Erlang, Tutorial
>
> All examples in the tutorial should use the same port (9090) to make it 
> easier to test with a mix of languages. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4312) Erlang client cannot connect to Python server: exception error: econnrefused

2017-09-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16174194#comment-16174194
 ] 

ASF GitHub Bot commented on THRIFT-4312:


Github user walter-weinmann commented on the issue:

https://github.com/apache/thrift/pull/1365
  
Restart integration tests.


> Erlang client cannot connect to Python server: exception error: econnrefused
> 
>
> Key: THRIFT-4312
> URL: https://issues.apache.org/jira/browse/THRIFT-4312
> Project: Thrift
>  Issue Type: Bug
>  Components: Erlang - Library, Python - Library, Tutorial
>Affects Versions: 0.10.0
> Environment: Windows 10
> Erlang OTP 20
> Python 3.6.2
>Reporter: Walter Weinmann
>  Labels: Connection, Erlang, Python, Tutorial
>
> h3. Connecting the Erlang client with the Python server gives connection 
> error:
> h3. 
> h4. Erlang client:
> h4. 
> h4. 
> -- the examples are taken from the Apache Thrift tutorials ---
> {quote}-module(client).
> -include("calculator_thrift.hrl").
> -export([t/0]).
> p(X) ->
> io:format("~p~n", [X]),
> ok.
> t() ->
> Port = 9090,
> {ok, Client0} = thrift_client_util:new("localhost",
>Port,
>calculator_thrift,
>[]),
> {Client1, {ok, ok}} = thrift_client:call(Client0, ping, []),
> io:format("ping~n", []),
> {Client2, {ok, Sum}} = thrift_client:call(Client1, add,  [1, 1]),
> io:format("1+1=~p~n", [Sum]),
> {Client3, {ok, Sum1}} = thrift_client:call(Client2, add, [1, 4]),
> io:format("1+4=~p~n", [Sum1]),
> Work = #'Work'{op=?TUTORIAL_OPERATION_SUBTRACT,
>  num1=15,
>  num2=10},
> {Client4, {ok, Diff}} = thrift_client:call(Client3, calculate, [1, Work]),
> io:format("15-10=~p~n", [Diff]),
> {Client5, {ok, Log}} = thrift_client:call(Client4, getStruct, [1]),
> io:format("Log: ~p~n", [Log]),
> Client6 =
> try
> Work1 = #'Work'{op=?TUTORIAL_OPERATION_DIVIDE,
>   num1=1,
>   num2=0},
> {ClientS1, {ok, _Quot}} = thrift_client:call(Client5, calculate, 
> [2, Work1]),
> io:format("LAME: exception handling is broken~n", []),
> ClientS1
> catch
> throw:{ClientS2, Z} ->
> io:format("Got exception where expecting - the " ++
>   "following is NOT a problem!!!~n"),
> p(Z),
> ClientS2
> end,
> {Client7, {ok, ok}} = thrift_client:call(Client6, zip, []),
> io:format("zip~n", []),
> {_Client8, ok} = thrift_client:close(Client7),
> ok.
> {quote}
> h4. Python server:
> h4. 
> {quote}#!/usr/bin/env python
> from tutorial import Calculator
> from tutorial.ttypes import InvalidOperation, Operation
> from shared.ttypes import SharedStruct
> from thrift.transport import TSocket
> from thrift.transport import TTransport
> from thrift.protocol import TBinaryProtocol
> from thrift.server import TServer
> class CalculatorHandler:
> def __init__(self):
> self.log = {}
> def ping(self):
> print('ping()')
> def add(self, n1, n2):
> print('add(%d,%d)' % (n1, n2))
> return n1 + n2
> def calculate(self, logid, work):
> print('calculate(%d, %r)' % (logid, work))
> if work.op == Operation.ADD:
> val = work.num1 + work.num2
> elif work.op == Operation.SUBTRACT:
> val = work.num1 - work.num2
> elif work.op == Operation.MULTIPLY:
> val = work.num1 * work.num2
> elif work.op == Operation.DIVIDE:
> if work.num2 == 0:
> x = InvalidOperation()
> x.whatOp = work.op
> x.why = 'Cannot divide by 0'
> raise x
> val = work.num1 / work.num2
> else:
> x = InvalidOperation()
> x.whatOp = work.op
> x.why = 'Invalid operation'
> raise x
> log = SharedStruct()
> log.key = logid
> log.value = '%d' % (val)
> self.log[logid] = log
> return val
> def getStruct(self, key):
> print('getStruct(%d)' % (key))
> return self.log[key]
> def zip(self):
> print('zip()')
> if __name__ == '__main__':
> handler = CalculatorHandler()
> processor = Calculator.Processor(handler)
> transport = TSocket.TServerSocket(port=9090)
> tfactory = TTransport.TBufferedTransportFactory()
> pfactory = TBinaryProtocol.TBinaryProtocolFactory()
> server = TServer.TSimpleServer(processor, transport, tfactory, pfactory)
> # You co

[jira] [Commented] (THRIFT-4312) Erlang client cannot connect to Python server: exception error: econnrefused

2017-09-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16174196#comment-16174196
 ] 

ASF GitHub Bot commented on THRIFT-4312:


GitHub user walter-weinmann reopened a pull request:

https://github.com/apache/thrift/pull/1365

THRIFT-4312 Erlang client cannot connect to Python server: exception …

…error: econnrefused

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/walter-weinmann/thrift THRIFT-4312

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/thrift/pull/1365.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1365


commit 7f7a182cb466301bb6f98075e0d10b3d0b45b8e5
Author: walter-weinmann 
Date:   2017-09-18T18:32:10Z

THRIFT-4312 Erlang client cannot connect to Python server: exception error: 
econnrefused




> Erlang client cannot connect to Python server: exception error: econnrefused
> 
>
> Key: THRIFT-4312
> URL: https://issues.apache.org/jira/browse/THRIFT-4312
> Project: Thrift
>  Issue Type: Bug
>  Components: Erlang - Library, Python - Library, Tutorial
>Affects Versions: 0.10.0
> Environment: Windows 10
> Erlang OTP 20
> Python 3.6.2
>Reporter: Walter Weinmann
>  Labels: Connection, Erlang, Python, Tutorial
>
> h3. Connecting the Erlang client with the Python server gives connection 
> error:
> h3. 
> h4. Erlang client:
> h4. 
> h4. 
> -- the examples are taken from the Apache Thrift tutorials ---
> {quote}-module(client).
> -include("calculator_thrift.hrl").
> -export([t/0]).
> p(X) ->
> io:format("~p~n", [X]),
> ok.
> t() ->
> Port = 9090,
> {ok, Client0} = thrift_client_util:new("localhost",
>Port,
>calculator_thrift,
>[]),
> {Client1, {ok, ok}} = thrift_client:call(Client0, ping, []),
> io:format("ping~n", []),
> {Client2, {ok, Sum}} = thrift_client:call(Client1, add,  [1, 1]),
> io:format("1+1=~p~n", [Sum]),
> {Client3, {ok, Sum1}} = thrift_client:call(Client2, add, [1, 4]),
> io:format("1+4=~p~n", [Sum1]),
> Work = #'Work'{op=?TUTORIAL_OPERATION_SUBTRACT,
>  num1=15,
>  num2=10},
> {Client4, {ok, Diff}} = thrift_client:call(Client3, calculate, [1, Work]),
> io:format("15-10=~p~n", [Diff]),
> {Client5, {ok, Log}} = thrift_client:call(Client4, getStruct, [1]),
> io:format("Log: ~p~n", [Log]),
> Client6 =
> try
> Work1 = #'Work'{op=?TUTORIAL_OPERATION_DIVIDE,
>   num1=1,
>   num2=0},
> {ClientS1, {ok, _Quot}} = thrift_client:call(Client5, calculate, 
> [2, Work1]),
> io:format("LAME: exception handling is broken~n", []),
> ClientS1
> catch
> throw:{ClientS2, Z} ->
> io:format("Got exception where expecting - the " ++
>   "following is NOT a problem!!!~n"),
> p(Z),
> ClientS2
> end,
> {Client7, {ok, ok}} = thrift_client:call(Client6, zip, []),
> io:format("zip~n", []),
> {_Client8, ok} = thrift_client:close(Client7),
> ok.
> {quote}
> h4. Python server:
> h4. 
> {quote}#!/usr/bin/env python
> from tutorial import Calculator
> from tutorial.ttypes import InvalidOperation, Operation
> from shared.ttypes import SharedStruct
> from thrift.transport import TSocket
> from thrift.transport import TTransport
> from thrift.protocol import TBinaryProtocol
> from thrift.server import TServer
> class CalculatorHandler:
> def __init__(self):
> self.log = {}
> def ping(self):
> print('ping()')
> def add(self, n1, n2):
> print('add(%d,%d)' % (n1, n2))
> return n1 + n2
> def calculate(self, logid, work):
> print('calculate(%d, %r)' % (logid, work))
> if work.op == Operation.ADD:
> val = work.num1 + work.num2
> elif work.op == Operation.SUBTRACT:
> val = work.num1 - work.num2
> elif work.op == Operation.MULTIPLY:
> val = work.num1 * work.num2
> elif work.op == Operation.DIVIDE:
> if work.num2 == 0:
> x = InvalidOperation()
> x.whatOp = work.op
> x.why = 'Cannot divide by 0'
> raise x
> val = work.num1 / work.num2
> else:
> x = InvalidOperation()
> x.whatOp = work.op
> x.why = 'Invalid operatio

[jira] [Commented] (THRIFT-4312) Erlang client cannot connect to Python server: exception error: econnrefused

2017-09-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16174195#comment-16174195
 ] 

ASF GitHub Bot commented on THRIFT-4312:


Github user walter-weinmann closed the pull request at:

https://github.com/apache/thrift/pull/1365


> Erlang client cannot connect to Python server: exception error: econnrefused
> 
>
> Key: THRIFT-4312
> URL: https://issues.apache.org/jira/browse/THRIFT-4312
> Project: Thrift
>  Issue Type: Bug
>  Components: Erlang - Library, Python - Library, Tutorial
>Affects Versions: 0.10.0
> Environment: Windows 10
> Erlang OTP 20
> Python 3.6.2
>Reporter: Walter Weinmann
>  Labels: Connection, Erlang, Python, Tutorial
>
> h3. Connecting the Erlang client with the Python server gives connection 
> error:
> h3. 
> h4. Erlang client:
> h4. 
> h4. 
> -- the examples are taken from the Apache Thrift tutorials ---
> {quote}-module(client).
> -include("calculator_thrift.hrl").
> -export([t/0]).
> p(X) ->
> io:format("~p~n", [X]),
> ok.
> t() ->
> Port = 9090,
> {ok, Client0} = thrift_client_util:new("localhost",
>Port,
>calculator_thrift,
>[]),
> {Client1, {ok, ok}} = thrift_client:call(Client0, ping, []),
> io:format("ping~n", []),
> {Client2, {ok, Sum}} = thrift_client:call(Client1, add,  [1, 1]),
> io:format("1+1=~p~n", [Sum]),
> {Client3, {ok, Sum1}} = thrift_client:call(Client2, add, [1, 4]),
> io:format("1+4=~p~n", [Sum1]),
> Work = #'Work'{op=?TUTORIAL_OPERATION_SUBTRACT,
>  num1=15,
>  num2=10},
> {Client4, {ok, Diff}} = thrift_client:call(Client3, calculate, [1, Work]),
> io:format("15-10=~p~n", [Diff]),
> {Client5, {ok, Log}} = thrift_client:call(Client4, getStruct, [1]),
> io:format("Log: ~p~n", [Log]),
> Client6 =
> try
> Work1 = #'Work'{op=?TUTORIAL_OPERATION_DIVIDE,
>   num1=1,
>   num2=0},
> {ClientS1, {ok, _Quot}} = thrift_client:call(Client5, calculate, 
> [2, Work1]),
> io:format("LAME: exception handling is broken~n", []),
> ClientS1
> catch
> throw:{ClientS2, Z} ->
> io:format("Got exception where expecting - the " ++
>   "following is NOT a problem!!!~n"),
> p(Z),
> ClientS2
> end,
> {Client7, {ok, ok}} = thrift_client:call(Client6, zip, []),
> io:format("zip~n", []),
> {_Client8, ok} = thrift_client:close(Client7),
> ok.
> {quote}
> h4. Python server:
> h4. 
> {quote}#!/usr/bin/env python
> from tutorial import Calculator
> from tutorial.ttypes import InvalidOperation, Operation
> from shared.ttypes import SharedStruct
> from thrift.transport import TSocket
> from thrift.transport import TTransport
> from thrift.protocol import TBinaryProtocol
> from thrift.server import TServer
> class CalculatorHandler:
> def __init__(self):
> self.log = {}
> def ping(self):
> print('ping()')
> def add(self, n1, n2):
> print('add(%d,%d)' % (n1, n2))
> return n1 + n2
> def calculate(self, logid, work):
> print('calculate(%d, %r)' % (logid, work))
> if work.op == Operation.ADD:
> val = work.num1 + work.num2
> elif work.op == Operation.SUBTRACT:
> val = work.num1 - work.num2
> elif work.op == Operation.MULTIPLY:
> val = work.num1 * work.num2
> elif work.op == Operation.DIVIDE:
> if work.num2 == 0:
> x = InvalidOperation()
> x.whatOp = work.op
> x.why = 'Cannot divide by 0'
> raise x
> val = work.num1 / work.num2
> else:
> x = InvalidOperation()
> x.whatOp = work.op
> x.why = 'Invalid operation'
> raise x
> log = SharedStruct()
> log.key = logid
> log.value = '%d' % (val)
> self.log[logid] = log
> return val
> def getStruct(self, key):
> print('getStruct(%d)' % (key))
> return self.log[key]
> def zip(self):
> print('zip()')
> if __name__ == '__main__':
> handler = CalculatorHandler()
> processor = Calculator.Processor(handler)
> transport = TSocket.TServerSocket(port=9090)
> tfactory = TTransport.TBufferedTransportFactory()
> pfactory = TBinaryProtocol.TBinaryProtocolFactory()
> server = TServer.TSimpleServer(processor, transport, tfactory, pfactory)
> # You could do one of these for a mult

[jira] [Commented] (THRIFT-4312) Erlang client cannot connect to Python server: exception error: econnrefused

2017-09-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16174259#comment-16174259
 ] 

ASF GitHub Bot commented on THRIFT-4312:


Github user jeking3 commented on the issue:

https://github.com/apache/thrift/pull/1365
  
walter, please wait for THRIFT-4064 to clear.  I understand it's 
frustrating but when you submit jobs you know are going to fail it delays 
getting the build fixed.


> Erlang client cannot connect to Python server: exception error: econnrefused
> 
>
> Key: THRIFT-4312
> URL: https://issues.apache.org/jira/browse/THRIFT-4312
> Project: Thrift
>  Issue Type: Bug
>  Components: Erlang - Library, Python - Library, Tutorial
>Affects Versions: 0.10.0
> Environment: Windows 10
> Erlang OTP 20
> Python 3.6.2
>Reporter: Walter Weinmann
>  Labels: Connection, Erlang, Python, Tutorial
>
> h3. Connecting the Erlang client with the Python server gives connection 
> error:
> h3. 
> h4. Erlang client:
> h4. 
> h4. 
> -- the examples are taken from the Apache Thrift tutorials ---
> {quote}-module(client).
> -include("calculator_thrift.hrl").
> -export([t/0]).
> p(X) ->
> io:format("~p~n", [X]),
> ok.
> t() ->
> Port = 9090,
> {ok, Client0} = thrift_client_util:new("localhost",
>Port,
>calculator_thrift,
>[]),
> {Client1, {ok, ok}} = thrift_client:call(Client0, ping, []),
> io:format("ping~n", []),
> {Client2, {ok, Sum}} = thrift_client:call(Client1, add,  [1, 1]),
> io:format("1+1=~p~n", [Sum]),
> {Client3, {ok, Sum1}} = thrift_client:call(Client2, add, [1, 4]),
> io:format("1+4=~p~n", [Sum1]),
> Work = #'Work'{op=?TUTORIAL_OPERATION_SUBTRACT,
>  num1=15,
>  num2=10},
> {Client4, {ok, Diff}} = thrift_client:call(Client3, calculate, [1, Work]),
> io:format("15-10=~p~n", [Diff]),
> {Client5, {ok, Log}} = thrift_client:call(Client4, getStruct, [1]),
> io:format("Log: ~p~n", [Log]),
> Client6 =
> try
> Work1 = #'Work'{op=?TUTORIAL_OPERATION_DIVIDE,
>   num1=1,
>   num2=0},
> {ClientS1, {ok, _Quot}} = thrift_client:call(Client5, calculate, 
> [2, Work1]),
> io:format("LAME: exception handling is broken~n", []),
> ClientS1
> catch
> throw:{ClientS2, Z} ->
> io:format("Got exception where expecting - the " ++
>   "following is NOT a problem!!!~n"),
> p(Z),
> ClientS2
> end,
> {Client7, {ok, ok}} = thrift_client:call(Client6, zip, []),
> io:format("zip~n", []),
> {_Client8, ok} = thrift_client:close(Client7),
> ok.
> {quote}
> h4. Python server:
> h4. 
> {quote}#!/usr/bin/env python
> from tutorial import Calculator
> from tutorial.ttypes import InvalidOperation, Operation
> from shared.ttypes import SharedStruct
> from thrift.transport import TSocket
> from thrift.transport import TTransport
> from thrift.protocol import TBinaryProtocol
> from thrift.server import TServer
> class CalculatorHandler:
> def __init__(self):
> self.log = {}
> def ping(self):
> print('ping()')
> def add(self, n1, n2):
> print('add(%d,%d)' % (n1, n2))
> return n1 + n2
> def calculate(self, logid, work):
> print('calculate(%d, %r)' % (logid, work))
> if work.op == Operation.ADD:
> val = work.num1 + work.num2
> elif work.op == Operation.SUBTRACT:
> val = work.num1 - work.num2
> elif work.op == Operation.MULTIPLY:
> val = work.num1 * work.num2
> elif work.op == Operation.DIVIDE:
> if work.num2 == 0:
> x = InvalidOperation()
> x.whatOp = work.op
> x.why = 'Cannot divide by 0'
> raise x
> val = work.num1 / work.num2
> else:
> x = InvalidOperation()
> x.whatOp = work.op
> x.why = 'Invalid operation'
> raise x
> log = SharedStruct()
> log.key = logid
> log.value = '%d' % (val)
> self.log[logid] = log
> return val
> def getStruct(self, key):
> print('getStruct(%d)' % (key))
> return self.log[key]
> def zip(self):
> print('zip()')
> if __name__ == '__main__':
> handler = CalculatorHandler()
> processor = Calculator.Processor(handler)
> transport = TSocket.TServerSocket(port=9090)
> tfactory = TTransport.TBufferedTransportFactory()
> pfactory = TBi

[GitHub] thrift issue #1365: THRIFT-4312 Erlang client cannot connect to Python serve...

2017-09-20 Thread jeking3
Github user jeking3 commented on the issue:

https://github.com/apache/thrift/pull/1365
  
walter, please wait for THRIFT-4064 to clear.  I understand it's 
frustrating but when you submit jobs you know are going to fail it delays 
getting the build fixed.


---