Bug Type (问题类型)
other exception / error (其他异常报错)
Before submit
Environment (环境信息)
- Server Version: latest master
- Backend: any
- OS: CentOS 7.8 (reported), affects any OS with lsof
Expected & Actual behavior (期望与实际表现)
Starting hugegraph-server produces the following error:
lsof: unacceptable port specification in: -i :
Starting HugeGraphServer in daemon mode...
Root cause:
check_port() in util.sh extracts the port using:
local port=$(echo "$1" | awk -F':' '{print $3}')
This assumes a 3-part URL like http://host:port. Since #2944
removed the http:// prefix from the default config, restserver.url
now defaults to 127.0.0.1:8080 (no scheme). Splitting on : gives
only 2 fields, so $3 is empty and lsof -i : is called with no port.
Note: check_port accidentally works for gremlin because its fallback
hardcodes http://127.0.0.1:8182 — only the REST URL is broken.
The same broken check_port exists in all three util.sh files:
- hugegraph-server/.../bin/util.sh line 84
- hugegraph-pd/.../bin/util.sh line 86
- hugegraph-store/.../bin/util.sh line 85
Though only hugegraph-server actively calls it.
Fix: replace the awk expression with:
local port=$(echo "$1" | sed 's|.:||' | sed 's|/.||')
This correctly handles all URL formats:
Related: #2944 (changed default restserver.url format, exposing this bug)
Reported in: #3001
Bug Type (问题类型)
other exception / error (其他异常报错)
Before submit
Environment (环境信息)
Expected & Actual behavior (期望与实际表现)
Starting hugegraph-server produces the following error:
lsof: unacceptable port specification in: -i :
Starting HugeGraphServer in daemon mode...
Root cause:
check_port() in util.sh extracts the port using:
local port=$(echo "$1" | awk -F':' '{print $3}')
This assumes a 3-part URL like http://host:port. Since #2944
removed the http:// prefix from the default config, restserver.url
now defaults to 127.0.0.1:8080 (no scheme). Splitting on : gives
only 2 fields, so $3 is empty and lsof -i : is called with no port.
Note: check_port accidentally works for gremlin because its fallback
hardcodes http://127.0.0.1:8182 — only the REST URL is broken.
The same broken check_port exists in all three util.sh files:
Though only hugegraph-server actively calls it.
Fix: replace the awk expression with:
local port=$(echo "$1" | sed 's|.:||' | sed 's|/.||')
This correctly handles all URL formats:
Related: #2944 (changed default restserver.url format, exposing this bug)
Reported in: #3001