[OPENAM-11876] Amster has a timeout limit of 10 second and it is not configurable Created: 29/Sep/17  Updated: 21/Aug/19  Resolved: 08/Jul/19

Status: Closed
Project: OpenAM
Component/s: Amster
Affects Version/s: 14.0.0, 14.1.0, 14.1.1
Fix Version/s: 6.0.0, 5.5.2

Type: Bug Priority: Major
Reporter: Sam Phua Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: AME
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
is related to OPENAM-12373 amster transport key makes rest opera... Resolved
Epic Link: AMster (Phase III)
Support Ticket IDs:

 Description   

Bug description

The issue can be easily reproduced by "hanging" the OpenAM

kill -stop < OpenAM pid > 
( run kill -cont < OpenAM pid > to continue  )

running amster with a -d
followed by import or export

 

[main] DEBUG org.forgerock.openam.amster.loadster.importer.Importer - Exception occurred when reading file.
org.forgerock.openam.sdk.http.ServerErrorException: 502 Bad Gateway

 at org.forgerock.openam.sdk.http.DefaultErrorHandler.onServerError(DefaultErrorHandler.java:62)
 at org.forgerock.openam.sdk.http.HttpSessionImpl.handleUnsuccessfulResponse(HttpSessionImpl.java:273)
 at org.forgerock.openam.sdk.http.HttpSessionImpl.send(HttpSessionImpl.java:169)
 at org.forgerock.openam.sdk.http.RequestBuilder.put(RequestBuilder.java:226)
 at org.forgerock.openam.sdk.crest.CrestResourceProviderAsync.updateInstance(CrestResourceProviderAsync.java:185)
 at org.forgerock.openam.sdk.crest.CrestResourceProviderAsync.update(CrestResourceProviderAsync.java:155)
 at org.forgerock.openam.sdk.crest.HttpCrestResourceProvider.update(HttpCrestResourceProvider.java:158)
 at org.forgerock.openam.sdk.operations.CrestOperations.update(CrestOperations.java:119)
 at org.forgerock.openam.amster.loadster.importer.GenericImporter.importEntity(GenericImporter.groovy:55)
 at org.forgerock.openam.amster.loadster.importer.GenericImporter.importFile(GenericImporter.groovy:33)
 at org.forgerock.openam.amster.loadster.importer.Importer.importFile(Importer.groovy:178)
 at org.forgerock.openam.amster.loadster.importer.Importer.access$0(Importer.groovy)
 at org.forgerock.openam.amster.loadster.importer.Importer$_importGlobalEntities_closure4.doCall(Importer.groovy:134)
< skippe > 
[main] DEBUG org.forgerock.openam.amster.loadster.importer.Importer - Importing file /work/openam5.0.0-amster-import-23913/exported-configuration-data/global/AmsterModule.json
[main] DEBUG org.forgerock.openam.sdk.http.HttpSessionImpl - Sending request org.forgerock.sdk.org.forgerock.http.protocol.Request@237dfbbe
[main] DEBUG org.forgerock.sdk.org.apache.http.client.protocol.RequestAuthCache - Auth cache not set in the context
[main] DEBUG org.forgerock.sdk.org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection request: [route: {}->http://openam.internal.example.com:8080][total kept alive: 0; route allocated: 0 of 64; total allocated: 0 of 64]
[main] DEBUG org.forgerock.sdk.org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection leased: [id: 46][route: {}->http://openam.internal.example.com:8080][total kept alive: 0; route allocated: 1 of 64; total allocated: 1 of 64]
[main] DEBUG org.forgerock.sdk.org.apache.http.impl.execchain.MainClientExec - Opening connection {}->http://openam.internal.example.com:8080
[main] DEBUG org.forgerock.sdk.org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connecting to openam.internal.example.com/172.28.1.229:8080
[main] DEBUG org.forgerock.sdk.org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connection established 172.28.1.229:50016<->172.28.1.229:8080

[main] DEBUG org.forgerock.sdk.org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-46: set socket timeout to 10000

 

 



 Comments   
Comment by Mark de Reeper [ 29/Sep/17 ]

From ConnectCommand.groovy, the timeout would need to be configured during the execute() call:

try {
    withCloseable(new HttpClientHandler(), { handler ->
        def client = new Client(handler);
        def token = connectionHandler.connect(client)
        if (token) {
            def info = client.send(new Request().setMethod("GET").setUri(authArgs.jsonUrl + SERVERINFO))
                    .get().entity.json as Map<String, String>
            Main.setPrompt("amster " + authArgs.jsonUrl.split("/")[2] + ">")
            getBinding().setVariable("amUrl", new URI(authArgs.jsonUrl))
            getBinding().setVariable("ssoTokenId", token)
            getBinding().setVariable("tokenHeader", new GenericHeader(info["cookieName"], token))
            getBinding().setVariable("restSdk", new SDK(new ConfigImpl.Builder()
                    .withServerUrl(authArgs.baseUrl)
                    .withCredentials(new SsoTokenCredentials(token)).build()))
        }
    })

The ConfigImpl.Builder() from the AM REST SDK has methods to set the read timeout as well as connection timeouts:

withConnectTimeout(long timeout, TimeUnit unit)
withReadTimeout(long timeout, TimeUnit unit)

As already noted, they both have a default of 10sec:

        private long connectTimeoutMillis = TimeUnit.SECONDS.toMillis(10);
        private long readTimeoutMillis = TimeUnit.SECONDS.toMillis(10);
Comment by Jonathan Thomas [ 02/Feb/18 ]

This is a symptom of other issues such as memory leaks and in a correctly working environment 10 seconds should be sufficient

Comment by Peter Major [X] (Inactive) [ 04/Jul/19 ]

Amster should use paged queries for all the endpoints by default...

Comment by C-Weng C [ 21/Aug/19 ]

The only thing the timeout does not work is when it is related to operations that is not related to "connect" So "install-amster" that takes > 10 sec may fail.

Generated at Sun Sep 27 22:47:27 UTC 2020 using Jira 7.13.12#713012-sha1:6e07c38070d5191bbf7353952ed38f111754533a.