I have a Python application that runs for 30 minutes. Within the program, every 30 seconds, I am snapping values for a set of ~40 RICs. So, every 30 seconds, I do this:
rdp_session = rdp.open_platform_session( RT_APP_KEY, rdp.GrantPassword( username=RT_RDP_LOGIN, password=RT_RDP_PASSWORD ) ) snap = rdp.get_snapshot(universe = RIC_UNIVERSE, fields = ['BID','ASK'] ) rdp_session.close()
While it generally works, sometimes it throws random authorization errors. This is what the error looks like on the RDP side:
2021-10-13 06:02:50,409 ERROR [ajp-apr-8280-exec-226] OpenAMRestProxy authenticateModule [GE-6180] - class org.springframework.web.client.ResourceAccessException org.springframework.web.client.ResourceAccessException: I/O error on POST request for "http://localhost/openam/json/authenticate": Read timed out; nested exception is java.net.SocketTimeoutException: Read timed out at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:666) 2021-10-13 06:02:50,927 ERROR [ajp-apr-8280-exec-226] OpenAMRestProxy authenticateModule [GE-6180] - HttpClientErrorException: org.springframework.web.client.HttpClientErrorException: 400 Bad Request 2021-10-13 06:02:51,446 ERROR [ajp-apr-8280-exec-226] AuthApiController handleOpenAmRestException [GE-6180] - OpenAmRestException code: 401, message: null, errorCode: 107, errorMessage: Authentication Failed. com.tr.aaa.as.exception.OpenAmRestException 2021-10-13 06:02:51,446 INFO [ajp-apr-8280-exec-226] HistoricalErrorLogger logHistoricalError [GE-6180] - GrantType::null, Id::GE-A-01103867-3-6180, SessionId::null, AppId::f25d914da4b849d2be537c891b103c3b83724f26, RefreshToken::null, DeviceId::null, Exception::(name=class com.tr.aaa.as.exception.OpenAmRestException, message=null), HTTP Status::401(Unauthorized), errorCode::107, errorMessage::Authentication Failed.
I am told that I should be doing a refresh instead of the process above, and that I'm "flooding" the system (one call every 30 seconds? Really?). In any event, can someone provide a code snippet that would reflect the preferred best practice? Keeping in mind that the program needs to be 100% stable, and that random authorization errors are not even slightly acceptable.
Would it be possible to know what threshold I'm violating that's causing an issue? And would it be possible for the authorization server to correctly state the actual issue, rather than just serving back a generic authorization failure or bad request message? When a credential works, then 30 seconds later, it (apparently randomly) doesn't work, saying it's an "authorization failure" is not helpful.