oracle-ords-client is a JavaScript library that defines a simple and consistent abstraction for interacting with a Oracle Cloud Autonomous Databases via Oracle ORDS Database Management REST API.
A java app encountered a weird SSL Connection Reset issue while upgrading to use java11. it talked to a legacy service, it works very well while running with java8. somehow 40% percent requests will failure in SSLException after java11.
java.net.SocketException: Connection reset
at java.base/java.net.SocketInputStream.read(SocketInputStream.java:186)
at java.base/java.net.SocketInputStream.read(SocketInputStream.java:140)
at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:478)
at java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:472)
at java.base/sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:160)
at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:110)
at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1408)
at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1314)
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:440)
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:411)
Cause
The legacy server is running on Oracle WebLogic Server with java8. the server will reset the connection sometimes due to unknown reason.
Analysis
We are using HttpClients custom the default request config.
I thought it might be cipher suite not match or socket timeout issue. It turns out the not migrated app also will receive the connect reset from the legacy server after enable the logs. The difference from the logs are:
java.net.SocketException: Connection reset // the existed app with java8 runtime javax.net.ssl.SSLException: Connection reset // the new migrated app with java 11 runtime
I also observed the retry log from the existed app, but not see them in the new one. org.apache.http.impl.execchain.RetryExec : Retrying request to {s}
Which makes sense, the existed app will retry the requests and got successfully response finally when connection reset happened. but the new app just throw the exception.
Why requested failed with SSLException not retry, but SocketException retried?
It's been a while after I created adsense account to display ads on this blog. A few years later the payment finally reached my payout threshold, I just found the existed adsense account is bind to China. but I moved to Canada 3 years ago. I tried to change the country of it, but just found
Oracle Cloud provides you about 40G always free Autonomous JSON Database. That's a lot for your personal learning or blog. Let's find a way to utilize the free space in your web application. This is a step by step to set up a OAuth Client to connect your Oracle Cloud Autonomous Databases.
Create a user account
ADMIN is the default user and it has the administrator permission to your database. You don't want to your application use ADMIN user to connect. It is recommended to create a separate user per web application.
As the ADMIN user, access Database Actions and create a user with the required privileges.
Remember select "UNLIMITED" as Quota on table space DATA if you are not sure the quota size of your JSON document.
Enable REST for the new created user
Switch Authorization required on for security concern
Sign out as the ADMIN user and Sign in to Database Actions as the new user that is setting up to use OAuth authentication.
Create OAuth Client
input client information
Grant Required Roles
Grant Privileges
You just created a new OAuth Client, you will get a client id and secret.
After dive deep into Ghost open source, you can change the above /images/upload implementation and save the file to any external storages such as AWS s3.