setup-java icon indicating copy to clipboard operation
setup-java copied to clipboard

Download action is not handling the connection reset error properly

Open sureshg opened this issue 3 years ago • 1 comments

The connection reset error happened twice and it seems working ok. The main issue is, even though the download failed with connection reset, the step is marked as successful and moved to the next one. That shouldn't happen.

Screen Shot 2022-03-22 at 9 55 04 AM
Run oracle-actions/setup-java@v1
  with:
    website: jdk.java.net
    release: loom
    install: false
    version: latest
  env:
    GITHUB_PUBLISH: false
Run JAVA=$JAVA_HOME_17_X64/bin/java
  JAVA=$JAVA_HOME_17_X64/bin/java
  DOWNLOAD=$GITHUB_ACTION_PATH/src/Download.java
  if [ ! -z "" ]; then
    $JAVA $DOWNLOAD 
  else
    $JAVA $DOWNLOAD jdk.java.net loom latest
  fi
  shell: C:\Program Files\Git\bin\bash.EXE --noprofile --norc -e -o pipefail {0}
  env:
    GITHUB_PUBLISH: false
java.io.IOException: fixed content-length: 18941963[2](https://github.com/sureshg/openjdk-playground/runs/5614385112?check_suite_focus=true#step:4:2), bytes received: 41474110
Error: Error detected: java.io.IOException: fixed content-length: 1894196[3](https://github.com/sureshg/openjdk-playground/runs/5614385112?check_suite_focus=true#step:4:3)2, bytes received: [4](https://github.com/sureshg/openjdk-playground/runs/5614385112?check_suite_focus=true#step:4:4)1474110
	at java.net.http/jdk.internal.net.http.HttpClientImpl.send(HttpClientImpl.java:[5](https://github.com/sureshg/openjdk-playground/runs/5614385112?check_suite_focus=true#step:4:5)8[6](https://github.com/sureshg/openjdk-playground/runs/5614385112?check_suite_focus=true#step:4:6))
	at java.net.http/jdk.internal.net.http.HttpClientFacade.send(HttpClientFacade.java:123)
	at Download$Browser.download(Download.java:256)
	at Download$Downloader.downloadArchive(Download.java:162)
	at Download.main(Download.java:95)
	at Download.main(Download.java:3[7](https://github.com/sureshg/openjdk-playground/runs/5614385112?check_suite_focus=true#step:4:7))
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:56[8](https://github.com/sureshg/openjdk-playground/runs/5614385112?check_suite_focus=true#step:4:8))
	at jdk.compiler/com.sun.tools.javac.launcher.Main.execute(Main.java:41[9](https://github.com/sureshg/openjdk-playground/runs/5614385112?check_suite_focus=true#step:4:9))
	at jdk.compiler/com.sun.tools.javac.launcher.Main.run(Main.java:192)
	at jdk.compiler/com.sun.tools.javac.launcher.Main.main(Main.java:132)
Caused by: java.io.IOException: fixed content-length: 189419632, bytes received: 414741[10](https://github.com/sureshg/openjdk-playground/runs/5614385112?check_suite_focus=true#step:4:10)
	at java.net.http/jdk.internal.net.http.common.Utils.wrapWithExtraDetail(Utils.java:351)
	at java.net.http/jdk.internal.net.http.Http1Response$BodyReader.onReadError(Http1Response.java:760)
	at java.net.http/jdk.internal.net.http.Http1AsyncReceiver.checkForErrors(Http1AsyncReceiver.java:302)
	at java.net.http/jdk.internal.net.http.Http1AsyncReceiver.flush(Http1AsyncReceiver.java:268)
	at java.net.http/jdk.internal.net.http.common.SequentialScheduler$LockingRestartableTask.run(SequentialScheduler.java:205)
	at java.net.http/jdk.internal.net.http.common.SequentialScheduler$CompleteRestartableTask.run(SequentialScheduler.java:149)
	at java.net.http/jdk.internal.net.http.common.SequentialScheduler$SchedulableTask.run(SequentialScheduler.java:230)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:[11](https://github.com/sureshg/openjdk-playground/runs/5614385112?check_suite_focus=true#step:4:11)36)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.net.SocketException: Connection reset
	at java.base/sun.nio.ch.SocketChannelImpl.throwConnectionReset(SocketChannelImpl.java:394)
	at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:426)
	at java.net.http/jdk.internal.net.http.SocketTube.readAvailable(SocketTube.java:1170)
	at java.net.http/jdk.internal.net.http.SocketTube$InternalReadPublisher$InternalReadSubscription.read(SocketTube.java:833)
	at java.net.http/jdk.internal.net.http.SocketTube$SocketFlowTask.run(SocketTube.java:181)
	at java.net.http/jdk.internal.net.http.common.SequentialScheduler$SchedulableTask.run(SequentialScheduler.java:230)
	at java.net.http/jdk.internal.net.http.common.SequentialScheduler.runOrSchedule(SequentialScheduler.java:303)
	at java.net.http/jdk.internal.net.http.common.SequentialScheduler.runOrSchedule(SequentialScheduler.java:256)
	at java.net.http/jdk.internal.net.http.SocketTube$InternalReadPublisher$InternalReadSubscription.signalReadable(SocketTube.java:774)
	at java.net.http/jdk.internal.net.http.SocketTube$InternalReadPublisher$ReadEvent.signalEvent(SocketTube.java:957)
	at java.net.http/jdk.internal.net.http.SocketTube$SocketFlowEvent.handle(SocketTube.java:253)
	at java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.handleEvent(HttpClientImpl.java:979)
	at java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.lambda$run$3(HttpClientImpl.java:934)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:[15](https://github.com/sureshg/openjdk-playground/runs/5614385112?check_suite_focus=true#step:4:15)11)
	at java.net.http/jdk.internal.net.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:9[34](https://github.com/sureshg/openjdk-playground/runs/5614385112?check_suite_focus=true#step:4:34))

sureshg avatar Mar 22 '22 16:03 sureshg

Thanks for the heads-up, Suresh. Will take a look later this week.

sormuras avatar Mar 22 '22 17:03 sormuras

Hi, I am having the same issue when downloading the latest EA builds. The major issue is, the action is marked success even when the download fails.

Run oracle-actions/setup-java@main
  with:
    website: jdk.java.net
    release: ea
    version: latest
    install: false
  env:
    releaseBuild: false
Run echo "::group::Prepare download..."
Prepare download...
java.io.IOException: fixed content-length: 2048[1](https://github.com/sureshg/kotlin-mpp-playground/actions/runs/10495200767/job/29073143996#step:3:1)3376, bytes received: 45570888
Error: Error detected: java.io.IOException: fixed content-length: [2](https://github.com/sureshg/kotlin-mpp-playground/actions/runs/10495200767/job/29073143996#step:3:2)04813376, bytes received: 45570888
	at java.net.http/jdk.internal.net.http.HttpClientImpl.send(HttpClientImpl.java:964)
	at java.net.http/jdk.internal.net.http.HttpClientFacade.send(HttpClientFacade.java:1[3](https://github.com/sureshg/kotlin-mpp-playground/actions/runs/10495200767/job/29073143996#step:3:3)3)
	at Download$Browser.download(Download.java:287)
	at Download$Downloader.downloadArchive(Download.java:175)
	at Download.main(Download.java:100)
	at Download.main(Download.java:[4](https://github.com/sureshg/kotlin-mpp-playground/actions/runs/10495200767/job/29073143996#step:3:4)2)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:[5](https://github.com/sureshg/kotlin-mpp-playground/actions/runs/10495200767/job/29073143996#step:3:5)80)
	at jdk.compiler/com.sun.tools.javac.launcher.Main.execute(Main.java:484)
	at jdk.compiler/com.sun.tools.javac.launcher.Main.run(Main.java:208)
	at jdk.compiler/com.sun.tools.javac.launcher.Main.main(Main.java:135)
Caused by: java.io.IOException: fixed content-length: 20481337[6](https://github.com/sureshg/kotlin-mpp-playground/actions/runs/10495200767/job/29073143996#step:3:6), bytes received: 455[7](https://github.com/sureshg/kotlin-mpp-playground/actions/runs/10495200767/job/29073143996#step:3:7)0888
	at java.net.http/jdk.internal.net.http.common.Utils.wrapWithExtraDetail(Utils.java:391)
	at java.net.http/jdk.internal.net.http.Http1Response$BodyReader.onReadError(Http1Response.java:676)
	at java.net.http/jdk.internal.net.http.Http1AsyncReceiver.checkForErrors(Http1AsyncReceiver.java:302)
	at java.net.http/jdk.internal.net.http.Http1AsyncReceiver.flush(Http1AsyncReceiver.java:26[8](https://github.com/sureshg/kotlin-mpp-playground/actions/runs/10495200767/job/29073143996#step:3:8))
	at java.net.http/jdk.internal.net.http.common.SequentialScheduler$LockingRestartableTask.run(SequentialScheduler.java:182)
	at java.net.http/jdk.internal.net.http.common.SequentialScheduler$CompleteRestartableTask.run(SequentialScheduler.java:14[9](https://github.com/sureshg/kotlin-mpp-playground/actions/runs/10495200767/job/29073143996#step:3:10))
	at java.net.http/jdk.internal.net.http.common.SequentialScheduler$SchedulableTask.run(SequentialScheduler.java:207)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.net.SocketException: Connection reset

sureshg avatar Aug 21 '24 18:08 sureshg

Thanks for the reminder, @sureshg! Now any exception is propagated as an error (after being logged to the GHA console) which results in a non-zero return code of the java[.exe] process - which in turn fails the download step of the action.

sormuras avatar Aug 22 '24 08:08 sormuras