[jira] [Resolved] (THRIFT-3445) Throwable messages are hidden from JVM stack trace output

2015-12-04 Thread Derek Dagit (JIRA)

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

Derek Dagit resolved THRIFT-3445.
-
Resolution: Invalid

I am resolving this issue as invalid.

It appears this is a special case for Java that appears to be inconsistent with 
the goals of Thrift, and instead what would be better is to use camel case for 
Java code, and ensure each exception structure has a message field.

> Throwable messages are hidden from JVM stack trace output
> -
>
> Key: THRIFT-3445
> URL: https://issues.apache.org/jira/browse/THRIFT-3445
> Project: Thrift
>  Issue Type: Bug
>Reporter: Derek Dagit
>
> As a user, I expect messages given when constructing Throwables to be 
> accessible via Throwable#getMessage, so that they are logged in stack trace 
> output for debugging.



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


[jira] [Updated] (THRIFT-3370) errno extern variable redefined. Not compiling for Android

2015-12-04 Thread Jens Geyer (JIRA)

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

Jens Geyer updated THRIFT-3370:
---
Assignee: Gonzalo Aguilar

> errno extern variable redefined. Not compiling for Android
> --
>
> Key: THRIFT-3370
> URL: https://issues.apache.org/jira/browse/THRIFT-3370
> Project: Thrift
>  Issue Type: Bug
>  Components: C glib - Library
>Affects Versions: 0.9.3
>Reporter: Gonzalo Aguilar
>Assignee: Gonzalo Aguilar
>  Labels: build, c, easyfix
> Fix For: 1.0
>
>
> It seems that the definition of errno we are using on the c_glib transport is 
> not 100% correct. While it's ok for ISO C99 compilers it fails under Android. 
> My opinion is that Android is behaving incorrectly here but I cannot be sure 
> until I check with you. 
> In the thrift_socket.c an thrift_server_socket.c implementations there's a 
> errno variable declared.
> /* for errors coming from socket() and connect() */
> extern int errno;
> This variable is redefined in the ndk of the in the file 
> arch-arm/usr/include/errno.h 
> I don't know why. 
> /* a macro expanding to the errno l-value */
> #define  errno   (*__errno())
> So the compilation fails because redefined. 
> Commenting out the extern definition on these files it compiles, it was 
> tested and it works. But I don't know how this can work since the definition 
> of errno on the files change from int to pointer. 
> Can someone comment this please?



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


[jira] [Updated] (THRIFT-3318) PHP: SimpleJSONProtocol Implementation

2015-12-04 Thread Jens Geyer (JIRA)

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

Jens Geyer updated THRIFT-3318:
---
Assignee: Atsushi Takayama

> PHP: SimpleJSONProtocol Implementation
> --
>
> Key: THRIFT-3318
> URL: https://issues.apache.org/jira/browse/THRIFT-3318
> Project: Thrift
>  Issue Type: New Feature
>  Components: PHP - Library
>Reporter: Atsushi Takayama
>Assignee: Atsushi Takayama
>Priority: Minor
> Fix For: 1.0
>
>
> https://github.com/apache/thrift/pull/602
> I've implemented a SimpleJSON writer for PHP.
> I made it similar to TJSONProtocol.php and TSimpleJSONProtocol.java so it 
> should comply with the coding standard.



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


[jira] [Updated] (THRIFT-2110) Erlang: Support for Multiplexing Services on any Transport, Protocol and Server

2015-12-04 Thread Jens Geyer (JIRA)

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

Jens Geyer updated THRIFT-2110:
---
Assignee: David Robakowski

> Erlang: Support for Multiplexing Services on any Transport, Protocol and 
> Server
> ---
>
> Key: THRIFT-2110
> URL: https://issues.apache.org/jira/browse/THRIFT-2110
> Project: Thrift
>  Issue Type: Sub-task
>  Components: Erlang - Library
>Reporter: David Robakowski
>Assignee: David Robakowski
>  Labels: multiplexing
> Fix For: 1.0
>
> Attachments: thrift-2110_erlang-multiplexing-with-eunit.patch
>
>
> See [THRIFT-563|https://issues.apache.org/jira/browse/THRIFT-563] for Details.



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


[jira] [Commented] (THRIFT-3471) Dart generator does not handle uppercase argument names

2015-12-04 Thread Hudson (JIRA)

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

Hudson commented on THRIFT-3471:


SUCCESS: Integrated in Thrift #1756 (See 
[https://builds.apache.org/job/Thrift/1756/])
THRIFT-3471 Dart generator does not handle uppercase argument names (jensg: 
rev f08771ccead48b2eafa38930eb90f74f99e1c4af)
* compiler/cpp/src/generate/t_dart_generator.cc


> Dart generator does not handle uppercase argument names
> ---
>
> Key: THRIFT-3471
> URL: https://issues.apache.org/jira/browse/THRIFT-3471
> Project: Thrift
>  Issue Type: Bug
>  Components: Dart - Compiler
>Reporter: Mark Erickson
>Assignee: Mark Erickson
> Fix For: 1.0
>
>
> PROBLEM
> The dart generator produces inconsistent code for argument names that start 
> with an uppercase letter.  The function signature uses lowercase, but the 
> function body uses uppercase.
> SOLUTION
> Pass the argument name through the get_field_name() function, to generate 
> code consistent with the other references of argument names.



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


[GitHub] thrift pull request: THRIFT-3471 Fix inconsistent generation of Up...

2015-12-04 Thread asfgit
Github user asfgit closed the pull request at:

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


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (THRIFT-3471) Dart generator does not handle uppercase argument names

2015-12-04 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on THRIFT-3471:


Github user asfgit closed the pull request at:

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


> Dart generator does not handle uppercase argument names
> ---
>
> Key: THRIFT-3471
> URL: https://issues.apache.org/jira/browse/THRIFT-3471
> Project: Thrift
>  Issue Type: Bug
>  Components: Dart - Compiler
>Reporter: Mark Erickson
>Assignee: Mark Erickson
> Fix For: 1.0
>
>
> PROBLEM
> The dart generator produces inconsistent code for argument names that start 
> with an uppercase letter.  The function signature uses lowercase, but the 
> function body uses uppercase.
> SOLUTION
> Pass the argument name through the get_field_name() function, to generate 
> code consistent with the other references of argument names.



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


Build failed in Jenkins: Thrift-Compiler-Windows #1876

2015-12-04 Thread Apache Jenkins Server
See 

Changes:

[jensg] THRIFT-3471 Dart generator does not handle uppercase argument names���

--
Started by an SCM change
[EnvInject] - Loading node environment variables.
Building remotely on ubuntu3 (Ubuntu ubuntu legacy-ubuntu) in workspace 

 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url 
 > https://git-wip-us.apache.org/repos/asf/thrift.git # timeout=10
Fetching upstream changes from 
https://git-wip-us.apache.org/repos/asf/thrift.git
 > git --version # timeout=10
 > git -c core.askpass=true fetch --tags --progress 
 > https://git-wip-us.apache.org/repos/asf/thrift.git 
 > +refs/heads/*:refs/remotes/origin/*
Seen branch in repository origin/0.1.x
Seen branch in repository origin/0.2.x
Seen branch in repository origin/0.3.x
Seen branch in repository origin/0.4.x
Seen branch in repository origin/0.5.x
Seen branch in repository origin/0.6.x
Seen branch in repository origin/0.7.x
Seen branch in repository origin/0.8.x
Seen branch in repository origin/0.9.1
Seen branch in repository origin/0.9.2
Seen branch in repository origin/0.9.3
Seen branch in repository origin/0.9.x
Seen branch in repository origin/master
Seen branch in repository origin/py-compiler
Seen 14 remote branches
Checking out Revision f08771ccead48b2eafa38930eb90f74f99e1c4af (origin/master)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f f08771ccead48b2eafa38930eb90f74f99e1c4af
 > git rev-list 362a5eda211e3f8093b739aeaaee93b118ace199 # timeout=10
[Thrift-Compiler-Windows] $ /bin/bash -xe /tmp/hudson6572027234952052112.sh
+ rm -rf cmake-mingw32
+ mkdir -p cmake-mingw32
+ cd cmake-mingw32
+ cmake -DCMAKE_TOOLCHAIN_FILE=../build/cmake/mingw32-toolchain.cmake 
-DBUILD_COMPILER=ON -DBUILD_LIBRARIES=OFF -DBUILD_TESTING=OFF 
-DBUILD_EXAMPLES=OFF ..
CMake Error at CMakeLists.txt:20 (cmake_minimum_required):
  CMake 2.8.12 or higher is required.  You are running version 2.8.7


-- Configuring incomplete, errors occurred!
+ sh bootstrap.sh
sh: 0: Can't open bootstrap.sh
Build step 'Execute shell' marked build as failure
[WARNINGS] Skipping publisher since build result is FAILURE
Archiving artifacts


[jira] [Resolved] (THRIFT-3471) Dart generator does not handle uppercase argument names

2015-12-04 Thread Jens Geyer (JIRA)

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

Jens Geyer resolved THRIFT-3471.

   Resolution: Fixed
Fix Version/s: 1.0

Committed, thanks!

> Dart generator does not handle uppercase argument names
> ---
>
> Key: THRIFT-3471
> URL: https://issues.apache.org/jira/browse/THRIFT-3471
> Project: Thrift
>  Issue Type: Bug
>  Components: Dart - Compiler
>Reporter: Mark Erickson
>Assignee: Mark Erickson
> Fix For: 1.0
>
>
> PROBLEM
> The dart generator produces inconsistent code for argument names that start 
> with an uppercase letter.  The function signature uses lowercase, but the 
> function body uses uppercase.
> SOLUTION
> Pass the argument name through the get_field_name() function, to generate 
> code consistent with the other references of argument names.



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


[jira] [Commented] (THRIFT-2457) fbthrift float

2015-12-04 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on THRIFT-2457:


Github user bufferoverflow commented on the pull request:

https://github.com/apache/thrift/pull/731#issuecomment-162083194
  
Thanks Andrew! I will review this during the weekend...

Could you please add THRIFT-2457 as prefix within your commits as mentioned 
within CONTRIBUTING.md ? This will simplify the automation with apache policies 
and automation made by @jfarrell and infra team.

best!
-roger


> fbthrift float
> --
>
> Key: THRIFT-2457
> URL: https://issues.apache.org/jira/browse/THRIFT-2457
> Project: Thrift
>  Issue Type: Sub-task
>  Components: Build Process, C++ - Compiler, C++ - Library, Test Suite
>Reporter: Roger Meier
>Priority: Minor
> Fix For: 1.0
>
>
> I'm interested into the fbthrift FLOAT data type.
> Which languages are supported?



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


[GitHub] thrift pull request: Support for float type (part 1: cpp)

2015-12-04 Thread bufferoverflow
Github user bufferoverflow commented on the pull request:

https://github.com/apache/thrift/pull/731#issuecomment-162083194
  
Thanks Andrew! I will review this during the weekend...

Could you please add THRIFT-2457 as prefix within your commits as mentioned 
within CONTRIBUTING.md ? This will simplify the automation with apache policies 
and automation made by @jfarrell and infra team.

best!
-roger


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Created] (THRIFT-3472) Missing semi-colon in IDL leads to non-deterministic builds

2015-12-04 Thread Jason Heimann (JIRA)
Jason Heimann created THRIFT-3472:
-

 Summary: Missing semi-colon in IDL leads to non-deterministic 
builds
 Key: THRIFT-3472
 URL: https://issues.apache.org/jira/browse/THRIFT-3472
 Project: Thrift
  Issue Type: Bug
Affects Versions: 0.9.2
 Environment: Ubuntu 14.04.3 LTS x86_64
Reporter: Jason Heimann


The following erroneous IDL was fed into thrift, from which we generated python 
(new_style), java (private-members), node.js and C++ output:

{code}
namespace java com.acme.model.sequencenumber
namespace py acme_thrift.model.sequencenumber
namespace cpp acme.model.sequencenumber

include "Common.thrift"

struct SequenceNumberResponse
{
1: required Common.ResponseContext context;
2: required Common.VersionId sequenceNumber
}
{code}

Each of these generated languages are compiled (as applicable) and packaged 
after generation.  This is all to say, several revisions of our thrift IDL 
successfully generated, compiled, packaged and deployed with this error.

...until it didn't.  An IDL revision in a completely unrelated namespace 
triggered the following compilation error in the C++ output:

{code}
In file included from 
/build_tmp/thrift-api-cmake/generated-sources/gen-cpp/SequenceNumber.cpp:7:0:
 /build_tmp/thrift-api-cmake/generated-sources/gen-cpp/SequenceNumber.h:18:57: 
error: 'acme::model::sequencenumber' has not been declared
 /build_tmp/thrift-api-cmake/generated-sources/gen-cpp/SequenceNumber.h:18:95: 
error: expected ',' or '...' before '&' token
{code}

Of course, adding the missing semicolon fixed this issue.  This being said, I'd 
expect something in the thrift compiler to complain about such faulty IDL



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


[jira] [Commented] (THRIFT-3060) Node.js client retry logic doesn't flush offline queue on reconnect

2015-12-04 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on THRIFT-3060:


Github user nsuke commented on a diff in the pull request:

https://github.com/apache/thrift/pull/395#discussion_r46751947
  
--- Diff: lib/nodejs/lib/thrift/connection.js ---
@@ -209,10 +205,9 @@ Connection.prototype.connection_gone = function () {
   this.connected = false;
   this.ready = false;
 
+  this.retry_delay = Math.floor(this.retry_delay * this.retry_backoff);
--- End diff --

Is there good reason to change the initial timeout value and also 
`retry_backoff` 1.7 -> 1.5 ?


> Node.js client retry logic doesn't flush offline queue on reconnect
> ---
>
> Key: THRIFT-3060
> URL: https://issues.apache.org/jira/browse/THRIFT-3060
> Project: Thrift
>  Issue Type: Bug
>  Components: Node.js - Library
>Affects Versions: 0.9.2
>Reporter: Chris Thompson
>Priority: Minor
> Attachments: thrift-3060-fix_retry_logic.patch
>
>
> The Node.js client includes retry logic in case the connection terminates 
> unexpectedly.  On reconnect, the `offline_queue` variable never gets reset, 
> so any requests still in the queue will get processed on every reconnect.
> In addition, the variables the keep track of the retry state are not 
> initialized prior to a successful connection, meaning that if the initial 
> connection doesn't succeed, that the retry timer is set to `NaN` and doesn't 
> work as expected.



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


[GitHub] thrift pull request: THRIFT-3060: NodeJS Client - Fix connection r...

2015-12-04 Thread nsuke
Github user nsuke commented on a diff in the pull request:

https://github.com/apache/thrift/pull/395#discussion_r46751947
  
--- Diff: lib/nodejs/lib/thrift/connection.js ---
@@ -209,10 +205,9 @@ Connection.prototype.connection_gone = function () {
   this.connected = false;
   this.ready = false;
 
+  this.retry_delay = Math.floor(this.retry_delay * this.retry_backoff);
--- End diff --

Is there good reason to change the initial timeout value and also 
`retry_backoff` 1.7 -> 1.5 ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (THRIFT-3060) Node.js client retry logic doesn't flush offline queue on reconnect

2015-12-04 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on THRIFT-3060:


Github user nsuke commented on the pull request:

https://github.com/apache/thrift/pull/395#issuecomment-162132438
  
I don't understand well the original motivation for clearing the queue.

It seems to me, if the user calls some RPC methods it should be either done 
or error.
They should not be silently ignored on random automatic reconnects.
If the disconnect is because of erroneous RPC input, the caller is 
responsible for properly re-initializing client.

Am I missing something ?


> Node.js client retry logic doesn't flush offline queue on reconnect
> ---
>
> Key: THRIFT-3060
> URL: https://issues.apache.org/jira/browse/THRIFT-3060
> Project: Thrift
>  Issue Type: Bug
>  Components: Node.js - Library
>Affects Versions: 0.9.2
>Reporter: Chris Thompson
>Priority: Minor
> Attachments: thrift-3060-fix_retry_logic.patch
>
>
> The Node.js client includes retry logic in case the connection terminates 
> unexpectedly.  On reconnect, the `offline_queue` variable never gets reset, 
> so any requests still in the queue will get processed on every reconnect.
> In addition, the variables the keep track of the retry state are not 
> initialized prior to a successful connection, meaning that if the initial 
> connection doesn't succeed, that the retry timer is set to `NaN` and doesn't 
> work as expected.



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


[GitHub] thrift pull request: THRIFT-3060: NodeJS Client - Fix connection r...

2015-12-04 Thread nsuke
Github user nsuke commented on the pull request:

https://github.com/apache/thrift/pull/395#issuecomment-162132438
  
I don't understand well the original motivation for clearing the queue.

It seems to me, if the user calls some RPC methods it should be either done 
or error.
They should not be silently ignored on random automatic reconnects.
If the disconnect is because of erroneous RPC input, the caller is 
responsible for properly re-initializing client.

Am I missing something ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


Jenkins build is back to normal : Thrift-Compiler-Windows #1877

2015-12-04 Thread Apache Jenkins Server
See 



[jira] [Updated] (THRIFT-3473) C++ server cannot correctly return a struct/object contains list

2015-12-04 Thread YU Chang (JIRA)

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

YU Chang updated THRIFT-3473:
-
Description: 
When a struct/object contains list, the thrift C++ server always return 
null/undef.

Here is my thrift file:
{code:title=WordAligner.thrift|borderStyle=solid}
namespace cpp WordAligner
namespace perl WordAligner

struct AlignParamter { 
1: string srcLang,
2: string tarLang,
3: optional i32 nBestSize = 1,
}

struct SentenPair {
1: string srcSenten,
2: string tarSenten,
}

struct AlignPair {
1: optional string srcWord,
2: optional string tarWord,
}

struct AlignResult {
1: i32 resultCode,
2: string resultMessage,
3: optional list nBestAlignPairList,
}

service WordAlignService {
AlignResult alignOnePair(1: AlignParamter alignParamter, 2: SentenPair 
sentenPair),
list alignPairList(1: AlignParamter alignParamter, 2: 
list sentenPairList)
}
{code}

Here is my C++ code (server):

#include 
#include 
#include 
#include 

#include "thrift/WordAlignService.h"

#include 
#include 

using namespace std;
using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;

using boost::shared_ptr;

using namespace  ::WordAligner;

class WordAlignServiceHandler : virtual public WordAlignServiceIf {
public:
WordAlignServiceHandler() {
}

void alignOnePair(AlignResult& _return, const AlignParamter& 
alignParamter, const SentenPair& sentenPair) {
_return.resultCode = 0;
_return.resultMessage = "Success";
AlignPair alignPair;
alignPair.srcWord = "中国";
alignPair.tarWord = "china";
vector alignPairVec;
alignPairVec.push_back(alignPair);
_return.nBestAlignPairList.push_back(alignPairVec);
cout << "nBestAlignPairList size: " << 
_return.nBestAlignPairList.size() << endl;
cout << "src word: " << _return.nBestAlignPairList[0][0].srcWord << 
endl;
cout << "tar word: " << _return.nBestAlignPairList[0][0].tarWord << 
endl;
}

void alignPairList(std::vector & _return, const 
AlignParamter& alignParamter, const std::vector & sentenPairList) {
// Your implementation goes here
printf("alignPairList\n");
}

};

int main(int argc, char **argv) {
int port = 9595;
shared_ptr handler(new WordAlignServiceHandler());
shared_ptr processor(new WordAlignServiceProcessor(handler));
shared_ptr serverTransport(new TServerSocket(port));
shared_ptr transportFactory(new 
TBufferedTransportFactory());
shared_ptr protocolFactory(new TBinaryProtocolFactory());

TSimpleServer server(processor, serverTransport, transportFactory, 
protocolFactory);
server.serve();
return 0;
}

Here is my perl code (client):

#!/usr/bin/perl

use v5.12;
use warnings;
use autodie;

use utf8;
use Data::Dumper;

use lib 'gen-perl-wordalign';

use WordAligner::WordAlignService;
use WordAligner::Constants;
use WordAligner::Types;

use Thrift;
use Thrift::BinaryProtocol;
use Thrift::Socket;
use Thrift::BufferedTransport;


my $socket= new Thrift::Socket('localhost', 9595);
my $transport = new Thrift::BufferedTransport($socket, 1024, 1024);
my $protocol  = new Thrift::BinaryProtocol($transport);
my $client= new WordAligner::WordAlignServiceClient($protocol);

my $align_param = new WordAligner::AlignParamter;
$align_param->srcLang('zh-CN');
$align_param->tarLang('en');

my $src_senten = "中国 政府 高度 重视 经济 发展 。";
my $tar_senten = "china 's government attached great importance to economic 
development .";

my $senten_pair = new WordAligner::SentenPair;
$senten_pair->srcSenten($src_senten);
$senten_pair->tarSenten($tar_senten);

eval {
$transport->open();
my $result = $client->alignOnePair($align_param, $senten_pair);
say Dumper($result);
$transport->close();
};
say $@ if $@;

C++ server output:

nBestAlignPairList size: 1
src word: 中国
tar word: china

perl client output:

$VAR1 = bless( {
 'resultMessage' => 'Success',
 'resultCode' => 0,
 'nBestAlignPairList' => undef
   }, 'WordAligner::AlignResult' );

For solving this problem, I have already tried to:

1) return just one level list, not list of list;
2) using C++ client to test;
3) upgrade thrift version from 0.9.1 to 0.9.3;

But nothing help, the return list is still empty.

  was:
When a struct/object contains list, the thrift C++ server always return 
null/undef.

Here is my thrift file:

namespace cpp WordAligner
namespace perl WordAligner

struct AlignParamter { 
1: string srcLang,
2: string tarLang,
3: optional i32 nBestSize = 1,
}

struct SentenPair {
1: string srcSenten,
2: string tarSenten,
}

struct AlignPair {
1: optional 

[jira] [Updated] (THRIFT-3473) C++ server cannot correctly return a struct/object contains list

2015-12-04 Thread YU Chang (JIRA)

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

YU Chang updated THRIFT-3473:
-
Description: 
When a struct/object contains list, the thrift C++ server always return 
null/undef.

Here is my thrift file:

namespace cpp WordAligner
namespace perl WordAligner

struct AlignParamter { 
\\
1: string srcLang,
2: string tarLang,
3: optional i32 nBestSize = 1,
}\\

struct SentenPair {
1: string srcSenten,
2: string tarSenten,
}

struct AlignPair {
1: optional string srcWord,
2: optional string tarWord,
}

struct AlignResult {
1: i32 resultCode,
2: string resultMessage,
3: optional list nBestAlignPairList,
}

service WordAlignService {
AlignResult alignOnePair(1: AlignParamter alignParamter, 2: SentenPair 
sentenPair),
list alignPairList(1: AlignParamter alignParamter, 2: 
list sentenPairList)
}


Here is my C++ code (server):

#include 
#include 
#include 
#include 

#include "thrift/WordAlignService.h"

#include 
#include 

using namespace std;
using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;

using boost::shared_ptr;

using namespace  ::WordAligner;

class WordAlignServiceHandler : virtual public WordAlignServiceIf {
public:
WordAlignServiceHandler() {
}

void alignOnePair(AlignResult& _return, const AlignParamter& 
alignParamter, const SentenPair& sentenPair) {
_return.resultCode = 0;
_return.resultMessage = "Success";
AlignPair alignPair;
alignPair.srcWord = "中国";
alignPair.tarWord = "china";
vector alignPairVec;
alignPairVec.push_back(alignPair);
_return.nBestAlignPairList.push_back(alignPairVec);
cout << "nBestAlignPairList size: " << 
_return.nBestAlignPairList.size() << endl;
cout << "src word: " << _return.nBestAlignPairList[0][0].srcWord << 
endl;
cout << "tar word: " << _return.nBestAlignPairList[0][0].tarWord << 
endl;
}

void alignPairList(std::vector & _return, const 
AlignParamter& alignParamter, const std::vector & sentenPairList) {
// Your implementation goes here
printf("alignPairList\n");
}

};

int main(int argc, char **argv) {
int port = 9595;
shared_ptr handler(new WordAlignServiceHandler());
shared_ptr processor(new WordAlignServiceProcessor(handler));
shared_ptr serverTransport(new TServerSocket(port));
shared_ptr transportFactory(new 
TBufferedTransportFactory());
shared_ptr protocolFactory(new TBinaryProtocolFactory());

TSimpleServer server(processor, serverTransport, transportFactory, 
protocolFactory);
server.serve();
return 0;
}

Here is my perl code (client):

#!/usr/bin/perl

use v5.12;
use warnings;
use autodie;

use utf8;
use Data::Dumper;

use lib 'gen-perl-wordalign';

use WordAligner::WordAlignService;
use WordAligner::Constants;
use WordAligner::Types;

use Thrift;
use Thrift::BinaryProtocol;
use Thrift::Socket;
use Thrift::BufferedTransport;


my $socket= new Thrift::Socket('localhost', 9595);
my $transport = new Thrift::BufferedTransport($socket, 1024, 1024);
my $protocol  = new Thrift::BinaryProtocol($transport);
my $client= new WordAligner::WordAlignServiceClient($protocol);

my $align_param = new WordAligner::AlignParamter;
$align_param->srcLang('zh-CN');
$align_param->tarLang('en');

my $src_senten = "中国 政府 高度 重视 经济 发展 。";
my $tar_senten = "china 's government attached great importance to economic 
development .";

my $senten_pair = new WordAligner::SentenPair;
$senten_pair->srcSenten($src_senten);
$senten_pair->tarSenten($tar_senten);

eval {
$transport->open();
my $result = $client->alignOnePair($align_param, $senten_pair);
say Dumper($result);
$transport->close();
};
say $@ if $@;

C++ server output:

nBestAlignPairList size: 1
src word: 中国
tar word: china

perl client output:

$VAR1 = bless( {
 'resultMessage' => 'Success',
 'resultCode' => 0,
 'nBestAlignPairList' => undef
   }, 'WordAligner::AlignResult' );

For solving this problem, I have already tried to:

1) return just one level list, not list of list;
2) using C++ client to test;
3) upgrade thrift version from 0.9.1 to 0.9.3;

But nothing help, the return list is still empty.

  was:
When a struct/object contains list, the thrift C++ server always return 
null/undef.

Here is my thrift file:

namespace cpp WordAligner
namespace perl WordAligner

struct AlignParamter { \\
1: string srcLang,
2: string tarLang,
3: optional i32 nBestSize = 1,
}\\

struct SentenPair {\\
1: string srcSenten,
2: string tarSenten,
}\\

struct AlignPair {\\
1: optional string srcWord,
2: optional string 

[jira] [Updated] (THRIFT-3473) C++ server cannot correctly return a struct/object contains list

2015-12-04 Thread YU Chang (JIRA)

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

YU Chang updated THRIFT-3473:
-
Description: 
When a struct/object contains list, the thrift C++ server always return 
null/undef.

Here is my thrift file:

namespace cpp WordAligner
namespace perl WordAligner

struct AlignParamter { 
1: string srcLang,
2: string tarLang,
3: optional i32 nBestSize = 1,
}

struct SentenPair {
1: string srcSenten,
2: string tarSenten,
}

struct AlignPair {
1: optional string srcWord,
2: optional string tarWord,
}

struct AlignResult {
1: i32 resultCode,
2: string resultMessage,
3: optional list nBestAlignPairList,
}

service WordAlignService {
AlignResult alignOnePair(1: AlignParamter alignParamter, 2: SentenPair 
sentenPair),
list alignPairList(1: AlignParamter alignParamter, 2: 
list sentenPairList)
}


Here is my C++ code (server):

#include 
#include 
#include 
#include 

#include "thrift/WordAlignService.h"

#include 
#include 

using namespace std;
using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;

using boost::shared_ptr;

using namespace  ::WordAligner;

class WordAlignServiceHandler : virtual public WordAlignServiceIf {
public:
WordAlignServiceHandler() {
}

void alignOnePair(AlignResult& _return, const AlignParamter& 
alignParamter, const SentenPair& sentenPair) {
_return.resultCode = 0;
_return.resultMessage = "Success";
AlignPair alignPair;
alignPair.srcWord = "中国";
alignPair.tarWord = "china";
vector alignPairVec;
alignPairVec.push_back(alignPair);
_return.nBestAlignPairList.push_back(alignPairVec);
cout << "nBestAlignPairList size: " << 
_return.nBestAlignPairList.size() << endl;
cout << "src word: " << _return.nBestAlignPairList[0][0].srcWord << 
endl;
cout << "tar word: " << _return.nBestAlignPairList[0][0].tarWord << 
endl;
}

void alignPairList(std::vector & _return, const 
AlignParamter& alignParamter, const std::vector & sentenPairList) {
// Your implementation goes here
printf("alignPairList\n");
}

};

int main(int argc, char **argv) {
int port = 9595;
shared_ptr handler(new WordAlignServiceHandler());
shared_ptr processor(new WordAlignServiceProcessor(handler));
shared_ptr serverTransport(new TServerSocket(port));
shared_ptr transportFactory(new 
TBufferedTransportFactory());
shared_ptr protocolFactory(new TBinaryProtocolFactory());

TSimpleServer server(processor, serverTransport, transportFactory, 
protocolFactory);
server.serve();
return 0;
}

Here is my perl code (client):

#!/usr/bin/perl

use v5.12;
use warnings;
use autodie;

use utf8;
use Data::Dumper;

use lib 'gen-perl-wordalign';

use WordAligner::WordAlignService;
use WordAligner::Constants;
use WordAligner::Types;

use Thrift;
use Thrift::BinaryProtocol;
use Thrift::Socket;
use Thrift::BufferedTransport;


my $socket= new Thrift::Socket('localhost', 9595);
my $transport = new Thrift::BufferedTransport($socket, 1024, 1024);
my $protocol  = new Thrift::BinaryProtocol($transport);
my $client= new WordAligner::WordAlignServiceClient($protocol);

my $align_param = new WordAligner::AlignParamter;
$align_param->srcLang('zh-CN');
$align_param->tarLang('en');

my $src_senten = "中国 政府 高度 重视 经济 发展 。";
my $tar_senten = "china 's government attached great importance to economic 
development .";

my $senten_pair = new WordAligner::SentenPair;
$senten_pair->srcSenten($src_senten);
$senten_pair->tarSenten($tar_senten);

eval {
$transport->open();
my $result = $client->alignOnePair($align_param, $senten_pair);
say Dumper($result);
$transport->close();
};
say $@ if $@;

C++ server output:

nBestAlignPairList size: 1
src word: 中国
tar word: china

perl client output:

$VAR1 = bless( {
 'resultMessage' => 'Success',
 'resultCode' => 0,
 'nBestAlignPairList' => undef
   }, 'WordAligner::AlignResult' );

For solving this problem, I have already tried to:

1) return just one level list, not list of list;
2) using C++ client to test;
3) upgrade thrift version from 0.9.1 to 0.9.3;

But nothing help, the return list is still empty.

  was:
When a struct/object contains list, the thrift C++ server always return 
null/undef.

Here is my thrift file:

namespace cpp WordAligner
namespace perl WordAligner

struct AlignParamter { 
\\
1: string srcLang,
2: string tarLang,
3: optional i32 nBestSize = 1,
}\\

struct SentenPair {
1: string srcSenten,
2: string tarSenten,
}

struct AlignPair {
1: optional string srcWord,
2: optional string tarWord,
}


[jira] [Updated] (THRIFT-3473) C++ server cannot correctly return a struct/object contains list

2015-12-04 Thread YU Chang (JIRA)

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

YU Chang updated THRIFT-3473:
-
Description: 
When a struct/object contains list, the thrift C++ server always return 
null/undef.

Here is my thrift file:
{code:title=WordAligner.thrift|borderStyle=solid}
namespace cpp WordAligner
namespace perl WordAligner

struct AlignParamter { 
1: string srcLang,
2: string tarLang,
3: optional i32 nBestSize = 1,
}

struct SentenPair {
1: string srcSenten,
2: string tarSenten,
}

struct AlignPair {
1: optional string srcWord,
2: optional string tarWord,
}

struct AlignResult {
1: i32 resultCode,
2: string resultMessage,
3: optional list nBestAlignPairList,
}

service WordAlignService {
AlignResult alignOnePair(1: AlignParamter alignParamter, 2: SentenPair 
sentenPair),
list alignPairList(1: AlignParamter alignParamter, 2: 
list sentenPairList)
}
{code}

Here is my C++ code (server):
{code:title=WordAlignerServer.cpp|borderStyle=solid}
#include 
#include 
#include 
#include 

#include "thrift/WordAlignService.h"

#include 
#include 

using namespace std;
using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;

using boost::shared_ptr;

using namespace  ::WordAligner;

class WordAlignServiceHandler : virtual public WordAlignServiceIf {
public:
WordAlignServiceHandler() {
}

void alignOnePair(AlignResult& _return, const AlignParamter& 
alignParamter, const SentenPair& sentenPair) {
_return.resultCode = 0;
_return.resultMessage = "Success";
AlignPair alignPair;
alignPair.srcWord = "中国";
alignPair.tarWord = "china";
vector alignPairVec;
alignPairVec.push_back(alignPair);
_return.nBestAlignPairList.push_back(alignPairVec);
cout << "nBestAlignPairList size: " << 
_return.nBestAlignPairList.size() << endl;
cout << "src word: " << _return.nBestAlignPairList[0][0].srcWord << 
endl;
cout << "tar word: " << _return.nBestAlignPairList[0][0].tarWord << 
endl;
}

void alignPairList(std::vector & _return, const 
AlignParamter& alignParamter, const std::vector & sentenPairList) {
// Your implementation goes here
printf("alignPairList\n");
}

};

int main(int argc, char **argv) {
int port = 9595;
shared_ptr handler(new WordAlignServiceHandler());
shared_ptr processor(new WordAlignServiceProcessor(handler));
shared_ptr serverTransport(new TServerSocket(port));
shared_ptr transportFactory(new 
TBufferedTransportFactory());
shared_ptr protocolFactory(new TBinaryProtocolFactory());

TSimpleServer server(processor, serverTransport, transportFactory, 
protocolFactory);
server.serve();
return 0;
}
{code}


Here is my perl code (client):
{code:title=WordAlignerClient.pl|borderStyle=solid}
#!/usr/bin/perl

use v5.12;
use warnings;
use autodie;

use utf8;
use Data::Dumper;

use lib 'gen-perl-wordalign';

use WordAligner::WordAlignService;
use WordAligner::Constants;
use WordAligner::Types;

use Thrift;
use Thrift::BinaryProtocol;
use Thrift::Socket;
use Thrift::BufferedTransport;


my $socket= new Thrift::Socket('localhost', 9595);
my $transport = new Thrift::BufferedTransport($socket, 1024, 1024);
my $protocol  = new Thrift::BinaryProtocol($transport);
my $client= new WordAligner::WordAlignServiceClient($protocol);

my $align_param = new WordAligner::AlignParamter;
$align_param->srcLang('zh-CN');
$align_param->tarLang('en');

my $src_senten = "中国 政府 高度 重视 经济 发展 。";
my $tar_senten = "china 's government attached great importance to economic 
development .";

my $senten_pair = new WordAligner::SentenPair;
$senten_pair->srcSenten($src_senten);
$senten_pair->tarSenten($tar_senten);

eval {
$transport->open();
my $result = $client->alignOnePair($align_param, $senten_pair);
say Dumper($result);
$transport->close();
};
say $@ if $@;
{code}

C++ server output:
{code:title=C++ server output|borderStyle=solid}
nBestAlignPairList size: 1
src word: 中国
tar word: china
{code}
perl client output:
{code:title=perl client output|borderStyle=solid}
$VAR1 = bless( {
 'resultMessage' => 'Success',
 'resultCode' => 0,
 'nBestAlignPairList' => undef
   }, 'WordAligner::AlignResult' );
{code}
For solving this problem, I have already tried to:

1) return just one level list, not list of list;
2) using C++ client to test;
3) upgrade thrift version from 0.9.1 to 0.9.3;

But nothing help, the return list is still empty.

  was:
When a struct/object contains list, the thrift C++ server always return 
null/undef.

Here is my thrift file:

[jira] [Updated] (THRIFT-3473) C++ server cannot correctly return a struct/object contains list

2015-12-04 Thread YU Chang (JIRA)

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

YU Chang updated THRIFT-3473:
-
Description: 
When a struct/object contains list, the thrift C++ server always return 
null/undef.

Here is my thrift file:
{code:title=WordAligner.thrift|borderStyle=solid}
namespace cpp WordAligner
namespace perl WordAligner

struct AlignParamter { 
1: string srcLang,
2: string tarLang,
3: optional i32 nBestSize = 1,
}

struct SentenPair {
1: string srcSenten,
2: string tarSenten,
}

struct AlignPair {
1: optional string srcWord,
2: optional string tarWord,
}

struct AlignResult {
1: i32 resultCode,
2: string resultMessage,
3: optional list nBestAlignPairList,
}

service WordAlignService {
AlignResult alignOnePair(1: AlignParamter alignParamter, 2: SentenPair 
sentenPair),
list alignPairList(1: AlignParamter alignParamter, 2: 
list sentenPairList)
}
{code}

Here is my C++ code (server):
{code:title=WordAlignerServer.cpp|borderStyle=solid}
#include 
#include 
#include 
#include 

#include "thrift/WordAlignService.h"

#include 
#include 

using namespace std;
using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;

using boost::shared_ptr;

using namespace  ::WordAligner;

class WordAlignServiceHandler : virtual public WordAlignServiceIf {
public:
WordAlignServiceHandler() {
}

void alignOnePair(AlignResult& _return, const AlignParamter& 
alignParamter, const SentenPair& sentenPair) {
_return.resultCode = 0;
_return.resultMessage = "Success";
AlignPair alignPair;
alignPair.srcWord = "中国";
alignPair.tarWord = "china";
vector alignPairVec;
alignPairVec.push_back(alignPair);
_return.nBestAlignPairList.push_back(alignPairVec);
cout << "nBestAlignPairList size: " << 
_return.nBestAlignPairList.size() << endl;
cout << "src word: " << _return.nBestAlignPairList[0][0].srcWord << 
endl;
cout << "tar word: " << _return.nBestAlignPairList[0][0].tarWord << 
endl;
}

void alignPairList(std::vector & _return, const 
AlignParamter& alignParamter, const std::vector & sentenPairList) {
// Your implementation goes here
printf("alignPairList\n");
}

};

int main(int argc, char **argv) {
int port = 9595;
shared_ptr handler(new WordAlignServiceHandler());
shared_ptr processor(new WordAlignServiceProcessor(handler));
shared_ptr serverTransport(new TServerSocket(port));
shared_ptr transportFactory(new 
TBufferedTransportFactory());
shared_ptr protocolFactory(new TBinaryProtocolFactory());

TSimpleServer server(processor, serverTransport, transportFactory, 
protocolFactory);
server.serve();
return 0;
}
{code}


Here is my perl code (client):
{code:title=WordAlignerClient.pl|borderStyle=solid}
#!/usr/bin/perl

use v5.12;
use warnings;
use autodie;

use utf8;
use Data::Dumper;

use lib 'gen-perl-wordalign';

use WordAligner::WordAlignService;
use WordAligner::Constants;
use WordAligner::Types;

use Thrift;
use Thrift::BinaryProtocol;
use Thrift::Socket;
use Thrift::BufferedTransport;


my $socket= new Thrift::Socket('localhost', 9595);
my $transport = new Thrift::BufferedTransport($socket, 1024, 1024);
my $protocol  = new Thrift::BinaryProtocol($transport);
my $client= new WordAligner::WordAlignServiceClient($protocol);

my $align_param = new WordAligner::AlignParamter;
$align_param->srcLang('zh-CN');
$align_param->tarLang('en');

my $src_senten = "中国 政府 高度 重视 经济 发展 。";
my $tar_senten = "china 's government attached great importance to economic 
development .";

my $senten_pair = new WordAligner::SentenPair;
$senten_pair->srcSenten($src_senten);
$senten_pair->tarSenten($tar_senten);

eval {
$transport->open();
my $result = $client->alignOnePair($align_param, $senten_pair);
say Dumper($result);
$transport->close();
};
say $@ if $@;
{code}

{code:title=C++ server output|borderStyle=solid}
nBestAlignPairList size: 1
src word: 中国
tar word: china
{code}

{code:title=perl client output|borderStyle=solid}
$VAR1 = bless( {
 'resultMessage' => 'Success',
 'resultCode' => 0,
 'nBestAlignPairList' => undef
   }, 'WordAligner::AlignResult' );
{code}
For solving this problem, I have already tried to:

1) return just one level list, not list of list;
2) using C++ client to test;
3) upgrade thrift version from 0.9.1 to 0.9.3;

But nothing help, the return list is still empty.

  was:
When a struct/object contains list, the thrift C++ server always return 
null/undef.

Here is my thrift file:
{code:title=WordAligner.thrift|borderStyle=solid}
namespace cpp WordAligner

[GitHub] thrift pull request: THRIFT-3060: NodeJS Client - Fix connection r...

2015-12-04 Thread nsuke
Github user nsuke commented on the pull request:

https://github.com/apache/thrift/pull/395#issuecomment-162127656
  
Hi @cjthompson, thanks for the reminder.

SSL does not seem to work with this change:
https://travis-ci.org/apache/thrift/jobs/56435212#L7581
https://travis-ci.org/apache/thrift/jobs/56435202#L5448
Could you look into this  ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (THRIFT-3060) Node.js client retry logic doesn't flush offline queue on reconnect

2015-12-04 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on THRIFT-3060:


Github user nsuke commented on the pull request:

https://github.com/apache/thrift/pull/395#issuecomment-162127656
  
Hi @cjthompson, thanks for the reminder.

SSL does not seem to work with this change:
https://travis-ci.org/apache/thrift/jobs/56435212#L7581
https://travis-ci.org/apache/thrift/jobs/56435202#L5448
Could you look into this  ?


> Node.js client retry logic doesn't flush offline queue on reconnect
> ---
>
> Key: THRIFT-3060
> URL: https://issues.apache.org/jira/browse/THRIFT-3060
> Project: Thrift
>  Issue Type: Bug
>  Components: Node.js - Library
>Affects Versions: 0.9.2
>Reporter: Chris Thompson
>Priority: Minor
> Attachments: thrift-3060-fix_retry_logic.patch
>
>
> The Node.js client includes retry logic in case the connection terminates 
> unexpectedly.  On reconnect, the `offline_queue` variable never gets reset, 
> so any requests still in the queue will get processed on every reconnect.
> In addition, the variables the keep track of the retry state are not 
> initialized prior to a successful connection, meaning that if the initial 
> connection doesn't succeed, that the retry timer is set to `NaN` and doesn't 
> work as expected.



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


[GitHub] thrift pull request: THRIFT-3060: NodeJS Client - Fix connection r...

2015-12-04 Thread nsuke
Github user nsuke commented on a diff in the pull request:

https://github.com/apache/thrift/pull/395#discussion_r46752076
  
--- Diff: lib/nodejs/lib/thrift/connection.js ---
@@ -182,10 +170,18 @@ Connection.prototype.initialize_retry_vars = function 
() {
   this.retry_timer = null;
   this.retry_totaltime = 0;
   this.retry_delay = 150;
-  this.retry_backoff = 1.7;
+  this.retry_backoff = 1.5;
   this.attempts = 0;
 };
 
+Connection.prototype.flushQueue = function () {
+  var current_queue = this.offline_queue.slice();
--- End diff --

I don't think we need a copy here since we're throwing away the old one 
right away.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] thrift pull request: THRIFT-3452 .travis.yml: Migrating from legac...

2015-12-04 Thread asfgit
Github user asfgit closed the pull request at:

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


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Updated] (THRIFT-3473) C++ server cannot correctly return a struct/object contains list

2015-12-04 Thread YU Chang (JIRA)

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

YU Chang updated THRIFT-3473:
-
Description: 
When a struct/object contains list, the thrift C++ server always return 
null/undef.

Here is my thrift file:
{quote}
namespace cpp WordAligner
namespace perl WordAligner

struct AlignParamter {
1: string srcLang,
2: string tarLang,
3: optional i32 nBestSize = 1,
}

struct SentenPair {
1: string srcSenten,
2: string tarSenten,
}

struct AlignPair {
1: optional string srcWord,
2: optional string tarWord,
}

struct AlignResult {
1: i32 resultCode,
2: string resultMessage,
3: optional list nBestAlignPairList,
}

service WordAlignService {
AlignResult alignOnePair(1: AlignParamter alignParamter, 2: SentenPair 
sentenPair),
list alignPairList(1: AlignParamter alignParamter, 2: 
list sentenPairList)
}
{quote}

Here is my C++ code (server):

#include 
#include 
#include 
#include 

#include "thrift/WordAlignService.h"

#include 
#include 

using namespace std;
using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;

using boost::shared_ptr;

using namespace  ::WordAligner;

class WordAlignServiceHandler : virtual public WordAlignServiceIf {
public:
WordAlignServiceHandler() {
}

void alignOnePair(AlignResult& _return, const AlignParamter& 
alignParamter, const SentenPair& sentenPair) {
_return.resultCode = 0;
_return.resultMessage = "Success";
AlignPair alignPair;
alignPair.srcWord = "中国";
alignPair.tarWord = "china";
vector alignPairVec;
alignPairVec.push_back(alignPair);
_return.nBestAlignPairList.push_back(alignPairVec);
cout << "nBestAlignPairList size: " << 
_return.nBestAlignPairList.size() << endl;
cout << "src word: " << _return.nBestAlignPairList[0][0].srcWord << 
endl;
cout << "tar word: " << _return.nBestAlignPairList[0][0].tarWord << 
endl;
}

void alignPairList(std::vector & _return, const 
AlignParamter& alignParamter, const std::vector & sentenPairList) {
// Your implementation goes here
printf("alignPairList\n");
}

};

int main(int argc, char **argv) {
int port = 9595;
shared_ptr handler(new WordAlignServiceHandler());
shared_ptr processor(new WordAlignServiceProcessor(handler));
shared_ptr serverTransport(new TServerSocket(port));
shared_ptr transportFactory(new 
TBufferedTransportFactory());
shared_ptr protocolFactory(new TBinaryProtocolFactory());

TSimpleServer server(processor, serverTransport, transportFactory, 
protocolFactory);
server.serve();
return 0;
}

Here is my perl code (client):

#!/usr/bin/perl

use v5.12;
use warnings;
use autodie;

use utf8;
use Data::Dumper;

use lib 'gen-perl-wordalign';

use WordAligner::WordAlignService;
use WordAligner::Constants;
use WordAligner::Types;

use Thrift;
use Thrift::BinaryProtocol;
use Thrift::Socket;
use Thrift::BufferedTransport;


my $socket= new Thrift::Socket('localhost', 9595);
my $transport = new Thrift::BufferedTransport($socket, 1024, 1024);
my $protocol  = new Thrift::BinaryProtocol($transport);
my $client= new WordAligner::WordAlignServiceClient($protocol);

my $align_param = new WordAligner::AlignParamter;
$align_param->srcLang('zh-CN');
$align_param->tarLang('en');

my $src_senten = "中国 政府 高度 重视 经济 发展 。";
my $tar_senten = "china 's government attached great importance to economic 
development .";

my $senten_pair = new WordAligner::SentenPair;
$senten_pair->srcSenten($src_senten);
$senten_pair->tarSenten($tar_senten);

eval {
$transport->open();
my $result = $client->alignOnePair($align_param, $senten_pair);
say Dumper($result);
$transport->close();
};
say $@ if $@;

C++ server output:

nBestAlignPairList size: 1
src word: 中国
tar word: china

perl client output:

$VAR1 = bless( {
 'resultMessage' => 'Success',
 'resultCode' => 0,
 'nBestAlignPairList' => undef
   }, 'WordAligner::AlignResult' );

For solving this problem, I have already tried to:

1) return just one level list, not list of list;
2) using C++ client to test;
3) upgrade thrift version from 0.9.1 to 0.9.3;

But nothing help, the return list is still empty.

  was:
When a struct/object contains list, the thrift C++ server always return 
null/undef.

Here is my thrift file:

namespace cpp WordAligner
namespace perl WordAligner

struct AlignParamter {
1: string srcLang,
2: string tarLang,
3: optional i32 nBestSize = 1,
}

struct SentenPair {
1: string srcSenten,
2: string tarSenten,
}

struct AlignPair {
1: optional string srcWord,
2: optional string 

[jira] [Commented] (THRIFT-3060) Node.js client retry logic doesn't flush offline queue on reconnect

2015-12-04 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on THRIFT-3060:


Github user nsuke commented on a diff in the pull request:

https://github.com/apache/thrift/pull/395#discussion_r46752076
  
--- Diff: lib/nodejs/lib/thrift/connection.js ---
@@ -182,10 +170,18 @@ Connection.prototype.initialize_retry_vars = function 
() {
   this.retry_timer = null;
   this.retry_totaltime = 0;
   this.retry_delay = 150;
-  this.retry_backoff = 1.7;
+  this.retry_backoff = 1.5;
   this.attempts = 0;
 };
 
+Connection.prototype.flushQueue = function () {
+  var current_queue = this.offline_queue.slice();
--- End diff --

I don't think we need a copy here since we're throwing away the old one 
right away.


> Node.js client retry logic doesn't flush offline queue on reconnect
> ---
>
> Key: THRIFT-3060
> URL: https://issues.apache.org/jira/browse/THRIFT-3060
> Project: Thrift
>  Issue Type: Bug
>  Components: Node.js - Library
>Affects Versions: 0.9.2
>Reporter: Chris Thompson
>Priority: Minor
> Attachments: thrift-3060-fix_retry_logic.patch
>
>
> The Node.js client includes retry logic in case the connection terminates 
> unexpectedly.  On reconnect, the `offline_queue` variable never gets reset, 
> so any requests still in the queue will get processed on every reconnect.
> In addition, the variables the keep track of the retry state are not 
> initialized prior to a successful connection, meaning that if the initial 
> connection doesn't succeed, that the retry timer is set to `NaN` and doesn't 
> work as expected.



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


[jira] [Created] (THRIFT-3473) C++ server cannot correctly return a struct/object contains list

2015-12-04 Thread YU Chang (JIRA)
YU Chang created THRIFT-3473:


 Summary: C++ server cannot correctly return a struct/object 
contains list
 Key: THRIFT-3473
 URL: https://issues.apache.org/jira/browse/THRIFT-3473
 Project: Thrift
  Issue Type: Bug
  Components: C++ - Library
Affects Versions: 0.9.3
 Environment: CentOS 7, GCC 4.8.3, Perl 5.16
Reporter: YU Chang


When a struct/object contains list, the thrift C++ server always return 
null/undef.

Here is my thrift file:

namespace cpp WordAligner
namespace perl WordAligner

struct AlignParamter {
1: string srcLang,
2: string tarLang,
3: optional i32 nBestSize = 1,
}

struct SentenPair {
1: string srcSenten,
2: string tarSenten,
}

struct AlignPair {
1: optional string srcWord,
2: optional string tarWord,
}

struct AlignResult {
1: i32 resultCode,
2: string resultMessage,
3: optional list nBestAlignPairList,
}

service WordAlignService {
AlignResult alignOnePair(1: AlignParamter alignParamter, 2: SentenPair 
sentenPair),
list alignPairList(1: AlignParamter alignParamter, 2: 
list sentenPairList)
}

Here is my C++ code (server):

#include 
#include 
#include 
#include 

#include "thrift/WordAlignService.h"

#include 
#include 

using namespace std;
using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;

using boost::shared_ptr;

using namespace  ::WordAligner;

class WordAlignServiceHandler : virtual public WordAlignServiceIf {
public:
WordAlignServiceHandler() {
}

void alignOnePair(AlignResult& _return, const AlignParamter& 
alignParamter, const SentenPair& sentenPair) {
_return.resultCode = 0;
_return.resultMessage = "Success";
AlignPair alignPair;
alignPair.srcWord = "中国";
alignPair.tarWord = "china";
vector alignPairVec;
alignPairVec.push_back(alignPair);
_return.nBestAlignPairList.push_back(alignPairVec);
cout << "nBestAlignPairList size: " << 
_return.nBestAlignPairList.size() << endl;
cout << "src word: " << _return.nBestAlignPairList[0][0].srcWord << 
endl;
cout << "tar word: " << _return.nBestAlignPairList[0][0].tarWord << 
endl;
}

void alignPairList(std::vector & _return, const 
AlignParamter& alignParamter, const std::vector & sentenPairList) {
// Your implementation goes here
printf("alignPairList\n");
}

};

int main(int argc, char **argv) {
int port = 9595;
shared_ptr handler(new WordAlignServiceHandler());
shared_ptr processor(new WordAlignServiceProcessor(handler));
shared_ptr serverTransport(new TServerSocket(port));
shared_ptr transportFactory(new 
TBufferedTransportFactory());
shared_ptr protocolFactory(new TBinaryProtocolFactory());

TSimpleServer server(processor, serverTransport, transportFactory, 
protocolFactory);
server.serve();
return 0;
}

Here is my perl code (client):

#!/usr/bin/perl

use v5.12;
use warnings;
use autodie;

use utf8;
use Data::Dumper;

use lib 'gen-perl-wordalign';

use WordAligner::WordAlignService;
use WordAligner::Constants;
use WordAligner::Types;

use Thrift;
use Thrift::BinaryProtocol;
use Thrift::Socket;
use Thrift::BufferedTransport;


my $socket= new Thrift::Socket('localhost', 9595);
my $transport = new Thrift::BufferedTransport($socket, 1024, 1024);
my $protocol  = new Thrift::BinaryProtocol($transport);
my $client= new WordAligner::WordAlignServiceClient($protocol);

my $align_param = new WordAligner::AlignParamter;
$align_param->srcLang('zh-CN');
$align_param->tarLang('en');

my $src_senten = "中国 政府 高度 重视 经济 发展 。";
my $tar_senten = "china 's government attached great importance to economic 
development .";

my $senten_pair = new WordAligner::SentenPair;
$senten_pair->srcSenten($src_senten);
$senten_pair->tarSenten($tar_senten);

eval {
$transport->open();
my $result = $client->alignOnePair($align_param, $senten_pair);
say Dumper($result);
$transport->close();
};
say $@ if $@;

C++ server output:

nBestAlignPairList size: 1
src word: 中国
tar word: china

perl client output:

$VAR1 = bless( {
 'resultMessage' => 'Success',
 'resultCode' => 0,
 'nBestAlignPairList' => undef
   }, 'WordAligner::AlignResult' );

For solving this problem, I have already tried to:

1) return just one level list, not list of list;
2) using C++ client to test;
3) upgrade thrift version from 0.9.1 to 0.9.3;

But nothing help, the return list is still empty.



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


[jira] [Commented] (THRIFT-3452) .travis.yml: Migrating from legacy to container-based infrastructure

2015-12-04 Thread Hudson (JIRA)

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

Hudson commented on THRIFT-3452:


SUCCESS: Integrated in Thrift #1757 (See 
[https://builds.apache.org/job/Thrift/1757/])
THRIFT-3452 .travis.yml: Migrating from legacy to container-based (nsuke: rev 
a6ab1f5e6d8c5f8c64d356d72993a423cc2bf588)
* test/rb/integration/TestClient.rb
* build/docker/centos/scripts/keepit
* build/docker/ubuntu/scripts/dpkg.sh
* test/crossrunner/run.py
* build/docker/ubuntu/Dockerfile
* build/docker/scripts/cmake.sh
* build/docker/scripts/cross-test.sh
* test/dart/test_client/bin/main.dart
* .travis.yml
* test/crossrunner/test.py
* build/docker/centos/Dockerfile
* test/crossrunner/prepare.py
* test/known_failures_Linux.json
* build/docker/scripts/autotools.sh
* test/crossrunner/collect.py
* test/crossrunner/compat.py
* build/docker/README.md
* test/tests.json
* test/crossrunner/report.py
* test/crossrunner/__init__.py
* build/docker/scripts/make-dist.sh
* debian/control
* debian/rules


> .travis.yml: Migrating from legacy to container-based infrastructure
> 
>
> Key: THRIFT-3452
> URL: https://issues.apache.org/jira/browse/THRIFT-3452
> Project: Thrift
>  Issue Type: Bug
>Reporter: Roger Meier
>Assignee: Roger Meier
>
> I've started to work on this:
> https://docs.travis-ci.com/user/migrating-from-legacy/



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


[jira] [Updated] (THRIFT-3473) C++ server cannot correctly return a struct/object contains list

2015-12-04 Thread YU Chang (JIRA)

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

YU Chang updated THRIFT-3473:
-
Description: 
When a struct/object contains list, the thrift C++ server always return 
null/undef.

Here is my thrift file:

namespace cpp WordAligner
namespace perl WordAligner

struct AlignParamter {
1: string srcLang,
2: string tarLang,
3: optional i32 nBestSize = 1,
}

struct SentenPair {
1: string srcSenten,
2: string tarSenten,
}

struct AlignPair {
1: optional string srcWord,
2: optional string tarWord,
}

struct AlignResult {
1: i32 resultCode,
2: string resultMessage,
3: optional list nBestAlignPairList,
}

service WordAlignService {
AlignResult alignOnePair(1: AlignParamter alignParamter, 2: SentenPair 
sentenPair),
list alignPairList(1: AlignParamter alignParamter, 2: 
list sentenPairList)
}


Here is my C++ code (server):

#include 
#include 
#include 
#include 

#include "thrift/WordAlignService.h"

#include 
#include 

using namespace std;
using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;

using boost::shared_ptr;

using namespace  ::WordAligner;

class WordAlignServiceHandler : virtual public WordAlignServiceIf {
public:
WordAlignServiceHandler() {
}

void alignOnePair(AlignResult& _return, const AlignParamter& 
alignParamter, const SentenPair& sentenPair) {
_return.resultCode = 0;
_return.resultMessage = "Success";
AlignPair alignPair;
alignPair.srcWord = "中国";
alignPair.tarWord = "china";
vector alignPairVec;
alignPairVec.push_back(alignPair);
_return.nBestAlignPairList.push_back(alignPairVec);
cout << "nBestAlignPairList size: " << 
_return.nBestAlignPairList.size() << endl;
cout << "src word: " << _return.nBestAlignPairList[0][0].srcWord << 
endl;
cout << "tar word: " << _return.nBestAlignPairList[0][0].tarWord << 
endl;
}

void alignPairList(std::vector & _return, const 
AlignParamter& alignParamter, const std::vector & sentenPairList) {
// Your implementation goes here
printf("alignPairList\n");
}

};

int main(int argc, char **argv) {
int port = 9595;
shared_ptr handler(new WordAlignServiceHandler());
shared_ptr processor(new WordAlignServiceProcessor(handler));
shared_ptr serverTransport(new TServerSocket(port));
shared_ptr transportFactory(new 
TBufferedTransportFactory());
shared_ptr protocolFactory(new TBinaryProtocolFactory());

TSimpleServer server(processor, serverTransport, transportFactory, 
protocolFactory);
server.serve();
return 0;
}

Here is my perl code (client):

#!/usr/bin/perl

use v5.12;
use warnings;
use autodie;

use utf8;
use Data::Dumper;

use lib 'gen-perl-wordalign';

use WordAligner::WordAlignService;
use WordAligner::Constants;
use WordAligner::Types;

use Thrift;
use Thrift::BinaryProtocol;
use Thrift::Socket;
use Thrift::BufferedTransport;


my $socket= new Thrift::Socket('localhost', 9595);
my $transport = new Thrift::BufferedTransport($socket, 1024, 1024);
my $protocol  = new Thrift::BinaryProtocol($transport);
my $client= new WordAligner::WordAlignServiceClient($protocol);

my $align_param = new WordAligner::AlignParamter;
$align_param->srcLang('zh-CN');
$align_param->tarLang('en');

my $src_senten = "中国 政府 高度 重视 经济 发展 。";
my $tar_senten = "china 's government attached great importance to economic 
development .";

my $senten_pair = new WordAligner::SentenPair;
$senten_pair->srcSenten($src_senten);
$senten_pair->tarSenten($tar_senten);

eval {
$transport->open();
my $result = $client->alignOnePair($align_param, $senten_pair);
say Dumper($result);
$transport->close();
};
say $@ if $@;

C++ server output:

nBestAlignPairList size: 1
src word: 中国
tar word: china

perl client output:

$VAR1 = bless( {
 'resultMessage' => 'Success',
 'resultCode' => 0,
 'nBestAlignPairList' => undef
   }, 'WordAligner::AlignResult' );

For solving this problem, I have already tried to:

1) return just one level list, not list of list;
2) using C++ client to test;
3) upgrade thrift version from 0.9.1 to 0.9.3;

But nothing help, the return list is still empty.

  was:
When a struct/object contains list, the thrift C++ server always return 
null/undef.

Here is my thrift file:
{quote}
namespace cpp WordAligner
namespace perl WordAligner

struct AlignParamter {
1: string srcLang,
2: string tarLang,
3: optional i32 nBestSize = 1,
}

struct SentenPair {
1: string srcSenten,
2: string tarSenten,
}

struct AlignPair {
1: optional string srcWord,
2: optional string tarWord,
}


[jira] [Updated] (THRIFT-3473) C++ server cannot correctly return a struct/object contains list

2015-12-04 Thread YU Chang (JIRA)

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

YU Chang updated THRIFT-3473:
-
Description: 
When a struct/object contains list, the thrift C++ server always return 
null/undef.

Here is my thrift file:

namespace cpp WordAligner
namespace perl WordAligner

struct AlignParamter { \\
1: string srcLang,
2: string tarLang,
3: optional i32 nBestSize = 1,
}\\

struct SentenPair {\\
1: string srcSenten,
2: string tarSenten,
}\\

struct AlignPair {\\
1: optional string srcWord,
2: optional string tarWord,
}\\

struct AlignResult {\\
1: i32 resultCode,
2: string resultMessage,
3: optional list nBestAlignPairList,
}\\

service WordAlignService {\\
AlignResult alignOnePair(1: AlignParamter alignParamter, 2: SentenPair 
sentenPair),
list alignPairList(1: AlignParamter alignParamter, 2: 
list sentenPairList)
}\\


Here is my C++ code (server):

#include 
#include 
#include 
#include 

#include "thrift/WordAlignService.h"

#include 
#include 

using namespace std;
using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;

using boost::shared_ptr;

using namespace  ::WordAligner;

class WordAlignServiceHandler : virtual public WordAlignServiceIf {
public:
WordAlignServiceHandler() {
}

void alignOnePair(AlignResult& _return, const AlignParamter& 
alignParamter, const SentenPair& sentenPair) {
_return.resultCode = 0;
_return.resultMessage = "Success";
AlignPair alignPair;
alignPair.srcWord = "中国";
alignPair.tarWord = "china";
vector alignPairVec;
alignPairVec.push_back(alignPair);
_return.nBestAlignPairList.push_back(alignPairVec);
cout << "nBestAlignPairList size: " << 
_return.nBestAlignPairList.size() << endl;
cout << "src word: " << _return.nBestAlignPairList[0][0].srcWord << 
endl;
cout << "tar word: " << _return.nBestAlignPairList[0][0].tarWord << 
endl;
}

void alignPairList(std::vector & _return, const 
AlignParamter& alignParamter, const std::vector & sentenPairList) {
// Your implementation goes here
printf("alignPairList\n");
}

};

int main(int argc, char **argv) {
int port = 9595;
shared_ptr handler(new WordAlignServiceHandler());
shared_ptr processor(new WordAlignServiceProcessor(handler));
shared_ptr serverTransport(new TServerSocket(port));
shared_ptr transportFactory(new 
TBufferedTransportFactory());
shared_ptr protocolFactory(new TBinaryProtocolFactory());

TSimpleServer server(processor, serverTransport, transportFactory, 
protocolFactory);
server.serve();
return 0;
}

Here is my perl code (client):

#!/usr/bin/perl

use v5.12;
use warnings;
use autodie;

use utf8;
use Data::Dumper;

use lib 'gen-perl-wordalign';

use WordAligner::WordAlignService;
use WordAligner::Constants;
use WordAligner::Types;

use Thrift;
use Thrift::BinaryProtocol;
use Thrift::Socket;
use Thrift::BufferedTransport;


my $socket= new Thrift::Socket('localhost', 9595);
my $transport = new Thrift::BufferedTransport($socket, 1024, 1024);
my $protocol  = new Thrift::BinaryProtocol($transport);
my $client= new WordAligner::WordAlignServiceClient($protocol);

my $align_param = new WordAligner::AlignParamter;
$align_param->srcLang('zh-CN');
$align_param->tarLang('en');

my $src_senten = "中国 政府 高度 重视 经济 发展 。";
my $tar_senten = "china 's government attached great importance to economic 
development .";

my $senten_pair = new WordAligner::SentenPair;
$senten_pair->srcSenten($src_senten);
$senten_pair->tarSenten($tar_senten);

eval {
$transport->open();
my $result = $client->alignOnePair($align_param, $senten_pair);
say Dumper($result);
$transport->close();
};
say $@ if $@;

C++ server output:

nBestAlignPairList size: 1
src word: 中国
tar word: china

perl client output:

$VAR1 = bless( {
 'resultMessage' => 'Success',
 'resultCode' => 0,
 'nBestAlignPairList' => undef
   }, 'WordAligner::AlignResult' );

For solving this problem, I have already tried to:

1) return just one level list, not list of list;
2) using C++ client to test;
3) upgrade thrift version from 0.9.1 to 0.9.3;

But nothing help, the return list is still empty.

  was:
When a struct/object contains list, the thrift C++ server always return 
null/undef.

Here is my thrift file:

namespace cpp WordAligner
namespace perl WordAligner

struct AlignParamter {
1: string srcLang,
2: string tarLang,
3: optional i32 nBestSize = 1,
}

struct SentenPair {
1: string srcSenten,
2: string tarSenten,
}

struct AlignPair {
1: optional string srcWord,
2: optional string 

[jira] [Updated] (THRIFT-3473) C++ server cannot correctly return a struct/object contains list

2015-12-04 Thread YU Chang (JIRA)

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

YU Chang updated THRIFT-3473:
-
Description: 
When a struct/object contains list, the thrift C++ server always return 
null/undef.

Here is my thrift file:
{code:title=WordAligner.thrift|borderStyle=solid}
namespace cpp WordAligner
namespace perl WordAligner

struct AlignParamter { 
1: string srcLang,
2: string tarLang,
3: optional i32 nBestSize = 1,
}

struct SentenPair {
1: string srcSenten,
2: string tarSenten,
}

struct AlignPair {
1: optional string srcWord,
2: optional string tarWord,
}

struct AlignResult {
1: i32 resultCode,
2: string resultMessage,
3: optional list nBestAlignPairList,
}

service WordAlignService {
AlignResult alignOnePair(1: AlignParamter alignParamter, 2: SentenPair 
sentenPair),
list alignPairList(1: AlignParamter alignParamter, 2: 
list sentenPairList)
}
{code}

Here is my C++ code (server):
{code:title=WordAlignerServer.cpp|borderStyle=solid}
#include 
#include 
#include 
#include 

#include "thrift/WordAlignService.h"

#include 
#include 

using namespace std;
using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;

using boost::shared_ptr;

using namespace  ::WordAligner;

class WordAlignServiceHandler : virtual public WordAlignServiceIf {
public:
WordAlignServiceHandler() {
}

void alignOnePair(AlignResult& _return, const AlignParamter& 
alignParamter, const SentenPair& sentenPair) {
_return.resultCode = 0;
_return.resultMessage = "Success";
AlignPair alignPair;
alignPair.srcWord = "中国";
alignPair.tarWord = "china";
vector alignPairVec;
alignPairVec.push_back(alignPair);
_return.nBestAlignPairList.push_back(alignPairVec);
cout << "nBestAlignPairList size: " << 
_return.nBestAlignPairList.size() << endl;
cout << "src word: " << _return.nBestAlignPairList[0][0].srcWord << 
endl;
cout << "tar word: " << _return.nBestAlignPairList[0][0].tarWord << 
endl;
}

void alignPairList(std::vector & _return, const 
AlignParamter& alignParamter, const std::vector & sentenPairList) {
// Your implementation goes here
printf("alignPairList\n");
}

};

int main(int argc, char **argv) {
int port = 9595;
shared_ptr handler(new WordAlignServiceHandler());
shared_ptr processor(new WordAlignServiceProcessor(handler));
shared_ptr serverTransport(new TServerSocket(port));
shared_ptr transportFactory(new 
TBufferedTransportFactory());
shared_ptr protocolFactory(new TBinaryProtocolFactory());

TSimpleServer server(processor, serverTransport, transportFactory, 
protocolFactory);
server.serve();
return 0;
}
{code}


Here is my perl code (client):
{code:title=WordAlignerClient.pl|borderStyle=solid}
#!/usr/bin/perl

use v5.12;
use warnings;
use autodie;

use utf8;
use Data::Dumper;

use lib 'gen-perl-wordalign';

use WordAligner::WordAlignService;
use WordAligner::Constants;
use WordAligner::Types;

use Thrift;
use Thrift::BinaryProtocol;
use Thrift::Socket;
use Thrift::BufferedTransport;


my $socket= new Thrift::Socket('localhost', 9595);
my $transport = new Thrift::BufferedTransport($socket, 1024, 1024);
my $protocol  = new Thrift::BinaryProtocol($transport);
my $client= new WordAligner::WordAlignServiceClient($protocol);

my $align_param = new WordAligner::AlignParamter;
$align_param->srcLang('zh-CN');
$align_param->tarLang('en');

my $src_senten = "中国 政府 高度 重视 经济 发展 。";
my $tar_senten = "china 's government attached great importance to economic 
development .";

my $senten_pair = new WordAligner::SentenPair;
$senten_pair->srcSenten($src_senten);
$senten_pair->tarSenten($tar_senten);

eval {
$transport->open();
my $result = $client->alignOnePair($align_param, $senten_pair);
say Dumper($result);
$transport->close();
};
say $@ if $@;
{code}

C++ server output:

nBestAlignPairList size: 1
src word: 中国
tar word: china

perl client output:

$VAR1 = bless( {
 'resultMessage' => 'Success',
 'resultCode' => 0,
 'nBestAlignPairList' => undef
   }, 'WordAligner::AlignResult' );

For solving this problem, I have already tried to:

1) return just one level list, not list of list;
2) using C++ client to test;
3) upgrade thrift version from 0.9.1 to 0.9.3;

But nothing help, the return list is still empty.

  was:
When a struct/object contains list, the thrift C++ server always return 
null/undef.

Here is my thrift file:
{code:title=WordAligner.thrift|borderStyle=solid}
namespace cpp WordAligner
namespace perl WordAligner

struct AlignParamter { 
1: string srcLang,

[jira] [Updated] (THRIFT-3464) Fix several defects in c_glib code generator

2015-12-04 Thread Aki Sukegawa (JIRA)

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

Aki Sukegawa updated THRIFT-3464:
-
Description: 
* serialize/deserializing empty binary fields caused SegFault
* serialize/deserializing list caused SegFault
* some service method arguments were not freed
* const for struct and containers was unfinished and broken
* map/set of int8/int16 caused invalid memory access and incorrect key 
hash/equality
-container of enum element was using enum value as pointer, making it unusable-

The statement about enum map/set was incorrect.
It is inconsitent with the others and can be dangerous in this regard, but 
actually usable as is.
So I removed that part of the change from the patch.


  was:
* serialize/deserializing empty binary fields caused SegFault
* const for struct and containers was unfinished and broken
* map/set of int8/int16 caused invalid memory access and incorrect key 
hash/equality
* container of enum element was using enum value as pointer, making it unusable



> Fix several defects in c_glib code generator
> 
>
> Key: THRIFT-3464
> URL: https://issues.apache.org/jira/browse/THRIFT-3464
> Project: Thrift
>  Issue Type: Bug
>  Components: C glib - Compiler, C glib - Library
>Reporter: Aki Sukegawa
>Assignee: Aki Sukegawa
>
> * serialize/deserializing empty binary fields caused SegFault
> * serialize/deserializing list caused SegFault
> * some service method arguments were not freed
> * const for struct and containers was unfinished and broken
> * map/set of int8/int16 caused invalid memory access and incorrect key 
> hash/equality
> -container of enum element was using enum value as pointer, making it 
> unusable-
> The statement about enum map/set was incorrect.
> It is inconsitent with the others and can be dangerous in this regard, but 
> actually usable as is.
> So I removed that part of the change from the patch.



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


[GitHub] thrift pull request: THRIFT-2898: Generated classes implement the ...

2015-12-04 Thread chefnobody
Github user chefnobody commented on the pull request:

https://github.com/apache/thrift/pull/327#issuecomment-162036150
  
+1


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (THRIFT-2898) Generate -copyWithZone: method (NSCopying protocol)

2015-12-04 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on THRIFT-2898:


Github user chefnobody commented on the pull request:

https://github.com/apache/thrift/pull/327#issuecomment-162036150
  
+1


> Generate -copyWithZone: method (NSCopying protocol)
> ---
>
> Key: THRIFT-2898
> URL: https://issues.apache.org/jira/browse/THRIFT-2898
> Project: Thrift
>  Issue Type: Improvement
>  Components: Cocoa - Compiler
>Reporter: Jim Speth
>Priority: Minor
>
> There should be an option to implement the NSCopying protocol and implement 
> the -copyWithZone: method in generated classes.



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


[jira] [Closed] (THRIFT-2143) Generated Ruby client doesn't handle enums

2015-12-04 Thread Carl Hall (JIRA)

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

Carl Hall closed THRIFT-2143.
-
Resolution: Cannot Reproduce

Closing since this appears to be related to Finagle rather than purely Thrift.

> Generated Ruby client doesn't handle enums
> --
>
> Key: THRIFT-2143
> URL: https://issues.apache.org/jira/browse/THRIFT-2143
> Project: Thrift
>  Issue Type: Bug
>  Components: Ruby - Compiler
>Affects Versions: 0.9, 0.9.1
>Reporter: Carl Hall
> Attachments: thrift-2143.diff
>
>
> The generated ruby client includes and uses enums but doesn't send or receive 
> them correctly. They go out as i32 and are expected to be received as i32. 
> While this is the underlying data type, it breaks things that expect the enum 
> to come through.



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


[jira] [Commented] (THRIFT-2143) Generated Ruby client doesn't handle enums

2015-12-04 Thread Carl Hall (JIRA)

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

Carl Hall commented on THRIFT-2143:
---

I tested this in a pure Thrift project and was unable to recreate it.  The 
problem must be with how Twitter's Finagle handles things.  I can use the patch 
locally.  Sorry for the noise and thanks for looking into things.

> Generated Ruby client doesn't handle enums
> --
>
> Key: THRIFT-2143
> URL: https://issues.apache.org/jira/browse/THRIFT-2143
> Project: Thrift
>  Issue Type: Bug
>  Components: Ruby - Compiler
>Affects Versions: 0.9, 0.9.1
>Reporter: Carl Hall
> Attachments: thrift-2143.diff
>
>
> The generated ruby client includes and uses enums but doesn't send or receive 
> them correctly. They go out as i32 and are expected to be received as i32. 
> While this is the underlying data type, it breaks things that expect the enum 
> to come through.



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