-1

I have an http 401 error when calling an endpoint (deployed in wildfly) that require more than 5 minutes to process the request and it seems like the server side close the connection after exactly 5 minutes.

The trace execution is as follow:

2024-06-27 16:54:50,339 DEBUG [org.apache.http.impl.conn.PoolingClientConnectionManager] (pool-threads-worker-http task-51) Connection request: [route: {s}->https://rct.server.com][total kept alive: 1; route allocated: 1 of 10; total allocated: 1 of 30]
2024-06-27 16:54:50,339 DEBUG [org.apache.http.impl.conn.PoolingClientConnectionManager] (pool-threads-worker-http task-51) Connection leased: [id: 0][route: {s}->https://rct.server.com][total kept alive: 0; route allocated: 1 of 10; total allocated: 1 of 30]
2024-06-27 16:54:50,339 DEBUG [org.apache.http.impl.client.DefaultHttpClient] (pool-threads-worker-http task-51) Stale connection check
2024-06-27 16:54:50,342 DEBUG [org.apache.http.impl.client.DefaultHttpClient] (pool-threads-worker-http task-51) Attempt 1 to execute request
2024-06-27 16:54:50,342 DEBUG [org.apache.http.impl.conn.DefaultClientConnection] (pool-threads-worker-http task-51) Sending request: GET /auth/realms/server/protocol/openid-connect/userinfo HTTP/1.1
2024-06-27 16:54:50,390 DEBUG [org.apache.http.impl.conn.DefaultClientConnection] (pool-threads-worker-http task-51) Receiving response: HTTP/1.1 200 OK
2024-06-27 16:54:50,391 DEBUG [org.apache.http.impl.client.DefaultHttpClient] (pool-threads-worker-http task-51) Connection can be kept alive indefinitely
2024-06-27 16:54:50,407 DEBUG [org.apache.http.impl.conn.PoolingClientConnectionManager] (pool-threads-worker-http task-51) Connection [id: 0][route: {s}->https://rct.server.com] can be kept alive indefinitely
2024-06-27 16:54:50,407 DEBUG [org.apache.http.impl.conn.PoolingClientConnectionManager] (pool-threads-worker-http task-51) Connection released: [id: 0][route: {s}->https://rct.server.com][total kept alive: 1; route allocated: 1 of 10; total allocated: 1 of 30]
2024-06-27 16:54:53,389 INFO  [com.server.PositionsResource] (pool-threads-worker-http task-51) Begin Server createHttp401Error...

2024-06-27 16:59:51,529 DEBUG [org.apache.http.impl.conn.PoolingClientConnectionManager] (pool-threads-worker-http task-54) Connection request: [route: {s}->https://rct.server.com][total kept alive: 1; route allocated: 1 of 10; total allocated: 1 of 30]
2024-06-27 16:59:51,530 DEBUG [org.apache.http.impl.conn.PoolingClientConnectionManager] (pool-threads-worker-http task-54) Connection leased: [id: 0][route: {s}->https://rct.server.com][total kept alive: 0; route allocated: 1 of 10; total allocated: 1 of 30]
2024-06-27 16:59:51,530 DEBUG [org.apache.http.impl.client.DefaultHttpClient] (pool-threads-worker-http task-54) Stale connection check
2024-06-27 16:59:51,537 DEBUG [org.apache.http.impl.client.DefaultHttpClient] (pool-threads-worker-http task-54) Stale connection detected
2024-06-27 16:59:51,537 DEBUG [org.apache.http.impl.conn.DefaultClientConnection] (pool-threads-worker-http task-54) Connection 0.0.0.0:30122<->10.181.72.28:443 closed
2024-06-27 16:59:51,555 DEBUG [org.apache.http.impl.client.DefaultHttpClient] (pool-threads-worker-http task-54) Attempt 1 to execute request
2024-06-27 16:59:51,555 DEBUG [org.apache.http.impl.conn.DefaultClientConnection] (pool-threads-worker-http task-54) Sending request: GET /auth/realms/server/protocol/openid-connect/userinfo HTTP/1.1
2024-06-27 16:59:51,569 DEBUG [org.apache.http.impl.conn.DefaultClientConnection] (pool-threads-worker-http task-54) Receiving response: HTTP/1.1 401 Unauthorized
2024-06-27 16:59:51,569 DEBUG [org.apache.http.impl.client.DefaultHttpClient] (pool-threads-worker-http task-54) Connection can be kept alive indefinitely
2024-06-27 16:59:51,570 DEBUG [org.apache.http.impl.client.DefaultHttpClient] (pool-threads-worker-http task-54) rct.server.com:443 requested authentication
2024-06-27 16:59:51,571 DEBUG [org.apache.http.impl.conn.PoolingClientConnectionManager] (pool-threads-worker-http task-54) Connection [id: 0][route: {s}->https://rct.server.com] can be kept alive indefinitely
2024-06-27 16:59:51,572 DEBUG [org.apache.http.impl.conn.PoolingClientConnectionManager] (pool-threads-worker-http task-54) Connection released: [id: 0][route: {s}->https://rct.server.com][total kept alive: 1; route allocated: 1 of 10; total allocated: 1 of 30]

Is there a way to fix this 401 http exception and make the connection still alive till the process ends?

0

Browse other questions tagged or ask your own question.