# UBA on macOS leaves port 7001 occupied after UbaAgent exits 

**URL:** <https://forums.unrealengine.com/t/uba-on-macos-leaves-port-7001-occupied-after-ubaagent-exits/2729326>\
**Category:** Issues and Bug Reporting (Unreal Engine)\
**Tags:** unreal-engine\
**Created:** [June 17, 2026, 2:49pm UTC](https://forums.unrealengine.com/t/uba-on-macos-leaves-port-7001-occupied-after-ubaagent-exits/2729326 "2026-06-17T14:49:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![0xingchen0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@0xingchen0](https://forums.unrealengine.com/u/0xingchen0)\
**Post date:** [June 17, 2026, 2:49pm UTC](https://forums.unrealengine.com/t/uba-on-macos-leaves-port-7001-occupied-after-ubaagent-exits/2729326/1 "2026-06-17T14:49:45Z")

</div>

### Summary

UBA on macOS can leave TCP port 7001 occupied after UbaAgent exits, causing later UbaAgent instances to fail with exit code 255 because they cannot bind the listen port.

### What Type of Bug are you experiencing?

Foundation (C++ Tools, Profiling, & Pipeline)

### Steps to Reproduce

1. Use Horde remote execution with Unreal Build Accelerator on a macOS worker.
2. Launch UbaAgent through Horde with -Listen=7001.
3. Run a build that spawns clang++ compiler child processes through UBA.
4. Let UbaAgent exit while compiler child processes may still be alive.
5. Start another UBA remote worker on the same macOS machine.

### Expected Result

Compiler child processes should not inherit UbaAgent’s listening socket. After UbaAgent exits, port 7001 should be released, and a later UbaAgent instance should be able to bind and listen on port 7001 normally.

### Observed Result

UbaAgent exits with code 255. Agent-side logs show:

UbaClient (…) - bind 0.0.0.0:7001 failed because address/port is in use.  
Failed to get start listening on port 7001

After UbaAgent exits, lsof still shows clang++ child processes listening on TCP port 7001. These clang++ processes are orphaned with PPID 1, which suggests they inherited UbaAgent’s listening socket.

Example:

clang++ (…) TCP \*:7001 (LISTEN)

Additional source-code observation:

In UE 5.8 source, UbaProcess.cpp appears to contain a fix-intent for macOS. spawnFlags includes POSIX\_SPAWN\_CLOEXEC\_DEFAULT under PLATFORM\_MAC, but the actual posix\_spawnattr\_setflags() call still passes POSIX\_SPAWN\_SETPGROUP | POSIX\_SPAWN\_SETSIGMASK directly instead of spawnFlags.

As a result, POSIX\_SPAWN\_CLOEXEC\_DEFAULT is added to spawnFlags but never actually applied on macOS. This seems related to the observed issue where clang++ child processes inherit UbaAgent’s listening socket and keep port 7001 open after UbaAgent exits.

### Affects Versions

5.8

### Platform(s)

Mac

### Upload an image

 ![企业微信截图_17817061155639.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/6/f/86f9436bd09d12ca05af50b74281b3fa85b255d0.png)
