jonee opened a new issue #5044: URL: https://github.com/apache/openwhisk/issues/5044
<!-- We use the issue tracker for bugs and feature requests. For general questions and discussion please use http://slack.openwhisk.org/ or https://openwhisk.apache.org/contact.html instead. Do NOT share passwords, credentials or other confidential information. Before creating a new issue, please check if there is one already open that fits the defect you are reporting. If you open an issue and realize later it is a duplicate of a pre-existing open issue, please close yours and add a comment to the other. Issues can be created for either defects or enhancement requests. If you are a committer than please add the labels "bug" or "feature". If you are not a committer please make clear in the comments which one it is, so that committers can add these labels later. If you are reporting a defect, please edit the issue description to include the information shown below. If you are reporting an enhancement request, please include information on what you are trying to achieve and why that enhancement would help you. For more information about reporting issues, see https://github.com/apache/openwhisk/blob/master/CONTRIBUTING.md#raising-issues Use the commands below to provide key information from your environment: You do not have to include this information if this is a feature request. --> ## Environment details: * IBM Cloud Functions * Docker / Native runtime ## Steps to reproduce the issue: 1. Create the action with the code below 2. Retrieve the web action and invoke with a post ibmcloud fn action get helloGo --url <- returns your url curl -X POST -d '{"name":"sfdsfs4 "}' https://us-south.functions.appdomain.cloud/api/v1/xxx/helloGo.json 3. review the logs ibmcloud wsk activation logs --last # returns the logs notice that variable t0 is never reused. You always see "new t0" in the logs ## Provide the expected results and outputs: ``` That it re uses the variables outside of main like for other runtimes. ``` ## Provide the actual results and outputs: ``` It does not reuse variables outside of main. This is usually used to reuse db connection. ``` ## Additional information you deem important: * issue happens 100% of the time and should be easy to reproduce Code for native / docker runtime save as main.go GOOS=linux GOARCH=amd64 go build -o exec zip exec.zip exec ibmcloud wsk action update helloGo --native exec.zip ibmcloud fn action get helloGo --url <- returns your url curl -X POST -d '{"name":"sfdsfs4 "}' https://us-south.functions.appdomain.cloud/api/v1//helloGo.json ibmcloud wsk activation logs --last # returns the logs package main import ( "fmt" "log" "os" "time" "encoding/json" ) var t0 time.Time func main() { log.Println("os.Args") log.Println(os.Args) if t0.IsZero() { t0 = time.Now() log.Println("new t0") } else { log.Println("re used t0") } msg := map[string]string{"body": ("Hello!")} res, _ := json.Marshal(msg) fmt.Println(string(res)) } ---------------------------------------------------------------- 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]
