Commit Graph

36 Commits

Author SHA1 Message Date
henrik karlsson
ff59263a86 [UBA]
* Added support for sending .uba trace files from helpers to server

[CL 31981882 by henrik karlsson in ue5-main branch]
2024-03-03 21:18:10 -05:00
henrik karlsson
361532ab08 [UBA]
* Reduced contention in SessionClient when testing if processes are done and spawning new processes
* Changed so FileMappingBuffer is lazily closing mapped memory. For some reason these calls end up being very expensive and we don't have to close them straight away

[CL 31796195 by henrik karlsson in ue5-main branch]
2024-02-26 01:50:10 -05:00
henrik karlsson
0b12758059 [UBA]
* Changed so all ScopedReadLock and ScopedWriteLock are macros (SCOPED_READ_LOCK and SCOPED_WRITE_LOCK).. this to be able to add code around the lock to measure contention. Contention testing code can be enabled by setting UBA_TRACK_CONTENTION to 1

[CL 31795889 by henrik karlsson in ue5-main branch]
2024-02-26 01:14:42 -05:00
henrik karlsson
f0e8aebe39 [Uba]
* Fixed a UbaAgent shutdown hang that can happen with certain timings where workers go from used to non-used at the same time as they are being stopped

[CL 31698187 by henrik karlsson in ue5-main branch]
2024-02-21 16:49:26 -05:00
henrik karlsson
5adb64e10e [UBA]
* Fixed read-after-free bug found by TSAN in StorageServer.cpp
* Fixed write-after-free bug found in UbaProcess.cpp (m_cancelEvent.Set() could be called after memory was freed)
* Lots of minor fixes found using TSAN. Most are harmless but still nice to cleanup
* Disabled mimalloc for linux again.. seems like tsan does not like it so maybe there are bugs in it

[CL 31676014 by henrik karlsson in ue5-main branch]
2024-02-21 01:43:26 -05:00
henrik karlsson
e196c89b86 [Uba]
* Proper fix of UbaAgent shutdown deadlock. Missed that scope guard was explicitly called earlier.. added separate scope guard

[CL 31665834 by henrik karlsson in ue5-main branch]
2024-02-20 20:12:09 -05:00
henrik karlsson
be2140e669 [Uba]
* Fixed deadlock in SessionClient related to where ProcessHandle is destroyed.

[CL 31662090 by henrik karlsson in ue5-main branch]
2024-02-20 18:41:56 -05:00
henrik karlsson
153bc16e50 [Uba]
* Added O_CLOEXEC to all open to prevent file descriptors from leaking to child processes. This seems to really fix the ETXTBUSY
* Added read hint for DecompressMemoryToMemory to be able to show better error messages

[CL 31636371 by henrik karlsson in ue5-main branch]
2024-02-19 20:43:29 -05:00
henrik karlsson
dd7143b230 [UBA]
* Fixed write-after-free bug in code writing cas file to disk
* Fixed write-after-free bug in code cleaning up finished processes in session client code
* Added some asserts
* UbaCli - disabled remote logging in non-debug configs

[CL 31632262 by henrik karlsson in ue5-main branch]
2024-02-19 18:41:16 -05:00
henrik karlsson
34b52deafb [UBA]
* Added hint to unmapfileview to be able to add useful information to asserts on fails
* Added error handling for vsnprintf returning error
* Fixed memory stomp in unit test
* Removed usage of %hs on non-windows since asan complains about it
* Changed UBA_USE_MIMALLOC to always be defined and be 0 or 1 instead of using ifdef
* Enabled mimalloc on linux

[CL 31355077 by henrik karlsson in ue5-main branch]
2024-02-09 16:12:12 -05:00
henrik karlsson
ade0725e14 [UBA]
* Fixed so imagehlp.dll and dbghelp.dll are detoured when loaded. Detour ImageGetDigestStream and SymLoadModuleExW because both of them cause trouble on wine
* Fixed so reuse of processes also honor log files so a new log file is created when reuse happen
* Improved log file naming so host can set name and log files are sent back properly with the right name

[CL 30638193 by henrik karlsson in ue5-main branch]
2024-01-16 13:24:28 -05:00
henrik karlsson
c635451c61 [UBA]
* Fixed so sendfile stats is correct for reuse process entries

[CL 30588393 by henrik karlsson in ue5-main branch]
2024-01-12 02:35:20 -05:00
henrik karlsson
4b1c00af7d [UBA]
* Fixed stats reporting bug for process reuse

[CL 30588189 by henrik karlsson in ue5-main branch]
2024-01-12 01:51:57 -05:00
henrik karlsson
22cf61f84b [UBA]
* Added GetNextProcess as a real message type (not using Custom) to be able to stop fetching work if helper is being terminated by aws or if we want to scale down number of workers
* Did some cleanup in the Tcp backend code and made sure not to call close socket multiple times (since it can cause the code to close a different socket than what is owned)

[CL 30584707 by henrik karlsson in ue5-main branch]
2024-01-11 21:01:56 -05:00
henrik karlsson
9f12e202b4 [UBA]
* Added ProcessStartInfo::writeOutputFilesOnFail that can be set to true if we want the output files to be written/sent back even though process exited with errors
* Changed so session client use ProcessStartInfoHolder and moved serialization code to that class

[CL 30576299 by henrik karlsson in ue5-main branch]
2024-01-11 15:42:50 -05:00
henrik karlsson
8827665b22 [UBA]
* Beeeautiful hack to try to get around ETXTBSY error when spawning ispc processes on linux. Our theory is that with perfectly bad timing the symlink creation of ispc could happen at the exact same time as a posix_spawn happening and inside symlink there is a temporarily open file descriptor that gets cloned into the child and kept open. and this causes ETXTBSY when trying to open that binary.

Solution is simply to have a writelock around the symlink creation and a readlock around posix_spawn

[CL 30513020 by henrik karlsson in ue5-main branch]
2024-01-09 14:26:32 -05:00
henrik karlsson
e0e929073b [Uba]
* Added RegisterDeleteFile to external api that should be used when file is deleted outside of uba but uba needs to know about it
* Reduced lock scope around FlushDeadProcesses
* Fixed disconnect issue crash in ubaagent that could cause access violation in UbaStorage. Fix was to cleanup when leaving StorageClient::SendAllSegments
* Changed so UbaRequestNextProcess is doing a full environment update (not resetting stats) if no next process is found
* Fixed so Scheduler enableProcessReuse=false works properly
* Improved some assert descriptions
* Fixed so files in m_outputFiles in session client is erased when flushed to server
* Fixed so Rpc_GetFullName cleans up .. in paths
* Fixed so files that existed but has been deleted by external process is seen as not existing by remote detoured process.

[CL 30507663 by henrik karlsson in ue5-main branch]
2024-01-09 12:04:16 -05:00
henrik karlsson
9b1e22319d [UBA]
* Fixed so paths returned from SearchPathForFile are cleaned up (not having .. etc)
* Fixed so UbaAgent handle WSAPoll POLLERR as timeout so it retries when failing (this made the process exit on wine)
* Fixed so returned processes that had been reused returned the reused process to the scheduler
* Fixed so EnsureBinaryFile is using correct fileNameKeys
* Removed assert in detoured GetFullPathNameA since it is always calling GetFullPathNameW

[CL 30465533 by henrik karlsson in ue5-main branch]
2024-01-03 16:23:58 -05:00
henrik karlsson
ea673427b2 [UBA]
* Implemented process reuse logic in UbaScheduler. It is now possible for running processes to fetch more work
* Fixed bugs in custom message path
* Fixed bugs in FlushWrittenFiles message
* Changed So UpdateEnvironment is resetting stats
* Fixed potential race condition related to process reuse
* Added special rule for ShaderCompileWorker.exe which detours ImageGetDigestStream in Imagehlp.dll (because wine implementation does not match windows implementation)
* Renamed "exitedUserData" to just userData since it is used for more than when exiting process
* Added a couple more dlls to "known system dlls"
* Fixed so visualizer can visualize process reuse properly

[CL 30462059 by henrik karlsson in ue5-main branch]
2024-01-02 17:42:42 -05:00
henrik karlsson
9b8409f622 [UBA]
* Fixed so when downloading application modules, thread itself helps out downloading

[CL 30438265 by henrik karlsson in ue5-main branch]
2023-12-22 03:35:12 -05:00
henrik karlsson
85e56e8590 [UBA]
* Fixed macos compile error

[CL 30438003 by henrik karlsson in ue5-main branch]
2023-12-22 02:57:12 -05:00
henrik karlsson
32f666ea42 [UBA]
* Added Scheduler class that is a very simple scheduler that handles processes that has no intra dependencies. It handles scheduling remotely and also reschedule processes returned from remote machines.
* Changed so application dependencies are retrieved in parallel by clients
* Added so custom assert handler can be set from the outside
* Added traceEnabled to SessionCreateInfo so trace shared mem can be created without needing to launch visualizer or write to file
* Added so userData can be provided in RemoteProcessAvailable and RemoteProcessReturned callbacks
* Added more files to known system files (based on what exists in wine)
* Improved FindImports code and made it available in export. (it is now automatically filtering out known system files)
* Moved ProcessHandle to its own file
* Added ProcessStartInfoHolder which is a class that can wrap a ProcessStartInfo and make sure all strings are allocated

[CL 30437951 by henrik karlsson in ue5-main branch]
2023-12-22 02:41:43 -05:00
henrik karlsson
0c68ced47b [UBA]
* Fixed a bug where uba failed to download dlls to remote if it was in the system32 folder but did not exist on the remote machine's system32 and was not part of known system modules. (this solves the problem with ShaderCompilerWorker not downloading opengl32.dll to barebone machines)
* Fixed bug where relative path of dll was sent into RetriveCasFile which in turn failed because it couldn't find the file
* Fixed so code could handle loading libraries with circular dependencies
* Removed assert for now related to GetThreadPreferredUILanguages and asking for language name instead of id for remote machines)

[CL 30407004 by henrik karlsson in ue5-main branch]
2023-12-19 19:53:32 -05:00
henrik karlsson
12afed80b7 [UBA]
* Implemented knownInputs support. It is now fully supported to provide known inputs when doing RunProcessRemote. This is optional and can be a nice speedup if latency to helpers is high since it reduce number of messages going back and forth.
* Changed so GetMemoryMapAlignment is checking only file name and no flags. Flags is now handled on the outside. This made it possible to send over map alignment for files without having to send the file names
* Renamed WorkManagerImpl::Wait to WorkManagerImpl::FlushWork
* Renamed willBeUsedUnCompressed to storeUncompressed
* Added ScopedCriticalSection::Enter

[CL 30388720 by henrik karlsson in ue5-main branch]
2023-12-19 01:53:01 -05:00
henrik karlsson
ed5170f3c4 [UBA]
* Stats fixes for network transfers

[CL 30361605 by henrik karlsson in ue5-main branch]
2023-12-15 16:57:54 -05:00