[ 
https://issues.apache.org/jira/browse/BEAM-9789?focusedWorklogId=425512&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-425512
 ]

ASF GitHub Bot logged work on BEAM-9789:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 21/Apr/20 01:15
            Start Date: 21/Apr/20 01:15
    Worklog Time Spent: 10m 
      Work Description: lostluck commented on a change in pull request #11468:
URL: https://github.com/apache/beam/pull/11468#discussion_r411797808



##########
File path: sdks/go/pkg/beam/core/runtime/harness/harness_test.go
##########
@@ -0,0 +1,169 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package harness
+
+import (
+       "fmt"
+       "strings"
+       "testing"
+
+       "github.com/apache/beam/sdks/go/pkg/beam/core/runtime/exec"
+       fnpb "github.com/apache/beam/sdks/go/pkg/beam/model/fnexecution_v1"
+       pipepb "github.com/apache/beam/sdks/go/pkg/beam/model/pipeline_v1"
+       "github.com/golang/protobuf/proto"
+)
+
+// validDescriptor describes a valid pipeline with a source and a sink, but 
doesn't do anything else.
+func validDescriptor(t *testing.T) *fnpb.ProcessBundleDescriptor {
+       t.Helper()
+       port := &fnpb.RemoteGrpcPort{
+               CoderId: "c1",
+               ApiServiceDescriptor: &pipepb.ApiServiceDescriptor{
+                       Url: "hostname:port",
+               },
+       }
+       portBytes, err := proto.Marshal(port)
+       if err != nil {
+               t.Fatalf("bad port: %v", err)
+       }
+       return &fnpb.ProcessBundleDescriptor{
+               Id: "test",
+               Transforms: map[string]*pipepb.PTransform{
+                       "source": &pipepb.PTransform{
+                               Spec: &pipepb.FunctionSpec{
+                                       Urn:     "beam:runner:source:v1",
+                                       Payload: portBytes,
+                               },
+                               Outputs: map[string]string{
+                                       "o1": "p1",
+                               },
+                       },
+                       "sink": &pipepb.PTransform{
+                               Spec: &pipepb.FunctionSpec{
+                                       Urn:     "beam:runner:sink:v1",
+                                       Payload: portBytes,
+                               },
+                               Inputs: map[string]string{
+                                       "i1": "p1",
+                               },
+                       },
+               },
+               Pcollections: map[string]*pipepb.PCollection{
+                       "p1": &pipepb.PCollection{
+                               CoderId: "c1",
+                       },
+               },
+               Coders: map[string]*pipepb.Coder{
+                       "c1": &pipepb.Coder{
+                               Spec: &pipepb.FunctionSpec{
+                                       Urn: "beam:coder:windowed_value:v1",
+                               },
+                               ComponentCoderIds: []string{"c2", "c3"},
+                       },
+                       "c2": &pipepb.Coder{
+                               Spec: &pipepb.FunctionSpec{
+                                       Urn: "beam:coder:varint:v1",
+                               },
+                       },
+                       "c3": &pipepb.Coder{
+                               Spec: &pipepb.FunctionSpec{
+                                       Urn: "beam:coder:global_window:v1",
+                               },
+                       },
+               },
+       }
+
+}
+
+func invalidDescriptor(t *testing.T) *fnpb.ProcessBundleDescriptor {
+       return &fnpb.ProcessBundleDescriptor{}
+}
+
+func TestControl_getOrCreatePlan(t *testing.T) {
+       testBDID := bundleDescriptorID("test")
+       testPlan, err := exec.UnmarshalPlan(validDescriptor(t))
+       if err != nil {
+               t.Fatal("bad testPlan")
+       }
+       tests := []struct {
+               name               string
+               lookupErr, planErr error
+               lookupDesc         *fnpb.ProcessBundleDescriptor
+               descriptors        
map[bundleDescriptorID]*fnpb.ProcessBundleDescriptor
+               plans              map[bundleDescriptorID][]*exec.Plan
+       }{
+               {
+                       name:       "OK",
+                       lookupDesc: validDescriptor(t),
+               }, {
+                       name: "cachedDescriptor",
+                       descriptors: 
map[bundleDescriptorID]*fnpb.ProcessBundleDescriptor{
+                               testBDID: validDescriptor(t),
+                       },
+               }, {
+                       name: "cachedPlan",
+                       plans: map[bundleDescriptorID][]*exec.Plan{
+                               testBDID: []*exec.Plan{testPlan},
+                       },
+               }, {
+                       name:      "badLookup",

Review comment:
       Ah good catch. It should be a plan error instead, but I'll remove the 
case.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 425512)
    Time Spent: 40m  (was: 0.5h)

> Locking error in harness.go
> ---------------------------
>
>                 Key: BEAM-9789
>                 URL: https://issues.apache.org/jira/browse/BEAM-9789
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-go
>            Reporter: Robert Burke
>            Assignee: Robert Burke
>            Priority: Major
>             Fix For: Not applicable
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> When there's an error on lookup or construction of an execution plan, the 
> lock is accidentally held causing the worker to freeze. 
> Shouldn't be user affecting, as most plans and lookups are correct without 
> error, but if there's a transient GRPC issue on lookup, that might cause an 
> otherwise healthy worker to deadlock.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to