aboutsummaryrefslogtreecommitdiff
path: root/src/zenutil
Commit message (Collapse)AuthorAgeFilesLines
* zenserverprocess hardening (#61)Dan Engelbrecht2024-04-252-21/+40
| | | | * verify running process before creating event * make sure we don't signal/wait for a zenserver instance that we did not wait for to get ready
* import oplog improvements (#54)Dan Engelbrecht2024-04-202-4/+6
| | | | | | | | | | | * report down/up transfer speed during progress * add disk buffering in http client * offload block decoding and chunk writing form network worker pool threads add block hash verification for blocks recevied at oplog import * separate download-latch from write-latch to get more accurate download speed * check headers when downloading with http client to go directly to file writing for large payloads * we must clear write callback even if we only provide it as an argument to the Download() call * make timeout optional in AddSponsorProcess * check return codes when creating windows threadpool
* capture zenserver output on error (#51)Dan Engelbrecht2024-04-182-23/+86
| | | | * capture spawned server output and output on launch error * fix logging and launch validation in tests
* improved lock file handling (#50)Dan Engelbrecht2024-04-182-12/+122
| | | | | | | | | | | | - Feature: `zen down` - --`data-dir` to specify a data directory to deduce which zen instance to bring down - Feature: `zen attach` - --`data-dir` to specify a data directory to deduce which zen instance to attach to222 - Feature: `zen status` - --`port` filter running zen instances based on port - --`data-dir` filter running zen instances based on information in the data directory - Improvement: Trying to load a compact binary object from an empty file no longer causes access violation
* zen startup hardening (#49)Dan Engelbrecht2024-04-172-10/+77
| | | | | | | | | | | | | - Feature: `zen up` command improvements - --`port` allows you to specify a base port when starting an instance - --`base-dir` allows you to specify a base directory for the zenserver executable if it is not located next to the zen.exe executable - Feature: `zen down` - --`port` allows you to specify a base port when shutting down an instance - --`base-dir` allows you to specify a base directory for the zenserver executable if it is not located next to the zen.exe executable - --`force` if regular shutdown fails it tries to find a running zenserver.exe process and terminate it - If it fails to attach to the running server it now waits for it to exit when setting the RequestExit shared memory flag - Improvement: zenserver now checks the RequestExit flag in the shared memory and exist gracefully if it is set - Improvement: When adding a sponsor process to a running zenserver instance, we wait for it to be picked up from the shared memory section to determine success/fail
* Validate input buffer size when trying to parse package message (#47)Dan Engelbrecht2024-04-131-21/+25
| | | | * add validation of input buffer size when trying to parse package message * avoid doing memcopy when parsing package message
* improved assert (#37)Dan Engelbrecht2024-04-043-14/+14
| | | | - Improvement: Add file and line to ASSERT exceptions - Improvement: Catch call stack when throwing assert exceptions and log/output call stack at important places to provide more context to caller
* hardening parsepackagemessage (#38)Dan Engelbrecht2024-04-041-31/+70
| | | * hardening of ParsePackageMessage and extended details when malformed attachments are detected
* Use multithreading to fetch size/rawsize of entries in ↵Dan Engelbrecht2024-03-282-4/+30
| | | | | | `/prj/{project}/oplog/{log}/chunkinfos` and `/prj/{project}/oplog/{log}/files` (#30) - Improvement: Use multithreading to fetch size/rawsize of entries in `/prj/{project}/oplog/{log}/chunkinfos` and `/prj/{project}/oplog/{log}/files` - Improvement: Add `GetMediumWorkerPool()` in addition to `LargeWorkerPool()` and `SmallWorkerPool()`
* consistent paths encoding (#24)Dan Engelbrecht2024-03-251-1/+1
| | | | * Don't encode filesystem path to UTF8 unless stored in compactbinary string * Be consistent where we encode/decode paths to UTF8
* re-enable partial cache chunks (#21)v5.4.2-pre9v5.4.2-pre12v5.4.2-pre11v5.4.2-pre10Dan Engelbrecht2024-03-222-7/+10
| | | | * Separate chunk raw hash from section hash (how to find the fragment attachment) * fix partial get cache value tests
* harden attach sponsor process (#14)Dan Engelbrecht2024-03-211-10/+7
| | | | | - Improvement: Delay exiting due to no sponsor processes by one second to handle race conditions - Improvement: Safer IsProcessRunning check - Improvement: make sure we can RequestApplicationExit safely from any thread
* add support for responding with partial cache chunks (#11)Dan Engelbrecht2024-03-213-5/+8
| | | * add support for responding with partial cache chunks
* improved process monitoring behaviour with invalid pids (#16)Stefan Boberg2024-03-211-1/+8
|
* special treatment large oplog attachments v2 (#5)Dan Engelbrecht2024-03-142-3/+12
| | | | | - Bugfix: Install Ctrl+C handler earlier when doing `zen oplog-export` and `zen oplog-export` to properly cancel jobs - Improvement: Add ability to block a set of CAS entries from GC in project store - Improvement: Large attachments and loose files are now split into smaller chunks and stored in blocks during oplog export
* clean up test linking (#4)Dan Engelbrecht2024-03-145-84/+260
| | | | | | | - Improvement: Add zenhttp-test and zenutil-test - Improvement: Moved cachepolicy test to cachepolicy.cpp - Improvement: Renamed cachestore tests from z$ to cachestore - Improvement: Moved test linking so test for a lib is linked by <lib>-test - Improvement: Removed HttpRequestParseRelativeUri in httpstructuredcache.cpp and use the one in cacherequests.h instead
* fix zenserver state macos (#669)Dan Engelbrecht2024-03-101-1/+5
| | | | | | - Shared memory for zenserver state may hang around after all zenserver processes exit - make sure we find a valid entry in `zen up` before bailing - Httpasio add retry for desired port - Httpasio only call listen() once - Httpasio explicitly close acceptor sockets
* respond with BadRequest result instead of throwing exception on bad request ↵Dan Engelbrecht2024-02-051-8/+8
| | | | input (#648)
* added robin-map dependency to zenutilStefan Boberg2024-02-011-1/+1
|
* changed RPC recording to MPSC setup (#638)Stefan Boberg2024-01-312-70/+174
| | | fixes rare race condition when using RPC recording for long periods of time
* exception on basicfile read error (#642)Dan Engelbrecht2024-01-291-8/+28
| | | | | * Change BasicFile::Read to throw exception like IoBuffer - Don't ASSERT on dwNumberOfBytesRead == NumberOfBytesToRead - throw exception with details instead - Use proper return type for pread()
* make sure to advance read buffer pointer in BasicFileWriter::Write (#633)Dan Engelbrecht2024-01-221-1/+3
|
* reinstate formatter settings for file sink (#631)Stefan Boberg2024-01-171-0/+9
| | | fixes issue introduced in #615
* release RPC recording memory early (#627)Stefan Boberg2023-12-201-2/+7
| | | previously the segment would call `clear()` on the `m_Entries` vector but this does not release the backing memory so we have to do the `swap` dance
* separate RPC processing from HTTP processing (#626)Stefan Boberg2023-12-203-0/+992
| | | | | | * moved all RPC processing from HttpStructuredCacheService into separate CacheRpcHandler class in zenstore * move package marshaling to zenutil. was previously in zenhttp/httpshared but it's useful in other contexts as well where we don't want to depend on zenhttp * introduced UpstreamCacheClient, this provides a subset of functions on UpstreamCache and lives in zenstore
* cache RPC recorder threading fixes (#617)Stefan Boberg2023-12-191-39/+48
| | | | | * ensure all access to m_Entries is done while holding lock * RPC recorder concurrency fixes - setup/teardown of recorder needs to be done while holding an exclusive lock. Calls into recorder should be done while holding a shared lock.
* Make sure we initialize the pattern of FileSink before it is added as a ↵Dan Engelbrecht2023-12-181-12/+8
| | | | usable logger (#615)
* fixed v2 rpc recording issue with >4GB data per segment (#612)Stefan Boberg2023-12-153-32/+203
| | | | | | | | | * fixed v2 rpc recording issue with >4GB data per segment * implemented recovery logic to deal with partial RPC recordings * added check for invalid/null requests in RPC replay * also made sure at least one worker thread is configured * fix problem where "null" requests would cause infinite loop! * added basic RPC recorder tests
* implement cache recording segment split by age (#611)Stefan Boberg2023-12-141-12/+27
| | | - also fixes weird DateTime/TimeSpan comparison operator
* fix crash at log exit (#605)Dan Engelbrecht2023-12-131-7/+5
| | | * keep g_FileSink alive until spdlog has shut down
* premature logging shutdown fix (#603)v0.2.36Stefan Boberg2023-12-121-0/+9
|
* Make sure that PathFromHandle don't hide true error when throwing exceptions ↵Dan Engelbrecht2023-12-111-9/+23
| | | | | | | | | (#600) * Make sure that PathFromHandle don't hide true error when throwing exceptions * changelog * return error info in PathFromHandle if path fails to resolve
* multi-line logging improvements (#597)Stefan Boberg2023-12-112-72/+112
| | | | | | * added ZEN_SCOPED_WARN and implemented multi-line logging * changed so file log also uses `fullformatter` for consistency and to get the multi-line support across the board
* logging configuration via command line options (#589)Stefan Boberg2023-12-061-4/+5
| | | | | | | with these changes it is possible to configure loggers on the command line. For instance: `xmake run zenserver --log-trace=http_requests,http` will configure the system so that the `http_request` and `http` loggers are set to TRACE level
* safe threadpool shutdown (#584)Dan Engelbrecht2023-12-041-0/+6
| | | * shut down thread pools earlier to worker threads has a chance to terminate before main thread atexit
* global thread worker pools (#577)Dan Engelbrecht2023-11-292-0/+110
| | | - Improvement: Use two global worker thread pools instead of ad-hoc creation of worker pools
* fixed file logger pattern (#579)Stefan Boberg2023-11-291-1/+1
| | | | previously, the millisecond part was inexplicably logged after the date, not the time.
* optimized index snapshot reading/writing (#561)Stefan Boberg2023-11-274-11/+139
| | | | | the previous implementation of in-memory index snapshots serialise data to memory before writing to disk and vice versa when reading. This leads to some memory spikes which end up pushing useful data out of system cache and also cause stalls on I/O operations. this change moves more code to a streaming serialisation approach which scales better from a memory usage perspective and also performs much better
* moved process handling code into separate h/cpp (#555)Stefan Boberg2023-11-201-0/+1
|
* use dynamic port assignment for tests (#545)Stefan Boberg2023-11-172-44/+77
| | | this change replaces hard-coded port numbers in tests with dynamically assigned ports, to avoid potential issues around socket lifetimes and re-use policies
* blocking queue fix (#550)Dan Engelbrecht2023-11-162-11/+37
| | | | | | | | | * make BlockingQueue::m_CompleteAdding non-atomic * ZenCacheDiskLayer::Flush logging * name worker threads in ZenCacheDiskLayer::DiscoverBuckets * name worker threads in gcv2 * improved logging in ZenServerInstance * scrub threadpool naming * remove waitpid handling, we should just call wait to kill zombie processes
* add doctest listener so we can output when test/subtests begin (#538)Dan Engelbrecht2023-11-151-0/+1
| | | | * add doctest listener so we can output when test/subtests begin * disable sentry when running a test server
* fix race contdition when signaling shutdown of process and waiting for ↵Dan Engelbrecht2023-11-151-1/+9
| | | | completion (#539)
* gc history log (#519)Dan Engelbrecht2023-11-131-59/+10
| | | | | - Feature: Writes a `gc.log` with settings and detailed result after each GC execution (version 2 only) - Break out file name rotate to allow access for gclog - CompactBinaryToJson(MemoryView Data, StringBuilderBase& InBuilder)
* fix bad access to unlocked state (#527)Dan Engelbrecht2023-11-101-0/+1
| | | | * don't touch non-locked data when creating manifest * safety assert for test dir
* factored out some compiler definitions etc into zenbase (#517)Stefan Boberg2023-11-072-1/+3
| | | | | this is a header-only library which mostly contains definitions to support different platforms and compilers. It is part of the zen codebase but is intended to be consumable separately to zenbase etc to support standalone transport plug-ins and similar.
* spdlog implementation hiding (#498)Stefan Boberg2023-11-064-47/+186
| | | | | | | | | this change aims to hide logging internals from client code, in order to make it easier to extend and take more control over the logging process in the future. As a bonus side effect, the generated code is much tighter (net delta around 2.5% on the resulting executable which includes lots of thirdparty code) and should take less time to compile and link. Client usage via macros is pretty much unchanged. The main exposure client code had to spdlog internals before was the use of custom loggers per subsystem, where it would be common to have `spdlog::logger` references to keep a reference to a logger within a class. This is now replaced by `zen::LoggerRef` which currently simply encapsulates an actual `spdlog::logger` instance, but this is intended to be an implementation detail which will change in the future. The way the change works is that we now handle any formatting of log messages in the zencore logging subsystem instead of relying on `spdlog` to manage this. We use the `fmt` library to do the formatting which means the client usage is identical to using `spdlog`. The formatted message is then forwarded onto any sinks etc which are still implememted via `spdlog`.
* statsd for cas (#511)Dan Engelbrecht2023-11-061-0/+34
| | | | * separate statsd interfaces so they can be accessible to zenstore * statsd for cas
* fixed issue where file log sink would get the wrong pattern assigned (#513)Stefan Boberg2023-11-061-12/+12
| | | | this made the file log emit relative timing instead of an absolute timestamp prefix
* added missing includes (#504)Stefan Boberg2023-10-274-0/+7
| | | | | this change adds some includes to files which "inherit" includes from elsewhere this was exposed on another branch when removing some heavy dependencies from central headers