You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Daniel Oliveira (Jira)" <ji...@apache.org> on 2021/09/28 02:19:00 UTC

[jira] [Created] (BEAM-12979) [Go SDK] Avoid shallow copying CacheToken protobufs in statecache.go

Daniel Oliveira created BEAM-12979:
--------------------------------------

             Summary: [Go SDK] Avoid shallow copying CacheToken protobufs in statecache.go
                 Key: BEAM-12979
                 URL: https://issues.apache.org/jira/browse/BEAM-12979
             Project: Beam
          Issue Type: Bug
          Components: sdk-go
            Reporter: Daniel Oliveira
            Assignee: Jack McCluskey


Copying protobuf messages should be avoided because it causes a ton of subtle bugs, especially when mutexes inside the object get copied. We should be using pointers instead.

Some spots where copies of CacheTokens are made instead of pointers:

[https://github.com/apache/beam/blob/f051cd91d46e5dab0ca48f108b27d9d87e6e5e8f/sdks/go/pkg/beam/core/runtime/harness/statecache/statecache.go#L92]

[https://github.com/apache/beam/blob/f051cd91d46e5dab0ca48f108b27d9d87e6e5e8f/sdks/go/pkg/beam/core/runtime/harness/statecache/statecache.go#L124]

[https://github.com/apache/beam/blob/f051cd91d46e5dab0ca48f108b27d9d87e6e5e8f/sdks/go/pkg/beam/core/runtime/harness/statecache/statecache_test.go#L119]

This isn't an exhaustive list, but it covers some of the major instances. Should be easy enough to ctrl+f "fnpb.ProcessBundleRequest_CacheToken" and just make sure it's used as a pointer wherever possible.



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