This is an automated email from the ASF dual-hosted git repository. Cole-Greer pushed a commit to branch docs-3.7 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit bb203f4705af1e035ccc6776f1e5b0640b19feee Author: Cole Greer <[email protected]> AuthorDate: Thu May 28 23:36:39 2026 -0700 Fix stale server detection and add console restart delay Two fixes for the SPARQL/remote-connect cascade failure: 1. process-docs.sh: fail fast if port 8182 is already in use (stale server from a prior run). Previously the nc readiness check would pass against a stale/incompatible server, causing WebSocket handshake failures that dumped ~500-line Netty stacktraces into every :remote connect block. Also detect early server-process exit (e.g. bind failure) instead of waiting the full 30s timeout. 2. GremlinTreeprocessor: add a 2s delay after closing a dead console before restarting, letting the OS reclaim resources (ports, memory) from Spark/Hadoop blocks so the SPARQL section that follows can recover instead of cascading into repeated timeouts. --- bin/process-docs.sh | 16 ++++++++++++++++ .../tinkerpop/gremlin/docs/GremlinTreeprocessor.java | 2 ++ 2 files changed, 18 insertions(+) diff --git a/bin/process-docs.sh b/bin/process-docs.sh index 7ae7857340..03eff0717d 100755 --- a/bin/process-docs.sh +++ b/bin/process-docs.sh @@ -150,6 +150,16 @@ cp "${HADOOP_CONF_SRC}/hadoop-docs.properties" "${CONSOLE_HOME}/conf/" # 5. Start Gremlin Server echo "Starting Gremlin Server..." mkdir -p target + +# Fail fast if port 8182 is already in use (likely a stale server from a +# previous run). Connecting to a stale/incompatible server causes WebSocket +# handshake failures that dump large stacktraces into the docs. +if nc -z localhost 8182 2>/dev/null; then + echo "ERROR: Port 8182 is already in use. A stale Gremlin Server may be running." + echo " Find and stop it (e.g. 'lsof -i :8182') before running the docs build." + exit 1 +fi + pushd "${SERVER_HOME}" > /dev/null bin/gremlin-server.sh conf/gremlin-server-modern.yaml > "${TP_HOME}/target/gremlin-server-docs.log" 2>&1 & GREMLIN_SERVER_PID=$! @@ -158,6 +168,12 @@ popd > /dev/null # Wait for server to be ready (port 8182) echo -n "Waiting for Gremlin Server on port 8182..." for i in $(seq 1 30); do + # Detect early server failure (e.g. bind error) so we don't wait the full timeout + if ! kill -0 "${GREMLIN_SERVER_PID}" 2>/dev/null; then + echo " FAILED" + echo "ERROR: Gremlin Server process exited during startup. See target/gremlin-server-docs.log" + exit 1 + fi if nc -z localhost 8182 2>/dev/null; then echo " ready." break diff --git a/tools/tinkerpop-docs/src/main/java/org/apache/tinkerpop/gremlin/docs/GremlinTreeprocessor.java b/tools/tinkerpop-docs/src/main/java/org/apache/tinkerpop/gremlin/docs/GremlinTreeprocessor.java index 5633adbe51..26531e47ca 100644 --- a/tools/tinkerpop-docs/src/main/java/org/apache/tinkerpop/gremlin/docs/GremlinTreeprocessor.java +++ b/tools/tinkerpop-docs/src/main/java/org/apache/tinkerpop/gremlin/docs/GremlinTreeprocessor.java @@ -633,6 +633,8 @@ public class GremlinTreeprocessor extends Treeprocessor { lazyConsole.close(); lazyConsole = null; resolvedExecutor = null; + // Allow OS to reclaim resources from dead console and its children + try { Thread.sleep(2000); } catch (final InterruptedException e) { Thread.currentThread().interrupt(); } } currentGraph = null; ensureConsoleStarted();
