Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: What would cause a timeout to an external API at exactly 120 seconds
I have a portlet that makes a call to a long running API. What is
interesting is that I have a development environment that does not
time out yet the production environment will time out (actually with
an HTTP 502 error) at exactly 120 seconds. I don't belive that there
is any issue at the remote since it will successfully run in
development. Both the production and development environment use the
same outbound routing and gateway.
The only notable difference is that the production environment
is Linux (CENTOS) and the development environment is Windows 10.
Otherwise the Liferay version is the same: 7.3.2-ga3 and the module
deplyed is the same. I checked the server.xml,
context.xml, portal-ext.properties and they are the same. I suspect
that I made a change to a variable *somewhere* but I cannot find any
difference in either environment that would point to a change.
FWIW the API is accessed via a REST call using HttpsURLConnection.
Can you think of a setting in Liferay that might affect a
timeout for an external API call? I haven't been able to find
anything.
HttpURLConnection con = (HttpURLConnection) new URL(url).openConnection();
con.setConnectTimeout(your_time);
Just set the timeout to "your_time" milliseconds
Thanks Gennaro. I have seen that suggestion in other forums. What I
don't understand is why it would work, without setting that value, in
a development environment but would be needed in production.. I would
understand that change if it timed out at 120 seconds in both the
development and production environments since the same module/portlet
would be deployed in both.
But, perhaps it will override any other setting so I'll
give it a try. Thanks for the suggestion.
Pete
Again, thanks.
More digging... turns out the one difference between the
development and production system is that the production instance is
front-ended by Apache and the Apache instance is a reverse proxy with
a value of "ProxyPass / http://XXX.XXX.XXX.XXX:7080/ timeout=120
retry=0" Exactly two minutes.
So, it was a configuration setting...but in Apache HTTP rather
than Liferay.
Thanks for all the suggestions.
Powered by Liferay™