[jira] [Commented] (THRIFT-4251) Epoll Selector Bug

2017-07-24 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on THRIFT-4251:


GitHub user Johnny-Liao opened a pull request:

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

THRIFT-4251 Fix JDK Epoll Bug in Thrift of TThreadedSelectorServer model.

Such as the title. More information see : 
https://issues.apache.org/jira/browse/THRIFT-4251

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

$ git pull https://github.com/Johnny-Liao/thrift THRIFT-4251

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

https://github.com/apache/thrift/pull/1313.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 #1313


commit 4dc1eb98e4b750a25ba0ed64c207fd64f24a7f31
Author: Johnny-Liao <1020157***@qq.com>
Date:   2017-07-25T06:23:28Z

THRIFT-4251 Fix JDK Epoll Bug in Thrift of TThreadedSelectorServer model.




> Epoll Selector Bug
> --
>
> Key: THRIFT-4251
> URL: https://issues.apache.org/jira/browse/THRIFT-4251
> Project: Thrift
>  Issue Type: Bug
>  Components: Java - Compiler, Java - Library
>Affects Versions: 0.10.0
> Environment: Linux version 3.10.0-327.el7.x86_64 
> (buil...@kbuilder.dev.centos.org)
> java version "1.8.0_131"
>Reporter: JohnnyLiao
>  Labels: epoll, jdk, selector
>
> Thrift java unsolve the infamous epoll bug. It's consum 100% cpu resource 
> when this occured. It seems to affect any NIO based Java server applications 
> running in the specified environment. Some projects provide workarounds for 
> similar JDK bugs, for example replaces the current Selector of this 
> SelectorThread.select with newly created Selector.
> Stack Traceļ¼š
> "Thread-46" #95 prio=5 os_prio=0 tid=0x7fc79cd02800 nid=0xb1 runnable 
> [0x7fc580bd1000]
>java.lang.Thread.State: RUNNABLE
> at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
> at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:269)
> at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:93)
> at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86)
> - locked <0x8012f748> (a sun.nio.ch.Util$3)
> - locked <0x8012f738> (a 
> java.util.Collections$UnmodifiableSet)
> - locked <0x80120f58> (a sun.nio.ch.EPollSelectorImpl)
> at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97)
> at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:101)
> at 
> org.apache.thrift.server.TThreadedSelectorServer$SelectorThread.select(TThreadedSelectorServer.java:570)
> at 
> org.apache.thrift.server.TThreadedSelectorServer$SelectorThread.run(TThreadedSelectorServer.java:541)



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


[GitHub] thrift pull request #1313: THRIFT-4251 Fix JDK Epoll Bug in Thrift of TThrea...

2017-07-24 Thread Johnny-Liao
GitHub user Johnny-Liao opened a pull request:

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

THRIFT-4251 Fix JDK Epoll Bug in Thrift of TThreadedSelectorServer model.

Such as the title. More information see : 
https://issues.apache.org/jira/browse/THRIFT-4251

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

$ git pull https://github.com/Johnny-Liao/thrift THRIFT-4251

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

https://github.com/apache/thrift/pull/1313.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 #1313


commit 4dc1eb98e4b750a25ba0ed64c207fd64f24a7f31
Author: Johnny-Liao <1020157***@qq.com>
Date:   2017-07-25T06:23:28Z

THRIFT-4251 Fix JDK Epoll Bug in Thrift of TThreadedSelectorServer model.




---
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] [Resolved] (THRIFT-4260) Go context generation issue. Context is parameter in Interface not in implementation

2017-07-24 Thread Jens Geyer (JIRA)

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

Jens Geyer resolved THRIFT-4260.

   Resolution: Fixed
Fix Version/s: 0.11.0

Commited, thanks!

> Go context generation issue. Context is parameter in Interface not in 
> implementation
> 
>
> Key: THRIFT-4260
> URL: https://issues.apache.org/jira/browse/THRIFT-4260
> Project: Thrift
>  Issue Type: Bug
>  Components: Go - Compiler
>Affects Versions: 0.11.0
>Reporter: Bas van Beek
>Assignee: taozle
>Priority: Blocker
> Fix For: 0.11.0
>
>
> Unfortunately the Go library was updated before a new Compiler was released. 
> Having thrift compiled code be part in a project prior to the thrift context 
> library addition breaks due to the dependency on the thrift go library. See: 
> https://github.com/openzipkin/zipkin-go-opentracing/issues/68
> I tried to resolve be installing compiler from latest source but found the 
> generated source to be incorrect. The generated Go interface for the service 
> client includes context.Context as the first parameter of the service method. 
> The generated client implementation however does not.
> The following thrift code:
> {code:none}
> enum ResultCode
> {
>   OK,
>   TRY_LATER
> }
> struct LogEntry
> {
>   1:  string category,
>   2:  string message
> }
> service Scribe
> {
>   ResultCode Log(1: list messages);
> }
> {code}
> Generated the following Go code:
> {code:none}
> type Scribe interface {
>   // Parameters:
>   //  - Messages
>   Log(ctx context.Context, messages []*LogEntry) (r ResultCode, err error)
> }
> ...
> // Parameters:
> //  - Messages
> func (p *ScribeClient) Log(messages []*LogEntry) (r ResultCode, err error) {
>   if err = p.sendLog(messages); err != nil {
>   return
>   }
>   return p.recvLog()
> }
> {code}



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


[jira] [Commented] (THRIFT-4260) Go context generation issue. Context is parameter in Interface not in implementation

2017-07-24 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on THRIFT-4260:


Github user asfgit closed the pull request at:

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


> Go context generation issue. Context is parameter in Interface not in 
> implementation
> 
>
> Key: THRIFT-4260
> URL: https://issues.apache.org/jira/browse/THRIFT-4260
> Project: Thrift
>  Issue Type: Bug
>  Components: Go - Compiler
>Affects Versions: 0.11.0
>Reporter: Bas van Beek
>Assignee: taozle
>Priority: Blocker
>
> Unfortunately the Go library was updated before a new Compiler was released. 
> Having thrift compiled code be part in a project prior to the thrift context 
> library addition breaks due to the dependency on the thrift go library. See: 
> https://github.com/openzipkin/zipkin-go-opentracing/issues/68
> I tried to resolve be installing compiler from latest source but found the 
> generated source to be incorrect. The generated Go interface for the service 
> client includes context.Context as the first parameter of the service method. 
> The generated client implementation however does not.
> The following thrift code:
> {code:none}
> enum ResultCode
> {
>   OK,
>   TRY_LATER
> }
> struct LogEntry
> {
>   1:  string category,
>   2:  string message
> }
> service Scribe
> {
>   ResultCode Log(1: list messages);
> }
> {code}
> Generated the following Go code:
> {code:none}
> type Scribe interface {
>   // Parameters:
>   //  - Messages
>   Log(ctx context.Context, messages []*LogEntry) (r ResultCode, err error)
> }
> ...
> // Parameters:
> //  - Messages
> func (p *ScribeClient) Log(messages []*LogEntry) (r ResultCode, err error) {
>   if err = p.sendLog(messages); err != nil {
>   return
>   }
>   return p.recvLog()
> }
> {code}



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


[GitHub] thrift pull request #1312: THRIFT-4260: Add context as first arg for client ...

2017-07-24 Thread asfgit
Github user asfgit closed the pull request at:

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


---
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 #1311: Fix for constant assignments to optional fields i...

2017-07-24 Thread davinchia
Github user davinchia commented on a diff in the pull request:

https://github.com/apache/thrift/pull/1311#discussion_r129124617
  
--- Diff: compiler/cpp/src/thrift/generate/t_go_generator.cc ---
@@ -424,6 +424,52 @@ bool t_go_generator::is_pointer_field(t_field* tfield, 
bool in_container_value)
   throw "INVALID TYPE IN type_to_go_type: " + type->get_name();
 }
 
+string t_go_generator::gen_opt_const_values_(t_base_type::t_base tbase, 
t_const_value *value) {
+  string go_value_str = "&(&struct{x ";
+  switch (tbase) {
+case t_base_type::TYPE_BOOL:
+  go_value_str += "bool}{";
+  go_value_str += (value->get_integer() > 0 ? "true" : "false");
+  break;
+
+case t_base_type::TYPE_I8:
+  go_value_str += "int8}{";
+  go_value_str += std::to_string(static_cast(value->get_integer()));
+  break;
--- End diff --

a) The casts are to avoid the `ambiguous calls` errors I was seeing on the 
integration tests.
b) c) I separated the methods as I had mini unit tests on my machine. I 
left it this way since I felt the main method was getting slightly too long. 
Combining both methods will remove the casting problem and I have no strong 
opinions so I will do that instead. 


---
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-4260) Go context generation issue. Context is parameter in Interface not in implementation

2017-07-24 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on THRIFT-4260:


Github user dcelasun commented on the issue:

https://github.com/apache/thrift/pull/1312
  
LGTM (once again, travis failure is unrelated)


> Go context generation issue. Context is parameter in Interface not in 
> implementation
> 
>
> Key: THRIFT-4260
> URL: https://issues.apache.org/jira/browse/THRIFT-4260
> Project: Thrift
>  Issue Type: Bug
>  Components: Go - Compiler
>Affects Versions: 0.11.0
>Reporter: Bas van Beek
>Assignee: taozle
>Priority: Blocker
>
> Unfortunately the Go library was updated before a new Compiler was released. 
> Having thrift compiled code be part in a project prior to the thrift context 
> library addition breaks due to the dependency on the thrift go library. See: 
> https://github.com/openzipkin/zipkin-go-opentracing/issues/68
> I tried to resolve be installing compiler from latest source but found the 
> generated source to be incorrect. The generated Go interface for the service 
> client includes context.Context as the first parameter of the service method. 
> The generated client implementation however does not.
> The following thrift code:
> {code:none}
> enum ResultCode
> {
>   OK,
>   TRY_LATER
> }
> struct LogEntry
> {
>   1:  string category,
>   2:  string message
> }
> service Scribe
> {
>   ResultCode Log(1: list messages);
> }
> {code}
> Generated the following Go code:
> {code:none}
> type Scribe interface {
>   // Parameters:
>   //  - Messages
>   Log(ctx context.Context, messages []*LogEntry) (r ResultCode, err error)
> }
> ...
> // Parameters:
> //  - Messages
> func (p *ScribeClient) Log(messages []*LogEntry) (r ResultCode, err error) {
>   if err = p.sendLog(messages); err != nil {
>   return
>   }
>   return p.recvLog()
> }
> {code}



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


[GitHub] thrift issue #1312: THRIFT-4260: Add context as first arg for client method.

2017-07-24 Thread dcelasun
Github user dcelasun commented on the issue:

https://github.com/apache/thrift/pull/1312
  
LGTM (once again, travis failure is unrelated)


---
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 issue #1312: Add context as first arg for client method.

2017-07-24 Thread taozle
Github user taozle commented on the issue:

https://github.com/apache/thrift/pull/1312
  
@dcelasun @Jens-G PTAL


---
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-4260) Go context generation issue. Context is parameter in Interface not in implementation

2017-07-24 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on THRIFT-4260:


GitHub user taozle reopened a pull request:

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

Add context as first arg for client method.

Related: https://issues.apache.org/jira/browse/THRIFT-4260

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

$ git pull https://github.com/taozle/thrift client-context

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

https://github.com/apache/thrift/pull/1312.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 #1312


commit 202840379f99e5cdf786b1a4ac698b1cf40ede12
Author: taozle 
Date:   2017-07-23T13:21:44Z

Add context as first arg for client method.

commit 9ea932aac18735cdd0579b65b259a5b9162d5347
Author: taozle 
Date:   2017-07-23T17:44:28Z

Fix tests.

commit ab761b61a3b87affa5bead0d8ba662e2efdbafa3
Author: taozle 
Date:   2017-07-24T03:20:30Z

Fix tests.




> Go context generation issue. Context is parameter in Interface not in 
> implementation
> 
>
> Key: THRIFT-4260
> URL: https://issues.apache.org/jira/browse/THRIFT-4260
> Project: Thrift
>  Issue Type: Bug
>  Components: Go - Compiler
>Affects Versions: 0.11.0
>Reporter: Bas van Beek
>Assignee: taozle
>Priority: Blocker
>
> Unfortunately the Go library was updated before a new Compiler was released. 
> Having thrift compiled code be part in a project prior to the thrift context 
> library addition breaks due to the dependency on the thrift go library. See: 
> https://github.com/openzipkin/zipkin-go-opentracing/issues/68
> I tried to resolve be installing compiler from latest source but found the 
> generated source to be incorrect. The generated Go interface for the service 
> client includes context.Context as the first parameter of the service method. 
> The generated client implementation however does not.
> The following thrift code:
> {code:none}
> enum ResultCode
> {
>   OK,
>   TRY_LATER
> }
> struct LogEntry
> {
>   1:  string category,
>   2:  string message
> }
> service Scribe
> {
>   ResultCode Log(1: list messages);
> }
> {code}
> Generated the following Go code:
> {code:none}
> type Scribe interface {
>   // Parameters:
>   //  - Messages
>   Log(ctx context.Context, messages []*LogEntry) (r ResultCode, err error)
> }
> ...
> // Parameters:
> //  - Messages
> func (p *ScribeClient) Log(messages []*LogEntry) (r ResultCode, err error) {
>   if err = p.sendLog(messages); err != nil {
>   return
>   }
>   return p.recvLog()
> }
> {code}



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


[jira] [Commented] (THRIFT-4260) Go context generation issue. Context is parameter in Interface not in implementation

2017-07-24 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on THRIFT-4260:


Github user taozle closed the pull request at:

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


> Go context generation issue. Context is parameter in Interface not in 
> implementation
> 
>
> Key: THRIFT-4260
> URL: https://issues.apache.org/jira/browse/THRIFT-4260
> Project: Thrift
>  Issue Type: Bug
>  Components: Go - Compiler
>Affects Versions: 0.11.0
>Reporter: Bas van Beek
>Assignee: taozle
>Priority: Blocker
>
> Unfortunately the Go library was updated before a new Compiler was released. 
> Having thrift compiled code be part in a project prior to the thrift context 
> library addition breaks due to the dependency on the thrift go library. See: 
> https://github.com/openzipkin/zipkin-go-opentracing/issues/68
> I tried to resolve be installing compiler from latest source but found the 
> generated source to be incorrect. The generated Go interface for the service 
> client includes context.Context as the first parameter of the service method. 
> The generated client implementation however does not.
> The following thrift code:
> {code:none}
> enum ResultCode
> {
>   OK,
>   TRY_LATER
> }
> struct LogEntry
> {
>   1:  string category,
>   2:  string message
> }
> service Scribe
> {
>   ResultCode Log(1: list messages);
> }
> {code}
> Generated the following Go code:
> {code:none}
> type Scribe interface {
>   // Parameters:
>   //  - Messages
>   Log(ctx context.Context, messages []*LogEntry) (r ResultCode, err error)
> }
> ...
> // Parameters:
> //  - Messages
> func (p *ScribeClient) Log(messages []*LogEntry) (r ResultCode, err error) {
>   if err = p.sendLog(messages); err != nil {
>   return
>   }
>   return p.recvLog()
> }
> {code}



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


[GitHub] thrift pull request #1312: Add context as first arg for client method.

2017-07-24 Thread taozle
GitHub user taozle reopened a pull request:

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

Add context as first arg for client method.

Related: https://issues.apache.org/jira/browse/THRIFT-4260

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

$ git pull https://github.com/taozle/thrift client-context

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

https://github.com/apache/thrift/pull/1312.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 #1312


commit 202840379f99e5cdf786b1a4ac698b1cf40ede12
Author: taozle 
Date:   2017-07-23T13:21:44Z

Add context as first arg for client method.

commit 9ea932aac18735cdd0579b65b259a5b9162d5347
Author: taozle 
Date:   2017-07-23T17:44:28Z

Fix tests.

commit ab761b61a3b87affa5bead0d8ba662e2efdbafa3
Author: taozle 
Date:   2017-07-24T03:20:30Z

Fix tests.




---
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 #1312: Add context as first arg for client method.

2017-07-24 Thread taozle
Github user taozle closed the pull request at:

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


---
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.
---