Tags: vapor/vapor
Tags
Prevent stack overflow by using `NIOLock` instead of `NIOLockedValueB… …ox` during service initialization (#3302) * Prevent stack overflow by using `NIOLock` instead of `NIOLockedValueBox` during service initialization At first glance, one could think that using a `NIOLockedValueBox<(@sendable (Application) -> ServiceType)?>` for `makeService` would be sufficient here. However, for some reason, calling `self.storage.makeService.withLockedValue({ $0 })` repeatedly in `Service.service` causes each subsequent call to the function stored inside the locked value to perform one (or several) more "trampoline" function calls, slowing down the execution and eventually leading to a stack overflow. This is why we use a `NIOLock` here instead; it seems to avoid the `{ $0 }` issue above despite still accessing `_makeService` from within a closure (`{ self._makeService }`). - Replace `NIOLockedValueBox` with `NIOLock` to avoid adding trampoline function calls - Add detailed comment explaining the rationale behind the locking mechanism change - Simplify service initialization with direct fatalError instead of optional handling - Remove redundant nil checks in service getter * Add tests.
Fix warnings from NIO 2.79.0 (#3285) * Start migrating to NIOFileSystem and deprecating old APIs * Fix all the FileSystem deprecations * Don't run tracing tests on port 8080 * Match existing write behaviour * Fix warnings in HTTPServer * Fix more warnings * Fix warnings in client tests * Fix test * Reduce test time * Remove auth test warnings * Fix a bunch more warnings in tests * Fix a bunch more test warnings * Migrate environment tests * More test warnings * Remove final warnings * Fix subtle little upgrade bug * Pull in new NIO release * Fix tracing test * Apply suggestions from code review Co-authored-by: Gwynne Raskind <[email protected]> * PR reviews * Remove dodgy test * PR feedback and migrate client tests to Swift Testing --------- Co-authored-by: Gwynne Raskind <[email protected]>
Adds Support for Tracing Header Extraction (#3280) * feat: Adds callback for custom span attributes * test: Fixes tracing test async warnings * feat: Adds header extraction support to tracing * fix: Split initializer to avoid API breakage --------- Co-authored-by: Tim Condon <[email protected]>
Validation API | `Custom` Validator (#3263) * feat(Validation): added custom validation validator * style(ValidationTests): fixed indentation * test(ValidationTests): added additional test cases Goal is to have higher test coverage for https://app.codecov.io/gh/vapor/vapor/pull/3263/blob/Sources/Vapor/Validation/Validators/Custom.swift * feat(ValidationTests,Custom): added tests and code changes to use "not" operator * fix(ValidationTests.swift): reset to changes before custom validator tests were added * feat(ValidationTests): added custom validation tests back * docs(ValidationTests): added comments to improve readability, better naming * fix(ValidationTests): simplified tests to only test custom validator functionality * fix(ValidationTests): fixed dumb mistakes --------- Co-authored-by: Tim Condon <[email protected]>
PreviousNext