Details
-
Bug
-
Resolution: Done
-
Major
-
1.2.0.Final
-
None
Description
OAuth2SaslClientV10Test or OAuth2SaslClientV11Test intermittently fails during MockWebServer binding, for example for OAuth2SaslClientV10Test:
java.net.BindException: Address already in use (Bind failed) at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387) at java.net.ServerSocket.bind(ServerSocket.java:375) at okhttp3.mockwebserver.MockWebServer.start(MockWebServer.java:317) at okhttp3.mockwebserver.MockWebServer.start(MockWebServer.java:300) at okhttp3.mockwebserver.MockWebServer.start(MockWebServer.java:289) at org.wildfly.security.sasl.oauth2.OAuth2SaslClientV10Test.onBefore(OAuth2SaslClientV10Test.java:82)
When this happens it causes only one of test methods to fail. Other tests in OAuth2SaslClientV10Test/OAuth2SaslClientV11Test finish successfully. It seems this test issue is not depended on any platform or JDK.
Part of log when test fails:
... 04:44:06,995 TRACE (main) [org.wildfly.security] <ServerAuthenticationContext.java:1015> Handling AuthenticationCompleteCallback: succeed 04:44:06,995 TRACE (main) [org.wildfly.security] <ServerAuthenticationContext.java:1032> Handling SecurityIdentityCallback: identity = SecurityIdentity{principal=jdoe, securityDomain=org.wildfly.security.auth.server.SecurityDomain@e7f11d, authorizationIdentity=org.wildfly.security.auth.realm.token.TokenSecurityRealm$TokenRealmIdentity$1@3d687a, realmInfo=RealmInfo{name='oauth-realm', securityRealm=org.wildfly.security.auth.realm.token.TokenSecurityRealm@a370f4}, creationTime=2018-02-27T09:44:06.981Z} 04:44:06,996 INFO (MockWebServer 50831) [okhttp3.mockwebserver.MockWebServer] <MockWebServer.java:349> MockWebServer[50831] done accepting connections: Socket closed 04:44:12,006 INFO (MockWebServer 50831) [okhttp3.mockwebserver.MockWebServer] <MockWebServer.java:323> MockWebServer[50831] starting to accept connections 04:44:12,006 TRACE (main) [org.wildfly.security] <AuthenticationContextConfigurationClient.java:121> getAuthenticationConfiguration uri=protocol://test7.org, protocolDefaultPort=-1, abstractType=null, abstractTypeAuthority=null, MatchRule=[host=test7.org], AuthenticationConfiguration=[AuthenticationConfiguration:principal=anonymous,set-host=test7.org,set-protocol=protocol,credentials-present,providers-supplier=org.wildfly.security.auth.client.ElytronXmlParser$DeferredSupplier@18ca3c8,mechanism-properties={wildfly.sasl.local-user.quiet-auth=true}] 04:44:12,008 TRACE (main) [org.wildfly.security] <SecurityProviderSaslClientFactory.java:114> Created SaslClient for mechanism OAUTHBEARER, using Provider WildFlyElytron and protocol protocol ...
It also causes that Exception is thrown during @After for the same test, example for OAuth2SaslClientV10Test:
java.io.IOException: Gave up waiting for executor to shut down
at okhttp3.mockwebserver.MockWebServer.shutdown(MockWebServer.java:375)
at org.wildfly.security.sasl.oauth2.OAuth2SaslClientV10Test.onAfter(OAuth2SaslClientV10Test.java:88)
After those exceptions in @Before and @After are thrown for some particular test then all following tests works correctly.