[ https://issues.apache.org/jira/browse/BEAM-7994?focusedWorklogId=296632&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-296632 ]
ASF GitHub Bot logged work on BEAM-7994: ---------------------------------------- Author: ASF GitHub Bot Created on: 16/Aug/19 22:36 Start Date: 16/Aug/19 22:36 Worklog Time Spent: 10m Work Description: youngoli commented on pull request #9362: [BEAM-7994] Fixing unsafe pointer usage for Go 1.13 URL: https://github.com/apache/beam/pull/9362#discussion_r314909234 ########## File path: sdks/go/pkg/beam/core/util/reflectx/functions.go ########## @@ -40,6 +40,8 @@ func FunctionName(fn interface{}) string { // points to a valid function implementation. func LoadFunction(ptr uintptr, t reflect.Type) interface{} { v := reflect.New(t).Elem() - *(*uintptr)(unsafe.Pointer(v.Addr().Pointer())) = (uintptr)(unsafe.Pointer(&ptr)) + p := new(uintptr) + *p = ptr + *(*unsafe.Pointer)(unsafe.Pointer(v.Addr().Pointer())) = unsafe.Pointer(p) Review comment: I had to read up a bit on how reflect and unsafe work to understand what was happening here, but I still don't understand exactly why the previous version was invalid and this one valid. (I'm using https://golang.org/pkg/unsafe/#Pointer as a guideline). Is it because in the old version we simply put in the address to `ptr`, and in the new one we actually create a new copy? Or is it because in the old version we're reassigning to `v` as a `uintptr` instead of as an `unsafe.Pointer`? Those are the only real differences I could figure out. ---------------------------------------------------------------- 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: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 296632) Time Spent: 50m (was: 40m) > BEAM SDK has compatibility problems with go1.13 > ----------------------------------------------- > > Key: BEAM-7994 > URL: https://issues.apache.org/jira/browse/BEAM-7994 > Project: Beam > Issue Type: Improvement > Components: sdk-go > Reporter: Bill Neubauer > Assignee: Bill Neubauer > Priority: Minor > Time Spent: 50m > Remaining Estimate: 0h > > The Go team identified a problem in the Beam SDK that appears due to runtime > changes in Go 1.13, which is upcoming. There is a backwards compatible fix > the team recommended. -- This message was sent by Atlassian JIRA (v7.6.14#76016)