aws / aws-sdk-go

AWS SDK for the Go programming language.
http://aws.amazon.com/sdk-for-go/
Apache License 2.0
8.61k stars 2.07k forks source link

PollForDecisionTask on SWF client returns error #56

Closed ian-kent closed 9 years ago

ian-kent commented 9 years ago

Only happens when a valid decision task is received, getting this error: strconv.ParseInt: parsing "1.420630155882E9": invalid syntax

If the decision task is empty, it returns without an error, and TaskToken is nil as expected.

I think this is coming from aws.JSONClient, when it decodes the response data, but can't why that's happening - perhaps in HistoryEvent struct? I'll keep digging around, but not even really sure where to start.

Calling it like this:

input := &swf.PollForDecisionTaskInput{
    Domain: aws.String("domain"),
    TaskList: &swf.TaskList{
        Name: aws.String("tasklist"),
    },
}
d, err := swfCli.PollForDecisionTask(input)
ian-kent commented 9 years ago

Narrowed it down a bit using AWS CLI...

The error from aws-go is strconv.ParseInt: parsing "1.420642418989E9": invalid syntax

Using AWS CLI I get this response (some stuff obfuscated), which indicates its related to the event timestamps...

{
    "previousStartedEventId": 0, 
    "workflowExecution": {
        "workflowId": "6", 
        "runId": "22Ru........"
    }, 
    "startedEventId": 3, 
    "workflowType": {
        "version": "v1", 
        "name": "convert-...."
    }, 
    "events": [
        {
            "eventId": 1, 
            "eventType": "WorkflowExecutionStarted", 
            "workflowExecutionStartedEventAttributes": {
                "taskList": {
                    "name": "default-....."
                }, 
                "parentInitiatedEventId": 0, 
                "taskStartToCloseTimeout": "3600", 
                "childPolicy": "TERMINATE", 
                "executionStartToCloseTimeout": "3600", 
                "input": "", 
                "workflowType": {
                    "version": "v1", 
                    "name": "convert-......"
                }
            }, 
            "eventTimestamp": 1420642538.771
        }, 
        {
            "eventId": 2, 
            "eventType": "DecisionTaskScheduled", 
            "decisionTaskScheduledEventAttributes": {
                "startToCloseTimeout": "3600", 
                "taskList": {
                    "name": "default-......"
                }
            }, 
            "eventTimestamp": 1420642538.771
        }, 
        {
            "eventId": 3, 
            "eventType": "DecisionTaskStarted", 
            "eventTimestamp": 1420642538.85, 
            "decisionTaskStartedEventAttributes": {
                "scheduledEventId": 2
            }
        }
    ], 
    "taskToken": "AAAAKgAAAAIAAAAAAAAAA....."
}
ian-kent commented 9 years ago

Think it might possibly be related to this, since SWF also appears to use a floating point date format - https://github.com/stripe/aws-go/blob/master/model/model.go#L431