Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ballerina : Idle timeout triggered before initiating inbound response

Tags:

http

ballerina

I am executing Task appointment in a ballerina project which runs every 10 minutes. It works fine for roughly an hour but when the execution time reaches 2 hours it gives me an error. Following is the error log.

2018-10-04 12:00:00,002 INFO - Scanning the Github repository
2018-10-04 12:01:00,008 ERROR - Idle timeout triggered before initiating inbound response : {message:"Idle timeout triggered before initiating inbound response", cause:null, statusCode:0}

It seems the idle time is 1 minute from the error log.

Here is the program code.

public function main(string... args) {

        log:printInfo("------ Scheduling Appointments --------------");   

        (function() returns error?) onTriggerFunction = gitHubTaskExecute;
        (function(error)) onErrorFunction = gitGubTaskError;

        gitGubTask = new task:Appointment(onTriggerFunction, 
                                            onErrorFunction, 
                                            "0 30 1 * * ?");

        gitGubTask.schedule();
    }
}

@Description { value:"Execute the Github repository scanning task"}
function gitHubTaskExecute() returns (error?) {
    log:printInfo("Scanning the Github repository : " + repository);
    executedTaskCount = executedTaskCount + 1;
    if (executedTaskCount == 100) {
        log:printInfo("Stopping Appointment#1 cleanup task since it
                       has run 100 times");

        gitGubTask.cancel();
    }
    return cleanup();
}

@Description { value:"Execute the task cleanup"}
function cleanup() returns (error?) {
    //Call function here

    return ();
}

Any idea what is triggering this error? I want to implement a task which should be executed daily.

like image 864
Madhuka Wickramapala Avatar asked Dec 20 '25 03:12

Madhuka Wickramapala


1 Answers

Note that IdleTimeout triggers when the connection is idle for more than the specified period. Then the server/client would close the connection with an appropriate response. You can set it to >= 0 if you would like to disable it.

Sample client endpoint:

endpoint http:Client clientEndpoint {
    url: "http://localhost:9090",
    timeoutMillis: 300000
};

There is a configuration called timeoutInMillis in the http client and server endpoints. You can increase this value if it is the requirement.

like image 139
Riyafa Abdul Hameed Avatar answered Dec 22 '25 22:12

Riyafa Abdul Hameed