$ the-wire · showcase
Phoenix fixes connection race conditions, minified float rounding
By RepoJournal · Filed · About Elixir & Phoenix · Composed from the cited sources · methodology
A sweep of connection lifecycle races in Phoenix and a memory-lighter Float rounding path in Elixir headline a day that is otherwise documentation and diagnostics work.
Address connection races (#6867) phoenixframework/phoenix
The socket stored its current transport's state in its own fields, so asynchronous events, timers and user callbacks belonging to one connection could act on the next one. Each transport instance is now wrapped in a Connection that owns that state and only handles events while it is the socket's current connection.
Address connection races phoenixframework/phoenix
Alongside the Connection wrapper, this closes a set of races that surfaced while auditing the same paths, including channels that stayed joined after a torn-down connection's late close event arrived and then answered pushes with errors instead of being rejoined. Teardown stops waiting after roughly 1.5s, which is where the late-arrival window comes from.
Allow setting :max_channels_per_transport in Phoenix.Endpoint.socket/3 phoenixframework/phoenix
`max_channels_per_transport` was only settable via `use Phoenix.Socket`, leaving apps that mount `Phoenix.LiveView.Socket` directly stuck with the default; LiveView's uploader opens one channel per upload entry, so about 100 files hits that limit. You can now pass it as a top-level option to socket/3, overriding the `use` value.
Optimize Float decimal rounding (#15976) elixir-lang/elixir
The rounding path now scales with powers of five and uses tuple lookups for decimal powers, combines the rounding helpers, detects tiny and exact values earlier, and reuses the input exponent with two guard bits for bignum conversion, keeping signed-zero shortcuts and avoiding intermediate float boxing. Reported as faster or the same performance with less memory in some cases.
Make protocol implementation type inference independent of struct loading, closes #15978 elixir-lang/elixir
Protocol implementation type inference no longer depends on struct loading, which closes the ordering issue in #15978.
Clear pending disconnected timer before scheduling another phoenixframework/phoenix_live_view
The pending disconnected timer is now cleared before another is scheduled; previously stale timers could stack and fire `phx-disconnected` after reconnect, leaving an offline banner that never cleared.