Server stop functioning unexpectedly
Closed this issue · 1 comments
I've noticed this with google idp, but haven't experienced it with idporten so far. Sometimes after logging into google and logging out, when logging in again, the server freezes after user has pressed "Allow". I've noticed it happening at 2nd and 3rd login at same browser session, but the source of the problem is yet to be discovered. The browser freezes for the user and the server as well, requiring the server to be restarted to start working. After freeze, no paths on localhost works. No exception is triggered or indicated through logging. The last lines upon server freeze are:
[2016-07-27 12:54:57][DEBUG][nioEventLoopGroup-2-1][InboundHandlerAdapter]: localhost:8080/google?code=4/Tb8qZnHcb3gE8pVaObtMi2p1CBKKbWNFATtps4t2TyI is secured
[2016-07-27 12:54:57][DEBUG][nioEventLoopGroup-2-1][InboundHandlerAdapter]: Has identity provider: no.difi.idporten.oidc.proxy.idp.GoogleIdentityProvider@c22d75d
[2016-07-27 12:54:57][DEBUG][nioEventLoopGroup-2-1][InboundHandlerAdapter]: TypesafePathConfig contains code: /google?code=4/Tb8qZnHcb3gE8pVaObtMi2p1CBKKbWNFATtps4t2TyI
[2016-07-27 12:54:57][DEBUG][nioEventLoopGroup-2-1][GoogleIdentityProvider]: Created post request:
POST https://www.googleapis.com/oauth2/v3/token HTTP/1.1
[]
[Content-Type: application/x-www-form-urlencoded,Content-Length: 320,Chunked: false]
I think the problem is with the apache.http.client.HttpClient in AbstractIdentityProvider. It gets messed up somehow after making several requests.
It can be solved by instantiating a new HttpClient whenever an IdentityProvider is instantiated.