[
https://issues.apache.org/jira/browse/HDFS-10785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16023083#comment-16023083
]
James Clampffer commented on HDFS-10785:
----------------------------------------
That failure is surprising. I'm going to try and resubmit a patch to
HDFS-11544 just to see if it has any problems downloading jdk1.7 there. I
think the patch looks good otherwise.
Only follow up comment:
{quote}
Actually, it this situation I don't think the code has a race condition. We
first pass the promise to the handler by reference, and block until it is set.
The function that will use this handler (either GetListing or Find) guarantees
that the handler will only be called once at a time (there is locking in place
for that). The function also guarantees that the handler will be called only
once with the exit status set (meaning has_more_results set to false),
therefore it is impossible for the promise to be set twice or referenced when
it was deallocated from stack. Therefore I think this code is safe, and adding
a shared pointer would add unnecessary overhead. I did also test it with
multiple threads and never got an issue.
{quote}
Yes, I agree that the code is safe as you've written it since you have that
mutex on the queue. My concern is more that the way that mutex makes it safe
may not be obvious particularly in regard to the promise/future race since it's
a stack unwinding race that sort of looks like a data race (HDFS-11556).
Unless someone really digs through the task queue implementation,
promise/future spec and implementation, and understands RAII it's really easy
to introduce bugs with a similar pattern. Even with that understanding it's
easy to introduce those sorts of bugs so if it's simple to avoid that sort of
stuff in tools and examples that ship with the library I think it's best to do
so. That pattern has been around for a while before this patch so I think it'd
be more useful to get your tools in and then follow up on that later on.
> libhdfs++: Implement the rest of the tools
> ------------------------------------------
>
> Key: HDFS-10785
> URL: https://issues.apache.org/jira/browse/HDFS-10785
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Components: hdfs-client
> Reporter: Anatoli Shein
> Assignee: Anatoli Shein
> Attachments: HDFS-10785.HDFS-8707.000.patch,
> HDFS-10785.HDFS-8707.001.patch, HDFS-10785.HDFS-8707.002.patch,
> HDFS-10785.HDFS-8707.003.patch, HDFS-10785.HDFS-8707.004.patch,
> HDFS-10785.HDFS-8707.005.patch, HDFS-10785.HDFS-8707.006.patch,
> HDFS-10785.HDFS-8707.007.patch, HDFS-10785.HDFS-8707.008.patch,
> HDFS-10785.HDFS-8707.009.patch, HDFS-10785.HDFS-8707.010.patch
>
>
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]