`Data.fetch` often leads to `error: closed` even in CI
Common CI failures like this one and also ...
When running program written by @jdunkerley that downloads HTTP pages from FIS web, I am often getting weird download exception:
Fetching https://www.fis-ski.com/DB/snowboard/alpine-snowboard/calendar-results.html?noselection=true&disciplinecode=SG%2CPGS%2CPSL%2CGS%2CSL%2CPRT&seasoncode=2024
Execution finished with an error: closed
at <java> java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.current(ResponseSubscribers.java:448)
at <java> java.net.http/jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.read(ResponseSubscribers.java:508)
at <java> java.base/java.io.InputStream.transferTo(InputStream.java:796)
at <enso> <anonymous>(lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Response_Body.enso:103:41-86)
at <enso> Managed_Resource.with(Internal)
at <enso> Output_Stream.with_java_stream(lib/Standard/Base/0.0.0-dev/src/System/Output_Stream.enso:87:31-59)
at <enso> <anonymous>(lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Response_Body.enso:101-105)
at <enso> Resource.bracket(Internal)
at <enso> File.with_output_stream<arg-2>(lib/Standard/Base/0.0.0-dev/src/System/File.enso:199:17-100)
at <enso> File.with_output_stream<arg-1>(lib/Standard/Base/0.0.0-dev/src/System/File.enso:196-199)
at <enso> Context.if_enabled(lib/Standard/Base/0.0.0-dev/src/Runtime.enso:183-185)
at <enso> File.with_output_stream(lib/Standard/Base/0.0.0-dev/src/System/File.enso:194-199)
at <enso> <anonymous>(lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Response_Body.enso:100-105)
at <enso> Managed_Resource.with(Internal)
at <enso> Temporary_File.with_file(lib/Standard/Base/0.0.0-dev/src/System/File/Advanced/Temporary_File.enso:41:29-60)
at <enso> case_branch<arg-1>(lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Response_Body.enso:99-105)
at <enso> Runtime.with_enabled_context(lib/Standard/Base/0.0.0-dev/src/Runtime.enso:233:5-80)
at <enso> Context.with_enabled(lib/Standard/Base/0.0.0-dev/src/Runtime.enso:207:9-78)
at <enso> case_branch(lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Response_Body.enso:96-107)
at <enso> <anonymous>(lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Response_Body.enso:94-107)
at <enso> Managed_Resource.with(Internal)
at <enso> Input_Stream.with_java_stream(lib/Standard/Base/0.0.0-dev/src/System/Input_Stream.enso:96:31-59)
at <enso> <anonymous>(lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Response_Body.enso:92-107)
at <enso> Resource.bracket(Internal)
at <enso> case_branch(lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Response_Body.enso:74:13-64)
at <enso> Response_Body.with_stream(lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Response_Body.enso:72-82)
at <enso> case_branch(lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Response_Body.enso:91-107)
at <enso> Response_Body.materialize(lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Response_Body.enso:89-108)
at <enso> Response.with_materialized_body<arg-2>(lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Response.enso:45:52-72)
at <enso> Response.with_materialized_body(lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Response.enso:45:9-72)
at <enso> case_branch<arg-if_unsupported>(lib/Standard/Base/0.0.0-dev/src/Internal/Data_Read_Helpers.enso:44:62-92)
at <enso> case_branch<arg-1>(lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Response_Body.enso:126:52-129)
at <enso> case_branch(lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Response_Body.enso:126-127)
at <enso> Response_Body.decode<arg-1>(Internal)
at <enso> case_branch(lib/Standard/Base/0.0.0-dev/src/System/File_Format.enso:112:18-23)
at <enso> File_Format.handle_format_missing_arguments(lib/Standard/Base/0.0.0-dev/src/System/File_Format.enso:109-112)
at <enso> Response_Body.decode(lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Response_Body.enso:123-132)
at <enso> Response.decode(lib/Standard/Base/0.0.0-dev/src/Network/HTTP/Response.enso:133:9-46)
at <enso> case_branch(lib/Standard/Base/0.0.0-dev/src/Internal/Data_Read_Helpers.enso:44:17-92)
at <enso> Data_Read_Helpers.decode_http_response_following_data_links<arg-2>(lib/Standard/Base/0.0.0-dev/src/Internal/Data_Read_Helpers.enso:39-44)
at <enso> Data_Read_Helpers.decode_http_response_following_data_links(lib/Standard/Base/0.0.0-dev/src/Internal/Data_Read_Helpers.enso:38-44)
at <enso> Data_Read_Helpers.fetch_following_data_links(lib/Standard/Base/0.0.0-dev/src/Internal/Data_Read_Helpers.enso:32:5-61)
at <enso> Data.fetch(lib/Standard/Base/0.0.0-dev/src/Data.enso:194:5-132)
at <enso> Download.download_extract(Download.enso:11:21-34)
at <enso> Download.main(Download.enso:103:21-69)
originally I thought the exception is caused by slow network connection, but right now I am connected over fast line and I've just got the error again.
Looks like the exception can happen on CI as well.
The code of the Enso project is available as revision d800bec0d. It can be executed as:
enso --run SCMrozdeleni
it starts to download a lot of HTML pages and often (but not always) fails.
NASDAQ example has tendency to have timeouts when executing, probably a good one to look at
Fixed with retries by @hubertp