这种情况不定期发生,但是几乎每天提交用户凭据的用户都必须等待几分钟才能完成身份验证。浏览器正在等待响应。重新启动tomcat将在一段时间内有所帮助。 Postgresql运行良好,并且具有足够的容量来处理新连接。任何想法如何解决这个问题?我们在第二周与之抗争,我们几乎尝试了一切。
环境:
配置
<Realm className="org.apache.catalina.realm.JDBCRealm"
connectionName="XXXXXX" connectionPassword="YYYYYYY"
connectionURL="jdbc:postgresql://10.100.123.10:5432/pmgviewer"
userRoleTable="userroles" userTable="tomcatusers"
roleNameCol="userrole" userCredCol="passwd" userNameCol="username"
driverName="org.postgresql.Driver"
maxActive="40" maxIdle="10" maxWait="10000"
validationQuery="SELECT 1" validationInterval="30000"
testWhileIdle="true" testOnBorrow="true" testOnReturn="false">
<CredentialHandler className="org.apache.catalina.realm.MessageDigestCredentialHandler" algorithm="SHA-256" />
</Realm>
线程
"https-jsse-nio-9443-exec-22" #149 daemon prio=5 os_prio=0 tid=0x00007f7e4802d000 nid=0x257c runnable [0x00007f7e29ea0000]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:171)
at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:983)
- locked <0x00000000e5190b70> (a java.lang.Object)
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:940)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:105)
- locked <0x00000000e5191c38> (a sun.security.ssl.AppInputStream)
at org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:140)
at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:109)
at org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:67)
at org.postgresql.core.PGStream.receiveChar(PGStream.java:306)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1952)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308)
- locked <0x00000000e5192a40> (a org.postgresql.core.v3.QueryExecutorImpl)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:143)
at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:106)
at org.apache.catalina.realm.JDBCRealm.getPassword(JDBCRealm.java:538)
- locked <0x00000000e00351f0> (a org.apache.catalina.realm.JDBCRealm)
at org.apache.catalina.realm.JDBCRealm.authenticate(JDBCRealm.java:385)
- locked <0x00000000e00351f0> (a org.apache.catalina.realm.JDBCRealm)
at org.apache.catalina.realm.JDBCRealm.authenticate(JDBCRealm.java:328)
- locked <0x00000000e00351f0> (a org.apache.catalina.realm.JDBCRealm)
at org.apache.catalina.authenticator.FormAuthenticator.doAuthenticate(FormAuthenticator.java:264)
日志
Mar 07, 2019 2:53:54 PM org.apache.catalina.realm.JDBCRealm getPassword
SEVERE: Exception performing authentication
org.postgresql.util.PSQLException: An I/O error occurred while sending to the backend.
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:335)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
Caused by: java.net.SocketException: Connection timed out (Read failed)
at java.net.SocketInputStream.socketRead0(Native Method)