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

Colin Patrick McCabe commented on HTRACE-101:
---------------------------------------------

Thanks for the reviews, guys.  Much appreciated.

bq. Samarth wrote: For the places at which you are throwing 
Tracer.clientError(), I would advocate for resetting the thread local storing 
the current span by doing Tracer.continueSpan(null). In case of such errors, we 
should be safe and reset the thread local. Otherwise it would still result in 
potentially catastrophic conditions like the one we addressed in PHOENIX-1596. 
What do you think?

The problem is, even if we do that, all the subsequent {{TraceScope#close}} 
calls will fail.  The reason is because the {{currentSpan}} will be {{null}}, 
rather than whatever it should be, and our {{TraceScope#close}} call now has 
code to check this.

I think that in general, this code is here to make it really, really obvious 
when the client has a problem.  So obvious that hopefully client code with 
problems won't get checked in!  But I don't think we can or should do a lot to 
recover from the problems.  In general, we may not be able to because we can't 
figure out what the programmer "meant," especially when passing spans between 
threads are involved.

I'll commit this tomorrow (or maybe monday) if there's no more comments, we can 
always tweak it if we figure out ways to make it better.  Have a good weekend 
guys!

> Add better error-checking to Java HTrace client
> -----------------------------------------------
>
>                 Key: HTRACE-101
>                 URL: https://issues.apache.org/jira/browse/HTRACE-101
>             Project: HTrace
>          Issue Type: Bug
>            Reporter: Colin Patrick McCabe
>            Assignee: Colin Patrick McCabe
>         Attachments: HTRACE-101.001.patch
>
>
> The Java HTrace client should have better error-checking.  This will make it 
> easier for applications to use the API correctly



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

Reply via email to