Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
fd18995c
Unverified
Commit
fd18995c
authored
Aug 28, 2025
by
ybyang
Committed by
GitHub
Aug 27, 2025
Browse files
Fix get_ip when no external network (#9700)
parent
db0831e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
python/sglang/srt/utils.py
python/sglang/srt/utils.py
+9
-0
No files found.
python/sglang/srt/utils.py
View file @
fd18995c
...
@@ -1964,6 +1964,15 @@ def get_ip() -> str:
...
@@ -1964,6 +1964,15 @@ def get_ip() -> str:
except
Exception
:
except
Exception
:
pass
pass
# try using hostname
hostname
=
socket
.
gethostname
()
try
:
ip_addr
=
socket
.
gethostbyname
(
hostname
)
warnings
.
warn
(
"using local ip address: {}"
.
format
(
ip_addr
))
return
ip_addr
except
Exception
:
pass
warnings
.
warn
(
warnings
.
warn
(
"Failed to get the IP address, using 0.0.0.0 by default."
"Failed to get the IP address, using 0.0.0.0 by default."
"The value can be set by the environment variable"
"The value can be set by the environment variable"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment