Apache Solr open-source search software
SOLR-18027 Increase timeout for buildLocalAntoraSite (#3949)
Jan Høydahl8d3a800db1f6
diff --git a/solr/solr-ref-guide/build.gradle b/solr/solr-ref-guide/build.gradleindex d94227812dd..c791c4978f3 100644--- a/solr/solr-ref-guide/build.gradle+++ b/solr/solr-ref-guide/build.gradle@@ -405,7 +405,16 @@ task buildLocalAntoraSite(type: NpxTask) {"--fetch"] + extraArgs- environment = ["SITE_SEARCH_ENABLED": "true", "MATOMO_ENABLED": "false"]+ // Configure undici HTTP timeout via preload script to prevent timeout errors+ // when downloading UI bundle from slow networks (especially in CI)+ def nodeOptions = "--require ${projectDir}/increase-undici-timeout.js"++ environment = [+ "SITE_SEARCH_ENABLED": "true",+ "MATOMO_ENABLED": "false",+ "NODE_OPTIONS": nodeOptions,+ "UNDICI_TIMEOUT_MS": "60000" // 60 seconds timeout+ ]inputs.files(fileTree(project.ext.siteStagingDir))inputs.property("Antora version", libs.versions.antora.asProvider().get())@@ -500,7 +509,16 @@ task buildOfficialSite(type: NpxTask) {officialPlaybook,] + extraArgs- environment = ["SITE_SEARCH_ENABLED": "true", "MATOMO_ENABLED": "true"]+ // Configure undici HTTP timeout via preload script to prevent timeout errors+ // when downloading UI bundle from slow networks (especially in CI)+ def nodeOptions = "--require ${projectDir}/increase-undici-timeout.js"++ environment = [+ "SITE_SEARCH_ENABLED": "true",+ "MATOMO_ENABLED": "true",+ "NODE_OPTIONS": nodeOptions,+ "UNDICI_TIMEOUT_MS": "60000" // 60 seconds timeout+ ]inputs.files(officialPlaybook)inputs.property("Antora version", libs.versions.antora.asProvider().get())diff --git a/solr/solr-ref-guide/increase-undici-timeout.js b/solr/solr-ref-guide/increase-undici-timeout.jsnew file mode 100644index 00000000000..3940fe951d7--- /dev/null+++ b/solr/solr-ref-guide/increase-undici-timeout.js@@ -0,0 +1,45 @@+/*+ * Licensed to the Apache Software Foundation (ASF) under one or more+ * contributor license agreements. See the NOTICE file distributed with+ * this work for additional information regarding copyright ownership.+ * The ASF licenses this file to You under the Apache License, Version 2.0+ * (the "License"); you may not use this file except in compliance with+ * the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++/**+ * Preload script to increase undici HTTP timeout for Antora UI bundle downloads.+ *+ * This script sets the global HTTP agent with longer timeout values to prevent+ * timeout errors when downloading the UI bundle from slow or high-latency networks,+ * particularly in CI environments.+ *+ * Issue: Node.js 20+ includes undici with default timeouts that may be too short+ * for downloading the Antora UI bundle (925KB) from Apache's nightlies server.+ *+ * Usage: This script is preloaded via NODE_OPTIONS in the buildLocalAntoraSite task.+ */++// Configuration via environment variable+const timeoutMs = parseInt(process.env.UNDICI_TIMEOUT_MS || '60000', 10);++// Configure HTTP agent timeouts+try {+ const http = require('node:http');+ const https = require('node:https');++ http.globalAgent.timeout = timeoutMs;+ https.globalAgent.timeout = timeoutMs;++ console.log(`[undici-timeout] Configured HTTP agent timeouts: ${timeoutMs}ms`);+} catch (error) {+ console.warn('[undici-timeout] Could not configure HTTP agent timeouts:', error.message);+}