drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adeneche <...@git.apache.org>
Subject [GitHub] drill pull request: DRILL-4676: Foreman.moveToState can block fore...
Date Mon, 16 May 2016 04:24:15 GMT
Github user adeneche commented on a diff in the pull request:

    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java
    @@ -1221,6 +1223,12 @@ public void interrupted(final InterruptedException e) {
          *   to the user
         public void moveToState(final QueryState newState, final Exception ex) {
    +      // if the current thread is the foreman thread, throw an exception
    +      // otherwise the foreman will be blocked forever on acceptExternalEvents
    +      if (myThreadRef == Thread.currentThread()) {
    --- End diff --
    In practice, the foreman thread is never meant to call moveToState otherwise it would
block forever on the latch. The only cases I've seen this happen are when the foreman [fails
to submit a remote fragment](https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java#L1194),
and when the foreman [fails to send the final state to the user](https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java#L1238)
    In both cases, the default behavior is to have another thread (rpc) call moveToState,
but sometimes, [RpcBus.send](https://github.com/apache/drill/blob/master/exec/rpc/src/main/java/org/apache/drill/exec/rpc/RpcBus.java#L126)
causes the foreman thread to explicitly call moveToState.
    For example, in the second case, throwing an exception in moveToState will cause the foreman
to stop submitting the remaining remote fragments and it will be propagated to Foreman.run
where it will cause the foreman to [move to a failed state](https://github.com/apache/drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/work/foreman/Foreman.java#L264)

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 infrastructure@apache.org or file a JIRA ticket
with INFRA.

View raw message