You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by Abdel Hakim Deneche <ad...@maprtech.com> on 2016/04/07 09:29:44 UTC

Can this scenario cause a query to hang ?

So, we've been seeing some queries hang, I've come up with a possible
explanation, but so far it's really difficult to reproduce. Let me know if
you think this explanation doesn't hold up or if you have any ideas how we
can reproduce it. Thanks

- generally it's a CTAS running on a large cluster (lot's of writers
running in parallel)
- logs show that the user channel was closed and UserServer caused the root
fragment to move to a FAILED state [1]
- jstack shows that the root fragment is blocked in it's receiver waiting
for data [2]
- jstack also shows that ALL other fragments are no longer running, and the
logs show that all of them succeeded [3]
- the foreman waits *forever* for the root fragment to finish

[1] the only case I can think off is when the user channel closed while the
fragment was waiting for an ack from the user client
[2] if a writer finishes earlier than the others, it will send a data batch
to the root fragment that will be sent to the user. The root will then
immediately block on it's receiver waiting for the remaining writers to
finish
[3] once the root fragment moves to a failed state, the receiver will
immediately release any received batch and return an OK to the sender
without putting the batch in it's blocking queue.

Abdelhakim Deneche

Software Engineer

  <http://www.mapr.com/>


Now Available - Free Hadoop On-Demand Training
<http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available>

Re: Can this scenario cause a query to hang ?

Posted by Abdel Hakim Deneche <ad...@maprtech.com>.
There are many ways a query could hang. JStack of the foreman node will
definitely help confirm it's the same issue.

Thanks

On Fri, Apr 8, 2016 at 6:06 PM, François Méthot <fm...@gmail.com> wrote:

> It might just adds up to the mystery of this issue but when we start
> getting those hanging CTAS query,
> if we restart our drill cluster and the problem goes away.
>
> Next time we start getting this problem I will try to collect the JStack
> output of the foreman too.
>
> Thanks for looking into this.
>
> Francois
>
>
>
> On Fri, Apr 8, 2016 at 2:20 AM, Abdel Hakim Deneche <adeneche@maprtech.com
> >
> wrote:
>
> > Opened DRILL-4595 [1]  to track this issue.
> >
> > Thanks
> >
> > [1] https://issues.apache.org/jira/browse/DRILL-4595
> >
> > On Fri, Apr 8, 2016 at 6:42 AM, Abdel Hakim Deneche <
> adeneche@maprtech.com
> > >
> > wrote:
> >
> > > Hey John, thanks for sharing your experience. If you see this again try
> > > collecting the jstack output for the foreman node of the query, and
> also
> > > check in the query profile which fragments are still marked as RUNNING.
> > >
> > > Thanks
> > >
> > > On Thu, Apr 7, 2016 at 2:29 PM, John Omernik <jo...@omernik.com> wrote:
> > >
> > >> Abdel -
> > >>
> > >> I think I've seen this on a MapR cluster I run, especially on CTAS.
> For
> > >> me, I have not brought it up because the cluster I am running on has
> > some
> > >> serious personal issues (like being hardware that's near 7 years old,
> > its
> > >> a
> > >> test cluster) and given the "hard to reproduce" nature of the problem,
> > >> I've
> > >> been reluctant to create noise. Given what you've described, it seems
> > very
> > >> similar to CTAS hangs I've seen, but couldn't accurately reproduce.
> > >>
> > >> This didn't add much to your post, but I wanted to give you a +1 for
> > >> outlining this potential problem.  Once I move to more robust
> hardware,
> > >> and
> > >> I am in similar situations, I will post more verbose details from my
> > side.
> > >>
> > >> John
> > >>
> > >>
> > >>
> > >> On Thu, Apr 7, 2016 at 2:29 AM, Abdel Hakim Deneche <
> > >> adeneche@maprtech.com>
> > >> wrote:
> > >>
> > >> > So, we've been seeing some queries hang, I've come up with a
> possible
> > >> > explanation, but so far it's really difficult to reproduce. Let me
> > know
> > >> if
> > >> > you think this explanation doesn't hold up or if you have any ideas
> > how
> > >> we
> > >> > can reproduce it. Thanks
> > >> >
> > >> > - generally it's a CTAS running on a large cluster (lot's of writers
> > >> > running in parallel)
> > >> > - logs show that the user channel was closed and UserServer caused
> the
> > >> root
> > >> > fragment to move to a FAILED state [1]
> > >> > - jstack shows that the root fragment is blocked in it's receiver
> > >> waiting
> > >> > for data [2]
> > >> > - jstack also shows that ALL other fragments are no longer running,
> > and
> > >> the
> > >> > logs show that all of them succeeded [3]
> > >> > - the foreman waits *forever* for the root fragment to finish
> > >> >
> > >> > [1] the only case I can think off is when the user channel closed
> > while
> > >> the
> > >> > fragment was waiting for an ack from the user client
> > >> > [2] if a writer finishes earlier than the others, it will send a
> data
> > >> batch
> > >> > to the root fragment that will be sent to the user. The root will
> then
> > >> > immediately block on it's receiver waiting for the remaining writers
> > to
> > >> > finish
> > >> > [3] once the root fragment moves to a failed state, the receiver
> will
> > >> > immediately release any received batch and return an OK to the
> sender
> > >> > without putting the batch in it's blocking queue.
> > >> >
> > >> > Abdelhakim Deneche
> > >> >
> > >> > Software Engineer
> > >> >
> > >> >   <http://www.mapr.com/>
> > >> >
> > >> >
> > >> > Now Available - Free Hadoop On-Demand Training
> > >> > <
> > >> >
> > >>
> >
> http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available
> > >> > >
> > >> >
> > >>
> > >
> > >
> > >
> > > --
> > >
> > > Abdelhakim Deneche
> > >
> > > Software Engineer
> > >
> > >   <http://www.mapr.com/>
> > >
> > >
> > > Now Available - Free Hadoop On-Demand Training
> > > <
> >
> http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available
> > >
> > >
> >
> >
> >
> > --
> >
> > Abdelhakim Deneche
> >
> > Software Engineer
> >
> >   <http://www.mapr.com/>
> >
> >
> > Now Available - Free Hadoop On-Demand Training
> > <
> >
> http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available
> > >
> >
>



-- 

Abdelhakim Deneche

Software Engineer

  <http://www.mapr.com/>


Now Available - Free Hadoop On-Demand Training
<http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available>

Re: Can this scenario cause a query to hang ?

Posted by François Méthot <fm...@gmail.com>.
It might just adds up to the mystery of this issue but when we start
getting those hanging CTAS query,
if we restart our drill cluster and the problem goes away.

Next time we start getting this problem I will try to collect the JStack
output of the foreman too.

Thanks for looking into this.

Francois



On Fri, Apr 8, 2016 at 2:20 AM, Abdel Hakim Deneche <ad...@maprtech.com>
wrote:

> Opened DRILL-4595 [1]  to track this issue.
>
> Thanks
>
> [1] https://issues.apache.org/jira/browse/DRILL-4595
>
> On Fri, Apr 8, 2016 at 6:42 AM, Abdel Hakim Deneche <adeneche@maprtech.com
> >
> wrote:
>
> > Hey John, thanks for sharing your experience. If you see this again try
> > collecting the jstack output for the foreman node of the query, and also
> > check in the query profile which fragments are still marked as RUNNING.
> >
> > Thanks
> >
> > On Thu, Apr 7, 2016 at 2:29 PM, John Omernik <jo...@omernik.com> wrote:
> >
> >> Abdel -
> >>
> >> I think I've seen this on a MapR cluster I run, especially on CTAS.  For
> >> me, I have not brought it up because the cluster I am running on has
> some
> >> serious personal issues (like being hardware that's near 7 years old,
> its
> >> a
> >> test cluster) and given the "hard to reproduce" nature of the problem,
> >> I've
> >> been reluctant to create noise. Given what you've described, it seems
> very
> >> similar to CTAS hangs I've seen, but couldn't accurately reproduce.
> >>
> >> This didn't add much to your post, but I wanted to give you a +1 for
> >> outlining this potential problem.  Once I move to more robust hardware,
> >> and
> >> I am in similar situations, I will post more verbose details from my
> side.
> >>
> >> John
> >>
> >>
> >>
> >> On Thu, Apr 7, 2016 at 2:29 AM, Abdel Hakim Deneche <
> >> adeneche@maprtech.com>
> >> wrote:
> >>
> >> > So, we've been seeing some queries hang, I've come up with a possible
> >> > explanation, but so far it's really difficult to reproduce. Let me
> know
> >> if
> >> > you think this explanation doesn't hold up or if you have any ideas
> how
> >> we
> >> > can reproduce it. Thanks
> >> >
> >> > - generally it's a CTAS running on a large cluster (lot's of writers
> >> > running in parallel)
> >> > - logs show that the user channel was closed and UserServer caused the
> >> root
> >> > fragment to move to a FAILED state [1]
> >> > - jstack shows that the root fragment is blocked in it's receiver
> >> waiting
> >> > for data [2]
> >> > - jstack also shows that ALL other fragments are no longer running,
> and
> >> the
> >> > logs show that all of them succeeded [3]
> >> > - the foreman waits *forever* for the root fragment to finish
> >> >
> >> > [1] the only case I can think off is when the user channel closed
> while
> >> the
> >> > fragment was waiting for an ack from the user client
> >> > [2] if a writer finishes earlier than the others, it will send a data
> >> batch
> >> > to the root fragment that will be sent to the user. The root will then
> >> > immediately block on it's receiver waiting for the remaining writers
> to
> >> > finish
> >> > [3] once the root fragment moves to a failed state, the receiver will
> >> > immediately release any received batch and return an OK to the sender
> >> > without putting the batch in it's blocking queue.
> >> >
> >> > Abdelhakim Deneche
> >> >
> >> > Software Engineer
> >> >
> >> >   <http://www.mapr.com/>
> >> >
> >> >
> >> > Now Available - Free Hadoop On-Demand Training
> >> > <
> >> >
> >>
> http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available
> >> > >
> >> >
> >>
> >
> >
> >
> > --
> >
> > Abdelhakim Deneche
> >
> > Software Engineer
> >
> >   <http://www.mapr.com/>
> >
> >
> > Now Available - Free Hadoop On-Demand Training
> > <
> http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available
> >
> >
>
>
>
> --
>
> Abdelhakim Deneche
>
> Software Engineer
>
>   <http://www.mapr.com/>
>
>
> Now Available - Free Hadoop On-Demand Training
> <
> http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available
> >
>

Re: Can this scenario cause a query to hang ?

Posted by Abdel Hakim Deneche <ad...@maprtech.com>.
Opened DRILL-4595 [1]  to track this issue.

Thanks

[1] https://issues.apache.org/jira/browse/DRILL-4595

On Fri, Apr 8, 2016 at 6:42 AM, Abdel Hakim Deneche <ad...@maprtech.com>
wrote:

> Hey John, thanks for sharing your experience. If you see this again try
> collecting the jstack output for the foreman node of the query, and also
> check in the query profile which fragments are still marked as RUNNING.
>
> Thanks
>
> On Thu, Apr 7, 2016 at 2:29 PM, John Omernik <jo...@omernik.com> wrote:
>
>> Abdel -
>>
>> I think I've seen this on a MapR cluster I run, especially on CTAS.  For
>> me, I have not brought it up because the cluster I am running on has some
>> serious personal issues (like being hardware that's near 7 years old, its
>> a
>> test cluster) and given the "hard to reproduce" nature of the problem,
>> I've
>> been reluctant to create noise. Given what you've described, it seems very
>> similar to CTAS hangs I've seen, but couldn't accurately reproduce.
>>
>> This didn't add much to your post, but I wanted to give you a +1 for
>> outlining this potential problem.  Once I move to more robust hardware,
>> and
>> I am in similar situations, I will post more verbose details from my side.
>>
>> John
>>
>>
>>
>> On Thu, Apr 7, 2016 at 2:29 AM, Abdel Hakim Deneche <
>> adeneche@maprtech.com>
>> wrote:
>>
>> > So, we've been seeing some queries hang, I've come up with a possible
>> > explanation, but so far it's really difficult to reproduce. Let me know
>> if
>> > you think this explanation doesn't hold up or if you have any ideas how
>> we
>> > can reproduce it. Thanks
>> >
>> > - generally it's a CTAS running on a large cluster (lot's of writers
>> > running in parallel)
>> > - logs show that the user channel was closed and UserServer caused the
>> root
>> > fragment to move to a FAILED state [1]
>> > - jstack shows that the root fragment is blocked in it's receiver
>> waiting
>> > for data [2]
>> > - jstack also shows that ALL other fragments are no longer running, and
>> the
>> > logs show that all of them succeeded [3]
>> > - the foreman waits *forever* for the root fragment to finish
>> >
>> > [1] the only case I can think off is when the user channel closed while
>> the
>> > fragment was waiting for an ack from the user client
>> > [2] if a writer finishes earlier than the others, it will send a data
>> batch
>> > to the root fragment that will be sent to the user. The root will then
>> > immediately block on it's receiver waiting for the remaining writers to
>> > finish
>> > [3] once the root fragment moves to a failed state, the receiver will
>> > immediately release any received batch and return an OK to the sender
>> > without putting the batch in it's blocking queue.
>> >
>> > Abdelhakim Deneche
>> >
>> > Software Engineer
>> >
>> >   <http://www.mapr.com/>
>> >
>> >
>> > Now Available - Free Hadoop On-Demand Training
>> > <
>> >
>> http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available
>> > >
>> >
>>
>
>
>
> --
>
> Abdelhakim Deneche
>
> Software Engineer
>
>   <http://www.mapr.com/>
>
>
> Now Available - Free Hadoop On-Demand Training
> <http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available>
>



-- 

Abdelhakim Deneche

Software Engineer

  <http://www.mapr.com/>


Now Available - Free Hadoop On-Demand Training
<http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available>

Re: Can this scenario cause a query to hang ?

Posted by Abdel Hakim Deneche <ad...@maprtech.com>.
Hey John, thanks for sharing your experience. If you see this again try
collecting the jstack output for the foreman node of the query, and also
check in the query profile which fragments are still marked as RUNNING.

Thanks

On Thu, Apr 7, 2016 at 2:29 PM, John Omernik <jo...@omernik.com> wrote:

> Abdel -
>
> I think I've seen this on a MapR cluster I run, especially on CTAS.  For
> me, I have not brought it up because the cluster I am running on has some
> serious personal issues (like being hardware that's near 7 years old, its a
> test cluster) and given the "hard to reproduce" nature of the problem, I've
> been reluctant to create noise. Given what you've described, it seems very
> similar to CTAS hangs I've seen, but couldn't accurately reproduce.
>
> This didn't add much to your post, but I wanted to give you a +1 for
> outlining this potential problem.  Once I move to more robust hardware, and
> I am in similar situations, I will post more verbose details from my side.
>
> John
>
>
>
> On Thu, Apr 7, 2016 at 2:29 AM, Abdel Hakim Deneche <adeneche@maprtech.com
> >
> wrote:
>
> > So, we've been seeing some queries hang, I've come up with a possible
> > explanation, but so far it's really difficult to reproduce. Let me know
> if
> > you think this explanation doesn't hold up or if you have any ideas how
> we
> > can reproduce it. Thanks
> >
> > - generally it's a CTAS running on a large cluster (lot's of writers
> > running in parallel)
> > - logs show that the user channel was closed and UserServer caused the
> root
> > fragment to move to a FAILED state [1]
> > - jstack shows that the root fragment is blocked in it's receiver waiting
> > for data [2]
> > - jstack also shows that ALL other fragments are no longer running, and
> the
> > logs show that all of them succeeded [3]
> > - the foreman waits *forever* for the root fragment to finish
> >
> > [1] the only case I can think off is when the user channel closed while
> the
> > fragment was waiting for an ack from the user client
> > [2] if a writer finishes earlier than the others, it will send a data
> batch
> > to the root fragment that will be sent to the user. The root will then
> > immediately block on it's receiver waiting for the remaining writers to
> > finish
> > [3] once the root fragment moves to a failed state, the receiver will
> > immediately release any received batch and return an OK to the sender
> > without putting the batch in it's blocking queue.
> >
> > Abdelhakim Deneche
> >
> > Software Engineer
> >
> >   <http://www.mapr.com/>
> >
> >
> > Now Available - Free Hadoop On-Demand Training
> > <
> >
> http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available
> > >
> >
>



-- 

Abdelhakim Deneche

Software Engineer

  <http://www.mapr.com/>


Now Available - Free Hadoop On-Demand Training
<http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available>

Re: Can this scenario cause a query to hang ?

Posted by Abdel Hakim Deneche <ad...@maprtech.com>.
On Fri, Apr 8, 2016 at 12:14 AM, Sudheesh Katkam <su...@apache.org>
wrote:

> I agree there is a problem. Nice catch! Is there a ticket for this?
>

Not yet, I wanted to confirm I didn't miss anything obvious first. Will
create a JIRA right away.


> The fragment executor is responsible for sending the final state, and in
> this case its waiting forever, making the query hang. In any scenario where
> a thread other than the fragment executor is failing (or cancelling) a
> fragment, that thread should change the state, *and then *interrupt the
> fragment executor. There are so many ways to get to
> *FragmentExecutor.fail()*, and looks like [1] is the scenario you have
> mentioned, right?
>

Yes, this is the case I saw happening.


> Thank you,
> Sudheesh
>
> [1]
>
> https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/ops/FragmentContext.java#L89
>
> On Thu, Apr 7, 2016 at 3:42 PM, Abdel Hakim Deneche <adeneche@maprtech.com
> >
> wrote:
>
> > Thanks Sudheesh. So even after we fix DRILL-3714, it's still possible for
> > the root fragment to fail without being cancelled.
> >
> > Take a look at BaseRawBatchBuffer.enqueue() and you will see that, once a
> > fragment is in failed state, this method will release the batch and send
> > back an OK ack to the sender.
> >
> > About your second question. When the UserServer calls
> > FragmentExecutor.fail() it will just set it's status to FAILED without
> > interrupting it. If the fragment thread is blocked in it's receiver, it
> > will never send it's status to the Foreman.
> >
> > On Thu, Apr 7, 2016 at 10:36 PM, Sudheesh Katkam <su...@apache.org>
> > wrote:
> >
> > > I can answer one question myself. See inline.
> > >
> > > As you mentioned elsewhere, this issue will rarely happen (and even
> > harder
> > > to reproduce) once DRILL-3714 is committed.
> > >
> > > On Thu, Apr 7, 2016 at 11:38 AM, Sudheesh Katkam <su...@apache.org>
> > > wrote:
> > >
> > > > Hakim,
> > > >
> > > > Can you point me to where [3] happens?
> > > >
> > > > Two questions:
> > > >
> > > > + Why is the root fragment blocked? If the user channel is closed,
> the
> > > > query is cancelled [1], which should cancel and interrupt all running
> > > > fragments. This interruption happens regardless of fragment failure
> > that
> > > > you have pointed out when user channel is closed [2]. Unless there is
> > > there
> > > > a blocking call when failure is handled through the channel closed
> > > > listener, I don't see why cancellation is not triggered.
> > > >
> > >
> > > It is possible for fragment failure to be fully processed before
> Foreman
> > > cancels all running fragments, in which case the root fragment will not
> > be
> > > interrupted (because it is not cancelled, see
> > > QueryManager#cancelExecutingFragments).
> > >
> > >
> > > > + Why does the Foreman wait forever? AFAIK failures are reported
> > > > immediately to the user. Is the root fragment not reported as FAILED
> to
> > > the
> > > > Foreman?
> > > >
> > > > Thank you,
> > > > Sudheesh
> > > >
> > > > [1]
> > > >
> > >
> >
> https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java#L179
> > > > [2]
> > > >
> > >
> >
> https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/ops/FragmentContext.java#L92
> > > >
> > > > On Thu, Apr 7, 2016 at 6:29 AM, John Omernik <jo...@omernik.com>
> wrote:
> > > >
> > > >> Abdel -
> > > >>
> > > >> I think I've seen this on a MapR cluster I run, especially on CTAS.
> > For
> > > >> me, I have not brought it up because the cluster I am running on has
> > > some
> > > >> serious personal issues (like being hardware that's near 7 years
> old,
> > > its
> > > >> a
> > > >> test cluster) and given the "hard to reproduce" nature of the
> problem,
> > > >> I've
> > > >> been reluctant to create noise. Given what you've described, it
> seems
> > > very
> > > >> similar to CTAS hangs I've seen, but couldn't accurately reproduce.
> > > >>
> > > >> This didn't add much to your post, but I wanted to give you a +1 for
> > > >> outlining this potential problem.  Once I move to more robust
> > hardware,
> > > >> and
> > > >> I am in similar situations, I will post more verbose details from my
> > > side.
> > > >>
> > > >> John
> > > >>
> > > >>
> > > >>
> > > >> On Thu, Apr 7, 2016 at 2:29 AM, Abdel Hakim Deneche <
> > > >> adeneche@maprtech.com>
> > > >> wrote:
> > > >>
> > > >> > So, we've been seeing some queries hang, I've come up with a
> > possible
> > > >> > explanation, but so far it's really difficult to reproduce. Let me
> > > know
> > > >> if
> > > >> > you think this explanation doesn't hold up or if you have any
> ideas
> > > how
> > > >> we
> > > >> > can reproduce it. Thanks
> > > >> >
> > > >> > - generally it's a CTAS running on a large cluster (lot's of
> writers
> > > >> > running in parallel)
> > > >> > - logs show that the user channel was closed and UserServer caused
> > the
> > > >> root
> > > >> > fragment to move to a FAILED state [1]
> > > >> > - jstack shows that the root fragment is blocked in it's receiver
> > > >> waiting
> > > >> > for data [2]
> > > >> > - jstack also shows that ALL other fragments are no longer
> running,
> > > and
> > > >> the
> > > >> > logs show that all of them succeeded [3]
> > > >> > - the foreman waits *forever* for the root fragment to finish
> > > >> >
> > > >> > [1] the only case I can think off is when the user channel closed
> > > while
> > > >> the
> > > >> > fragment was waiting for an ack from the user client
> > > >> > [2] if a writer finishes earlier than the others, it will send a
> > data
> > > >> batch
> > > >> > to the root fragment that will be sent to the user. The root will
> > then
> > > >> > immediately block on it's receiver waiting for the remaining
> writers
> > > to
> > > >> > finish
> > > >> > [3] once the root fragment moves to a failed state, the receiver
> > will
> > > >> > immediately release any received batch and return an OK to the
> > sender
> > > >> > without putting the batch in it's blocking queue.
> > > >> >
> > > >> > Abdelhakim Deneche
> > > >> >
> > > >> > Software Engineer
> > > >> >
> > > >> >   <http://www.mapr.com/>
> > > >> >
> > > >> >
> > > >> > Now Available - Free Hadoop On-Demand Training
> > > >> > <
> > > >> >
> > > >>
> > >
> >
> http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available
> > > >> > >
> > > >> >
> > > >>
> > > >
> > > >
> > >
> >
> >
> >
> > --
> >
> > Abdelhakim Deneche
> >
> > Software Engineer
> >
> >   <http://www.mapr.com/>
> >
> >
> > Now Available - Free Hadoop On-Demand Training
> > <
> >
> http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available
> > >
> >
>



-- 

Abdelhakim Deneche

Software Engineer

  <http://www.mapr.com/>


Now Available - Free Hadoop On-Demand Training
<http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available>

Re: Can this scenario cause a query to hang ?

Posted by Sudheesh Katkam <su...@apache.org>.
I agree there is a problem. Nice catch! Is there a ticket for this?

The fragment executor is responsible for sending the final state, and in
this case its waiting forever, making the query hang. In any scenario where
a thread other than the fragment executor is failing (or cancelling) a
fragment, that thread should change the state, *and then *interrupt the
fragment executor. There are so many ways to get to
*FragmentExecutor.fail()*, and looks like [1] is the scenario you have
mentioned, right?

Thank you,
Sudheesh

[1]
https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/ops/FragmentContext.java#L89

On Thu, Apr 7, 2016 at 3:42 PM, Abdel Hakim Deneche <ad...@maprtech.com>
wrote:

> Thanks Sudheesh. So even after we fix DRILL-3714, it's still possible for
> the root fragment to fail without being cancelled.
>
> Take a look at BaseRawBatchBuffer.enqueue() and you will see that, once a
> fragment is in failed state, this method will release the batch and send
> back an OK ack to the sender.
>
> About your second question. When the UserServer calls
> FragmentExecutor.fail() it will just set it's status to FAILED without
> interrupting it. If the fragment thread is blocked in it's receiver, it
> will never send it's status to the Foreman.
>
> On Thu, Apr 7, 2016 at 10:36 PM, Sudheesh Katkam <su...@apache.org>
> wrote:
>
> > I can answer one question myself. See inline.
> >
> > As you mentioned elsewhere, this issue will rarely happen (and even
> harder
> > to reproduce) once DRILL-3714 is committed.
> >
> > On Thu, Apr 7, 2016 at 11:38 AM, Sudheesh Katkam <su...@apache.org>
> > wrote:
> >
> > > Hakim,
> > >
> > > Can you point me to where [3] happens?
> > >
> > > Two questions:
> > >
> > > + Why is the root fragment blocked? If the user channel is closed, the
> > > query is cancelled [1], which should cancel and interrupt all running
> > > fragments. This interruption happens regardless of fragment failure
> that
> > > you have pointed out when user channel is closed [2]. Unless there is
> > there
> > > a blocking call when failure is handled through the channel closed
> > > listener, I don't see why cancellation is not triggered.
> > >
> >
> > It is possible for fragment failure to be fully processed before Foreman
> > cancels all running fragments, in which case the root fragment will not
> be
> > interrupted (because it is not cancelled, see
> > QueryManager#cancelExecutingFragments).
> >
> >
> > > + Why does the Foreman wait forever? AFAIK failures are reported
> > > immediately to the user. Is the root fragment not reported as FAILED to
> > the
> > > Foreman?
> > >
> > > Thank you,
> > > Sudheesh
> > >
> > > [1]
> > >
> >
> https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java#L179
> > > [2]
> > >
> >
> https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/ops/FragmentContext.java#L92
> > >
> > > On Thu, Apr 7, 2016 at 6:29 AM, John Omernik <jo...@omernik.com> wrote:
> > >
> > >> Abdel -
> > >>
> > >> I think I've seen this on a MapR cluster I run, especially on CTAS.
> For
> > >> me, I have not brought it up because the cluster I am running on has
> > some
> > >> serious personal issues (like being hardware that's near 7 years old,
> > its
> > >> a
> > >> test cluster) and given the "hard to reproduce" nature of the problem,
> > >> I've
> > >> been reluctant to create noise. Given what you've described, it seems
> > very
> > >> similar to CTAS hangs I've seen, but couldn't accurately reproduce.
> > >>
> > >> This didn't add much to your post, but I wanted to give you a +1 for
> > >> outlining this potential problem.  Once I move to more robust
> hardware,
> > >> and
> > >> I am in similar situations, I will post more verbose details from my
> > side.
> > >>
> > >> John
> > >>
> > >>
> > >>
> > >> On Thu, Apr 7, 2016 at 2:29 AM, Abdel Hakim Deneche <
> > >> adeneche@maprtech.com>
> > >> wrote:
> > >>
> > >> > So, we've been seeing some queries hang, I've come up with a
> possible
> > >> > explanation, but so far it's really difficult to reproduce. Let me
> > know
> > >> if
> > >> > you think this explanation doesn't hold up or if you have any ideas
> > how
> > >> we
> > >> > can reproduce it. Thanks
> > >> >
> > >> > - generally it's a CTAS running on a large cluster (lot's of writers
> > >> > running in parallel)
> > >> > - logs show that the user channel was closed and UserServer caused
> the
> > >> root
> > >> > fragment to move to a FAILED state [1]
> > >> > - jstack shows that the root fragment is blocked in it's receiver
> > >> waiting
> > >> > for data [2]
> > >> > - jstack also shows that ALL other fragments are no longer running,
> > and
> > >> the
> > >> > logs show that all of them succeeded [3]
> > >> > - the foreman waits *forever* for the root fragment to finish
> > >> >
> > >> > [1] the only case I can think off is when the user channel closed
> > while
> > >> the
> > >> > fragment was waiting for an ack from the user client
> > >> > [2] if a writer finishes earlier than the others, it will send a
> data
> > >> batch
> > >> > to the root fragment that will be sent to the user. The root will
> then
> > >> > immediately block on it's receiver waiting for the remaining writers
> > to
> > >> > finish
> > >> > [3] once the root fragment moves to a failed state, the receiver
> will
> > >> > immediately release any received batch and return an OK to the
> sender
> > >> > without putting the batch in it's blocking queue.
> > >> >
> > >> > Abdelhakim Deneche
> > >> >
> > >> > Software Engineer
> > >> >
> > >> >   <http://www.mapr.com/>
> > >> >
> > >> >
> > >> > Now Available - Free Hadoop On-Demand Training
> > >> > <
> > >> >
> > >>
> >
> http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available
> > >> > >
> > >> >
> > >>
> > >
> > >
> >
>
>
>
> --
>
> Abdelhakim Deneche
>
> Software Engineer
>
>   <http://www.mapr.com/>
>
>
> Now Available - Free Hadoop On-Demand Training
> <
> http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available
> >
>

Re: Can this scenario cause a query to hang ?

Posted by Abdel Hakim Deneche <ad...@maprtech.com>.
Thanks Sudheesh. So even after we fix DRILL-3714, it's still possible for
the root fragment to fail without being cancelled.

Take a look at BaseRawBatchBuffer.enqueue() and you will see that, once a
fragment is in failed state, this method will release the batch and send
back an OK ack to the sender.

About your second question. When the UserServer calls
FragmentExecutor.fail() it will just set it's status to FAILED without
interrupting it. If the fragment thread is blocked in it's receiver, it
will never send it's status to the Foreman.

On Thu, Apr 7, 2016 at 10:36 PM, Sudheesh Katkam <su...@apache.org>
wrote:

> I can answer one question myself. See inline.
>
> As you mentioned elsewhere, this issue will rarely happen (and even harder
> to reproduce) once DRILL-3714 is committed.
>
> On Thu, Apr 7, 2016 at 11:38 AM, Sudheesh Katkam <su...@apache.org>
> wrote:
>
> > Hakim,
> >
> > Can you point me to where [3] happens?
> >
> > Two questions:
> >
> > + Why is the root fragment blocked? If the user channel is closed, the
> > query is cancelled [1], which should cancel and interrupt all running
> > fragments. This interruption happens regardless of fragment failure that
> > you have pointed out when user channel is closed [2]. Unless there is
> there
> > a blocking call when failure is handled through the channel closed
> > listener, I don't see why cancellation is not triggered.
> >
>
> It is possible for fragment failure to be fully processed before Foreman
> cancels all running fragments, in which case the root fragment will not be
> interrupted (because it is not cancelled, see
> QueryManager#cancelExecutingFragments).
>
>
> > + Why does the Foreman wait forever? AFAIK failures are reported
> > immediately to the user. Is the root fragment not reported as FAILED to
> the
> > Foreman?
> >
> > Thank you,
> > Sudheesh
> >
> > [1]
> >
> https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java#L179
> > [2]
> >
> https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/ops/FragmentContext.java#L92
> >
> > On Thu, Apr 7, 2016 at 6:29 AM, John Omernik <jo...@omernik.com> wrote:
> >
> >> Abdel -
> >>
> >> I think I've seen this on a MapR cluster I run, especially on CTAS.  For
> >> me, I have not brought it up because the cluster I am running on has
> some
> >> serious personal issues (like being hardware that's near 7 years old,
> its
> >> a
> >> test cluster) and given the "hard to reproduce" nature of the problem,
> >> I've
> >> been reluctant to create noise. Given what you've described, it seems
> very
> >> similar to CTAS hangs I've seen, but couldn't accurately reproduce.
> >>
> >> This didn't add much to your post, but I wanted to give you a +1 for
> >> outlining this potential problem.  Once I move to more robust hardware,
> >> and
> >> I am in similar situations, I will post more verbose details from my
> side.
> >>
> >> John
> >>
> >>
> >>
> >> On Thu, Apr 7, 2016 at 2:29 AM, Abdel Hakim Deneche <
> >> adeneche@maprtech.com>
> >> wrote:
> >>
> >> > So, we've been seeing some queries hang, I've come up with a possible
> >> > explanation, but so far it's really difficult to reproduce. Let me
> know
> >> if
> >> > you think this explanation doesn't hold up or if you have any ideas
> how
> >> we
> >> > can reproduce it. Thanks
> >> >
> >> > - generally it's a CTAS running on a large cluster (lot's of writers
> >> > running in parallel)
> >> > - logs show that the user channel was closed and UserServer caused the
> >> root
> >> > fragment to move to a FAILED state [1]
> >> > - jstack shows that the root fragment is blocked in it's receiver
> >> waiting
> >> > for data [2]
> >> > - jstack also shows that ALL other fragments are no longer running,
> and
> >> the
> >> > logs show that all of them succeeded [3]
> >> > - the foreman waits *forever* for the root fragment to finish
> >> >
> >> > [1] the only case I can think off is when the user channel closed
> while
> >> the
> >> > fragment was waiting for an ack from the user client
> >> > [2] if a writer finishes earlier than the others, it will send a data
> >> batch
> >> > to the root fragment that will be sent to the user. The root will then
> >> > immediately block on it's receiver waiting for the remaining writers
> to
> >> > finish
> >> > [3] once the root fragment moves to a failed state, the receiver will
> >> > immediately release any received batch and return an OK to the sender
> >> > without putting the batch in it's blocking queue.
> >> >
> >> > Abdelhakim Deneche
> >> >
> >> > Software Engineer
> >> >
> >> >   <http://www.mapr.com/>
> >> >
> >> >
> >> > Now Available - Free Hadoop On-Demand Training
> >> > <
> >> >
> >>
> http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available
> >> > >
> >> >
> >>
> >
> >
>



-- 

Abdelhakim Deneche

Software Engineer

  <http://www.mapr.com/>


Now Available - Free Hadoop On-Demand Training
<http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available>

Re: Can this scenario cause a query to hang ?

Posted by Sudheesh Katkam <su...@apache.org>.
I can answer one question myself. See inline.

As you mentioned elsewhere, this issue will rarely happen (and even harder
to reproduce) once DRILL-3714 is committed.

On Thu, Apr 7, 2016 at 11:38 AM, Sudheesh Katkam <su...@apache.org>
wrote:

> Hakim,
>
> Can you point me to where [3] happens?
>
> Two questions:
>
> + Why is the root fragment blocked? If the user channel is closed, the
> query is cancelled [1], which should cancel and interrupt all running
> fragments. This interruption happens regardless of fragment failure that
> you have pointed out when user channel is closed [2]. Unless there is there
> a blocking call when failure is handled through the channel closed
> listener, I don't see why cancellation is not triggered.
>

It is possible for fragment failure to be fully processed before Foreman
cancels all running fragments, in which case the root fragment will not be
interrupted (because it is not cancelled, see
QueryManager#cancelExecutingFragments).


> + Why does the Foreman wait forever? AFAIK failures are reported
> immediately to the user. Is the root fragment not reported as FAILED to the
> Foreman?
>
> Thank you,
> Sudheesh
>
> [1]
> https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java#L179
> [2]
> https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/ops/FragmentContext.java#L92
>
> On Thu, Apr 7, 2016 at 6:29 AM, John Omernik <jo...@omernik.com> wrote:
>
>> Abdel -
>>
>> I think I've seen this on a MapR cluster I run, especially on CTAS.  For
>> me, I have not brought it up because the cluster I am running on has some
>> serious personal issues (like being hardware that's near 7 years old, its
>> a
>> test cluster) and given the "hard to reproduce" nature of the problem,
>> I've
>> been reluctant to create noise. Given what you've described, it seems very
>> similar to CTAS hangs I've seen, but couldn't accurately reproduce.
>>
>> This didn't add much to your post, but I wanted to give you a +1 for
>> outlining this potential problem.  Once I move to more robust hardware,
>> and
>> I am in similar situations, I will post more verbose details from my side.
>>
>> John
>>
>>
>>
>> On Thu, Apr 7, 2016 at 2:29 AM, Abdel Hakim Deneche <
>> adeneche@maprtech.com>
>> wrote:
>>
>> > So, we've been seeing some queries hang, I've come up with a possible
>> > explanation, but so far it's really difficult to reproduce. Let me know
>> if
>> > you think this explanation doesn't hold up or if you have any ideas how
>> we
>> > can reproduce it. Thanks
>> >
>> > - generally it's a CTAS running on a large cluster (lot's of writers
>> > running in parallel)
>> > - logs show that the user channel was closed and UserServer caused the
>> root
>> > fragment to move to a FAILED state [1]
>> > - jstack shows that the root fragment is blocked in it's receiver
>> waiting
>> > for data [2]
>> > - jstack also shows that ALL other fragments are no longer running, and
>> the
>> > logs show that all of them succeeded [3]
>> > - the foreman waits *forever* for the root fragment to finish
>> >
>> > [1] the only case I can think off is when the user channel closed while
>> the
>> > fragment was waiting for an ack from the user client
>> > [2] if a writer finishes earlier than the others, it will send a data
>> batch
>> > to the root fragment that will be sent to the user. The root will then
>> > immediately block on it's receiver waiting for the remaining writers to
>> > finish
>> > [3] once the root fragment moves to a failed state, the receiver will
>> > immediately release any received batch and return an OK to the sender
>> > without putting the batch in it's blocking queue.
>> >
>> > Abdelhakim Deneche
>> >
>> > Software Engineer
>> >
>> >   <http://www.mapr.com/>
>> >
>> >
>> > Now Available - Free Hadoop On-Demand Training
>> > <
>> >
>> http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available
>> > >
>> >
>>
>
>

Re: Can this scenario cause a query to hang ?

Posted by Sudheesh Katkam <su...@apache.org>.
Hakim,

Can you point me to where [3] happens?

Two questions:

+ Why is the root fragment blocked? If the user channel is closed, the
query is cancelled [1], which should cancel and interrupt all running
fragments. This interruption happens regardless of fragment failure that
you have pointed out when user channel is closed [2]. Unless there is there
a blocking call when failure is handled through the channel closed
listener, I don't see why cancellation is not triggered.

+ Why does the Foreman wait forever? AFAIK failures are reported
immediately to the user. Is the root fragment not reported as FAILED to the
Foreman?

Thank you,
Sudheesh

[1]
https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java#L179
[2]
https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/ops/FragmentContext.java#L92

On Thu, Apr 7, 2016 at 6:29 AM, John Omernik <jo...@omernik.com> wrote:

> Abdel -
>
> I think I've seen this on a MapR cluster I run, especially on CTAS.  For
> me, I have not brought it up because the cluster I am running on has some
> serious personal issues (like being hardware that's near 7 years old, its a
> test cluster) and given the "hard to reproduce" nature of the problem, I've
> been reluctant to create noise. Given what you've described, it seems very
> similar to CTAS hangs I've seen, but couldn't accurately reproduce.
>
> This didn't add much to your post, but I wanted to give you a +1 for
> outlining this potential problem.  Once I move to more robust hardware, and
> I am in similar situations, I will post more verbose details from my side.
>
> John
>
>
>
> On Thu, Apr 7, 2016 at 2:29 AM, Abdel Hakim Deneche <adeneche@maprtech.com
> >
> wrote:
>
> > So, we've been seeing some queries hang, I've come up with a possible
> > explanation, but so far it's really difficult to reproduce. Let me know
> if
> > you think this explanation doesn't hold up or if you have any ideas how
> we
> > can reproduce it. Thanks
> >
> > - generally it's a CTAS running on a large cluster (lot's of writers
> > running in parallel)
> > - logs show that the user channel was closed and UserServer caused the
> root
> > fragment to move to a FAILED state [1]
> > - jstack shows that the root fragment is blocked in it's receiver waiting
> > for data [2]
> > - jstack also shows that ALL other fragments are no longer running, and
> the
> > logs show that all of them succeeded [3]
> > - the foreman waits *forever* for the root fragment to finish
> >
> > [1] the only case I can think off is when the user channel closed while
> the
> > fragment was waiting for an ack from the user client
> > [2] if a writer finishes earlier than the others, it will send a data
> batch
> > to the root fragment that will be sent to the user. The root will then
> > immediately block on it's receiver waiting for the remaining writers to
> > finish
> > [3] once the root fragment moves to a failed state, the receiver will
> > immediately release any received batch and return an OK to the sender
> > without putting the batch in it's blocking queue.
> >
> > Abdelhakim Deneche
> >
> > Software Engineer
> >
> >   <http://www.mapr.com/>
> >
> >
> > Now Available - Free Hadoop On-Demand Training
> > <
> >
> http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available
> > >
> >
>

Re: Can this scenario cause a query to hang ?

Posted by John Omernik <jo...@omernik.com>.
Abdel -

I think I've seen this on a MapR cluster I run, especially on CTAS.  For
me, I have not brought it up because the cluster I am running on has some
serious personal issues (like being hardware that's near 7 years old, its a
test cluster) and given the "hard to reproduce" nature of the problem, I've
been reluctant to create noise. Given what you've described, it seems very
similar to CTAS hangs I've seen, but couldn't accurately reproduce.

This didn't add much to your post, but I wanted to give you a +1 for
outlining this potential problem.  Once I move to more robust hardware, and
I am in similar situations, I will post more verbose details from my side.

John



On Thu, Apr 7, 2016 at 2:29 AM, Abdel Hakim Deneche <ad...@maprtech.com>
wrote:

> So, we've been seeing some queries hang, I've come up with a possible
> explanation, but so far it's really difficult to reproduce. Let me know if
> you think this explanation doesn't hold up or if you have any ideas how we
> can reproduce it. Thanks
>
> - generally it's a CTAS running on a large cluster (lot's of writers
> running in parallel)
> - logs show that the user channel was closed and UserServer caused the root
> fragment to move to a FAILED state [1]
> - jstack shows that the root fragment is blocked in it's receiver waiting
> for data [2]
> - jstack also shows that ALL other fragments are no longer running, and the
> logs show that all of them succeeded [3]
> - the foreman waits *forever* for the root fragment to finish
>
> [1] the only case I can think off is when the user channel closed while the
> fragment was waiting for an ack from the user client
> [2] if a writer finishes earlier than the others, it will send a data batch
> to the root fragment that will be sent to the user. The root will then
> immediately block on it's receiver waiting for the remaining writers to
> finish
> [3] once the root fragment moves to a failed state, the receiver will
> immediately release any received batch and return an OK to the sender
> without putting the batch in it's blocking queue.
>
> Abdelhakim Deneche
>
> Software Engineer
>
>   <http://www.mapr.com/>
>
>
> Now Available - Free Hadoop On-Demand Training
> <
> http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available
> >
>