set connection timeout in java for MPS client

2 views (last 30 days)
Hi,
Based on Java documentation in MPS guide, I configured a 5 minute connection timeout as below:
However, I have a long running Matlab function on MPS and it times out after just 1 minute and not 5...
I get the error:
! com.mathworks.mps.client.MWHttpException: Failed HTTP request; Response Status: 504, Response Message: Gateway Time-out
! at com.mathworks.mps.client.internal.SunHttpClientFevalHandler.processRequest(Unknown Source)
! at com.mathworks.mps.client.internal.ComponentProxy.processRequest(Unknown Source)
! at com.mathworks.mps.client.internal.ComponentProxy.invoke(Unknown Source)
! at com.mathworks.mps.client.internal.SingleOutputDispatcher.dispatch(Unknown Source)
! at com.mathworks.mps.client.internal.MWClientInvocationHandler.invoke(Unknown Source)
! at com.sun.proxy.$Proxy75.CompareModels(Unknown Source)
What am I doing wrong?
static class MyClientConfig extends MWHttpClientDefaultConfig {
public long getTimeOutMs() {
log.info("MPS timeout set to 5 minutes");
return 5*6*1000; // 5 minutes
}
}
MWHttpClient client = new MWHttpClient(new MyClientConfig());

Answers (2)

Kojiro Saito
Kojiro Saito on 7 Jan 2022
5*6*1000 is 30000 milliseconds (=30 seconds). Are you sure you set 5*60*1000 ?
public long getTimeOutMs() {
log.info("MPS timeout set to 5 minutes");
return 5*60*1000; // 5 minutes
}

Jason Novotny
Jason Novotny on 7 Jan 2022
The issue resulted from the Elastic Load Balancer configuration in AWS which has a default of 60 seconds.

Products


Release

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!