B4J Question [SERVER] javax.net.ssl.SSLProtocolException: Connection reset by peer: socket write error (when running in release mode S3 Bucket)

juventino883

Member
Licensed User
Longtime User
Hi, I'm working on a project where I'm using S3 buckets to store files and I'm using the code made by @JackKirk (https://www.b4x.com/android/forum/t...re-calculator-b4x-works-on-b4a-b4i-b4j.81272/), I'm doing a non ui app and when I test the code in Debug mode everithing is working as expected, but when it is in release mode I get:
Error Log:
javax.net.ssl.SSLProtocolException: Connection reset by peer: socket write error
    at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:126)
    at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:321)
    at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:264)
    at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:259)
    at java.base/sun.security.ssl.SSLSocketImpl$AppOutputStream.write(SSLSocketImpl.java:988)
    at okio.Okio$1.write(Okio.java:78)
    at okio.AsyncTimeout$1.write(AsyncTimeout.java:179)
    at okio.RealBufferedSink.emitCompleteSegments(RealBufferedSink.java:171)
    at okio.RealBufferedSink.write(RealBufferedSink.java:41)
    at okhttp3.internal.http1.Http1Codec$FixedLengthSink.write(Http1Codec.java:287)
    at okio.RealBufferedSink.emitCompleteSegments(RealBufferedSink.java:171)
    at okio.RealBufferedSink.write(RealBufferedSink.java:85)
    at anywheresoftware.b4h.okhttp.OkHttpClientWrapper$PostPayload.writeTo(OkHttpClientWrapper.java:538)
    at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:48)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:179)
    at okhttp3.RealCall.execute(RealCall.java:63)
    at anywheresoftware.b4h.okhttp.OkHttpClientWrapper.executeWithTimeout(OkHttpClientWrapper.java:156)
    at anywheresoftware.b4h.okhttp.OkHttpClientWrapper.access$0(OkHttpClientWrapper.java:153)
    at anywheresoftware.b4h.okhttp.OkHttpClientWrapper$ExecuteHelper.run(OkHttpClientWrapper.java:201)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.net.SocketException: Connection reset by peer: socket write error
    at java.base/java.net.SocketOutputStream.socketWrite0(Native Method)
    at java.base/java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:110)
    at java.base/java.net.SocketOutputStream.write(SocketOutputStream.java:150)
    at java.base/sun.security.ssl.SSLSocketOutputRecord.deliver(SSLSocketOutputRecord.java:320)
    at java.base/sun.security.ssl.SSLSocketImpl$AppOutputStream.write(SSLSocketImpl.java:983)
    ... 31 more
ResponseError. Reason: javax.net.ssl.SSLProtocolException: Connection reset by peer: socket write error, Response:
JobName = AWS_job2, Success = false
Error: javax.net.ssl.SSLProtocolException: Connection reset by peer: socket write error

I know that in debug everithing runs in the main thread so I'm thinking on maybe doing the upload process in the main thread but I think that's not a good practice if you have several concurrent uploads, what do you think? or maybe I'm using websockets in a wrong way?

attached you will find a small test file with a test bucket account.

Thanks in advance ;)
 

Attachments

  • pruebasrvramzn.zip
    17.8 KB · Views: 243

drgottjr

Expert
Licensed User
Longtime User
no ssl error, but a different one. look, i only tried the project because ssl errors are of particular interest to me. i was hoping to see one. i don't think i'll be much help to you here. i tried deleting my post, but you were too fast. so i'll bow out now in a more graceful way. sorry to waste your time.
 

Attachments

  • capture.png
    capture.png
    10.8 KB · Views: 323
Upvote 0

juventino883

Member
Licensed User
Longtime User
hey don't worry and thanks ;) I forgot to mention that upload size was limited to 10MB by this line
B4X:
Dim data As Map = req.GetMultipartData(Main.TempDir,10000000)

I think I have an old file that drove me crazy some years ago with a lot of ssl errors, I think it is in my old pc if I find it I will upload into the forum and will mention you.
 
Upvote 0

Similar Threads

Top