-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Type
optimization
Severity
medium
Area
nmapui/handlers/runtime_info.py, nmapui/traceroute.py
Description
Two SocketIO event handlers perform blocking I/O that ties up the event loop:
-
get_network_key_eventcallsrun_traceroute("1.1.1.1")synchronously. Traceroute can take 30-60 seconds, blocking all other events for that client during execution. -
get_local_ipcallsrequests.get("https://api.ipify.org", timeout=3)synchronously. While the 3-second timeout limits worst-case, it still blocks the handler.
If multiple clients request network key simultaneously, requests serialize and compound the delay.
Proposed Fix
Run traceroute in a background task:
@socketio.on("get_network_key")
@require_socket_auth()
def get_network_key_event():
socketio.start_background_task(
_run_traceroute_and_emit, request.sid
)Cache the public IP result with a TTL (e.g., 5 minutes) to avoid repeated external calls.
Related Issues
None
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request