Vapor: 4.113.1 Release

Release date:
February 11, 2025
Previous version:
4.113.0 (released February 10, 2025)
Magnitude:
46 Diff Delta
Contributors:
1 total committer
Data confidence:
Commits:

Top Contributors in 4.113.1

MrMage

Directory Browser for 4.113.1

We haven't yet finished calculating and confirming the files and directories changed in this release. Please check back soon.

Release Notes Published

What's Changed

Prevent stack overflow by using NIOLock instead of NIOLockedValueBox during service initialization by @MrMage in #3302

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
This patch was released by @0xTim

Full Changelog: https://github.com/vapor/vapor/compare/4.113.0...4.113.1