Commit Graph

155 Commits

Author SHA1 Message Date
johan berg
f1d000555b Fix compile error on Linux for UTS.
The io context member is also used on Linux.

#ushell-cherrypick of 33627971 by Johan.Berg
#rb johan.berg

[CL 33628176 by johan berg in ue5-main branch]
2024-05-14 09:35:53 -04:00
johan berg
17d6bcf561 Bump UnrealTraceServer version to 1.21
#rb johan.berg

[CL 33627649 by johan berg in ue5-main branch]
2024-05-14 09:04:21 -04:00
johan berg
c2ac34dd1d Add option to detach from console
Add option in UnrealTraceServer to detach from current console. Automatically apply this option when launching a forked server to avoid stopping the process when terminal window closes.

#rb ionut.matasaru

[CL 33572073 by johan berg in ue5-main branch]
2024-05-10 07:19:13 -04:00
johan berg
be2295e2df Add command line override for sponsor mode.
* Adds command line argument for setting sponsor mode "--sponsor-mode".
* Added additional information in command line help regarding settings.

#rb ionut.matasaru

[CL 33228090 by johan berg in ue5-main branch]
2024-04-25 08:28:24 -04:00
johan berg
e6b465e73a Fix checking privileged applications.
If UTS was launched by a process with elevated privileges and provided as a sponsor process, UTS was not able to open a handle to the sponsor which resulted in immediate exit. We only need the exit status of the process so opening the sponsor with PROCESS_QUERY_LIMITED_INFORMATION is enough.

#jira UE-210097
#rb ionut.matasaru

[CL 32542069 by johan berg in ue5-main branch]
2024-03-27 09:43:13 -04:00
johan berg
c9c9f43039 Fix some compilation warnings
#rb ionut.matasaru

[CL 32259235 by johan berg in ue5-main branch]
2024-03-14 16:51:34 -04:00
johan berg
faeff47339 Fix crash when looking for user home directory
When UTS was looking for the users home directory getpwuid was used. In certain scenarios this doesn't work and a null pointer is returned. Man pages suggest reading the HOME environment variable is more correct, so with this change we use that primarily and fall back to getpwuid method.

#jira UE-208979
#rb ionut.matasaru
#ushell-cherrypick of 32243446 by Johan.Berg

[CL 32244934 by johan berg in ue5-main branch]
2024-03-14 10:41:15 -04:00
johan berg
daeaad3e0d Bump version number
#rb johan.berg
#jira UE-204157

[CL 31126286 by johan berg in ue5-main branch]
2024-02-02 10:57:41 -05:00
johan berg
03b67cd765 Change method of checking for sponsor process lifetime
* Move sponsor process check inside store and use asio tasks to check, instead of launching separate thread on Linux/Mac. There was some strange interaction between standalone pthreads and asio.
* How checking is done is now platform independent, but some platform specific code is needed to trigger exit events.

#jira UE-204157
#rb ionut.matasaru

[CL 31126135 by johan berg in ue5-main branch]
2024-02-02 10:53:59 -05:00
johan berg
d8af78a207 Fix POSIX incompatibilities in Mac implementation
* The sig_timedwait function was used to listen for signals and regularly check sponsor processes. However this function is not available on MacOS. Changed the daemon function to use the old signal listening method but add a worker thread that checks the sponsors at regular intervals instead. Send SIGUSR2 when exit is desired.
* Moved log output from Lifetime to Main to avoid spamming when sponsored mode is disabled. Note that we still need to call ShouldKeepAlive in that mode in order to poll the sponsored pid queue in instance info.
* During development there were cases where the shared memory remained despite the instance dissapearing. Added check if the reported pid is actually still alive. There are false positives here if pid was reused.
* On MacOS it's only possible to resize shared memory once. Added code to verify it's only called once.

[CL 30841356 by johan berg in ue5-main branch]
2024-01-24 09:16:04 -05:00
johan berg
9dabd09447 Add support for universal binaries for UTS.
[CL 30837786 by johan berg in ue5-main branch]
2024-01-24 05:06:22 -05:00
johan berg
24f28d9422 Bump version to 1.19
#rb johan.berg

[CL 30684151 by johan berg in ue5-main branch]
2024-01-18 10:27:55 -05:00
johan berg
e5ded219b9 Add sponsor and port information in status message
#rb ionut.matasaru

[CL 30344362 by johan berg in ue5-main branch]
2023-12-15 03:46:00 -05:00
johan berg
4cbc3f703c Write to correct settings name
#rb ionut.matasaru

[CL 30293527 by johan berg in ue5-main branch]
2023-12-13 10:35:22 -05:00
johan berg
734f4476e6 Handle edge cases for many simultanious sponsors
In extreme cases (for example user starting server + multiple local clients) all tracing at the exact time the number of command slots might be too small. Bump the number of sponsor command slots to 128 and add a retry in the process that adds commands.

#rb ionut.matasaru

[CL 30287932 by johan berg in ue5-main branch]
2023-12-13 04:34:45 -05:00
johan berg
fa998a4436 Sponsor mode in UnrealTraceServer
Adds new sponsor mode of running server. In this mode the server must be started with a parent pid. New pids can be added by running `unrealtraceserver fork --sponsor [pid]`. When all sponsor processes have exited and there are no active connections the server will exit. Most of the lifetime management logic is located in the new Lifetime type, but actual querying and exiting is done in the respective main functions.

Linux and Mac implementation was using a lock file to communicate running pid and version to other instances. With this change all platforms now use shared memory mapping techniques.

Command line options and command parsing has also been refactored and is now parsed and passed to all main functions. Command line help is also added.

#rb ionut.matasaru

[CL 30176867 by johan berg in ue5-main branch]
2023-12-07 07:04:01 -05:00
johan berg
5fcc0f8a97 Add sponsor mode setting.
Adds sponsor mode setting, and add functionality to print settings.

#rb ionut.matasaru

[CL 30150163 by johan berg in ue5-main branch]
2023-12-06 04:42:49 -05:00
johan berg
7f207485e4 Implement hooks for store service to shut down if there are no active connections.
#rb ionut.matasaru

[CL 30150148 by johan berg in ue5-main branch]
2023-12-06 04:41:52 -05:00
johan berg
33ad338ad8 Fix include issue on Mac/Linux
#rb ionut.matasaru

[CL 30038303 by johan berg in ue5-main branch]
2023-12-01 08:01:31 -05:00
johan berg
e4f390b1ac Break out logging and instance info
Prepare for future work by breaking out logging and instance info into separate files.

#rb ionut.matasaru

[CL 29987825 by johan berg in ue5-main branch]
2023-11-29 10:08:26 -05:00
johan berg
94761f1499 Clean up dispatch queues for recreated watchers
Whenever settings would change we deleted the directory watches for all mounts. On Mac each watcher had a dispatch queue with running jobs. When the those lingering jobs would get callbacks, it would try to access the existing mount instance which would have been deleted.

#rb none
#jira UE-187849

[CL 27992508 by johan berg in ue5-main branch]
2023-09-19 08:37:39 -04:00
johan berg
f6eb6cc369 Bump UTS version to 1.18
#rb none

[CL 27991217 by johan berg in ue5-main branch]
2023-09-19 07:24:20 -04:00
johan berg
0e92126a13 Fix UTS timestamps on Linux
UTS was relying on standard library file times to get a common epoch based timestamp. However for Linux this does not seem to produce reliable results, so we fall back to the posix interface functions.

#rb martin.ridgers
#jira UE-191462

[CL 27784647 by johan berg in ue5-main branch]
2023-09-12 03:44:59 -04:00
johan berg
60cb57a6e8 Fix directory listening for Linux
The file notification api was not told to listen to renames.

#jira UE-187620
#rb martin.ridgers

[CL 27550742 by johan berg in ue5-main branch]
2023-09-01 05:05:16 -04:00
johan berg
5933c84c56 Version 1.17 of UnrealTraceServer for windows
UnrealTraceServer executable and debug files.
Version: 1.17
Platform: windows, mac, linux
Architecture: x64
Compiled with musl: false (linux: true)

#rb ionut.matasaru
#jira UE-191425
#lockdown mark.lintott

[CL 27139589 by johan berg in ue5-main branch]
2023-08-16 10:30:13 -04:00