From a41ec495ca774718ea841faff407c33c69f54663 Mon Sep 17 00:00:00 2001 From: Alex Kontos Date: Tue, 6 Aug 2024 14:11:53 +0100 Subject: [PATCH] Randomly assign PORT for PGO. It appears a process on GHA Linux now uses 8888. --- build/pgo/profileserver.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build/pgo/profileserver.py b/build/pgo/profileserver.py index 94f54cbd17369..ae8f4cb8a474b 100755 --- a/build/pgo/profileserver.py +++ b/build/pgo/profileserver.py @@ -7,6 +7,7 @@ import glob import json import os +import socket import subprocess import sys @@ -19,7 +20,12 @@ from mozrunner import CLI, FirefoxRunner from six import string_types -PORT = 8888 +def find_free_port(): + with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: + s.bind(('', 0)) + return s.getsockname()[1] + +PORT = find_free_port() PATH_MAPPINGS = { "/webkit/PerformanceTests": "third_party/webkit/PerformanceTests",