{"full_name":"matsumotory/ngx_mruby","owner":"matsumotory","name":"ngx_mruby","shard":"1","url":"https://github.com/matsumotory/ngx_mruby","description":"ngx_mruby - A Fast and Memory-Efficient Web Server Extension Mechanism Using Scripting Language mruby for nginx","homepage":"https://ngx.mruby.org/","topics":["nginx","mruby","ngx-mruby"],"tag_pages":["nginx"],"language":"C","license":"MIT","avatar":"https://avatars.githubusercontent.com/u/648437?u=f3ed5afc482e2e8d86ccc4cdafaa82d3ac188407&v=4","created_at":"2012-05-07T04:35:12Z","pushed_at":"2026-11-16T09:15:13Z","metrics":{"stars":998,"forks":115,"watchers":39,"issues":118,"prs":710,"releases":79,"issues_open":0,"issues_closed":118,"prs_open":3,"prs_closed":29,"prs_merged":678,"discussions":0},"growth":{"day":{"stars":0,"forks":0,"base_day":"2026-11-15"}},"history":{"dates":["2026-11-10","2026-11-11","2026-11-12","2026-11-13","2026-11-14","2026-11-15","2026-11-16"],"stars":[997,998,998,998,998,998,998],"forks":[115,115,115,115,115,115,115],"watchers":[null,39,39,39,39,39,39],"issues_open":[null,0,0,0,0,0,0],"prs_open":[null,1,0,0,0,2,3]},"boards":{},"same_owner":[],"issues":[],"discussions":[],"latest_release":{"name":"v2.7.9","tag":"v2.7.9","published_at":"2026-11-15T14:53:34Z","body":"## Behavior changes: read before upgrading\n\n### The upstream methods raise ArgumentError on an object whose initialize raised and on a copy made with dup or clone, instead of returning nil or ending the worker (#816, #819)\n\n- Before: `Nginx::Upstream#initialize` and `Nginx::Stream::Connection#initialize` gave the object its upstream before they checked that an upstream had the name, and the upstream methods read it without a check. A script could keep such an object after `initialize` raised: an object from `allocate` whose `initialize` raised, an object on which the script called `initialize` again (with `send`) and that call raised, or the object of a subclass whose `initialize` rescued the exception of `super`. An object from `allocate` that never got an `initialize` was in the same state. When no upstream had the name, `Nginx::Upstream#server` and `Nginx::Stream::Connection#upstream_server` returned `nil`, and `Nginx::Upstream#server=`, `#keepalive_cache`, `#keepalive_cache=` and `Nginx::Stream::Connection#upstream_server=` read through a NULL pointer, and the worker process ended with a segmentation fault. When the upstream had more than one server, and on an object from `allocate`, every one of these methods, `#server` and `#upstream_server` included, ended the worker in the same way. A copy that `dup` or `clone` made of an object, also of one that `.new` returned, had no upstream either: when mruby copies a data object (`RData`), it copies the instance variables and not the data. Each of these methods on such a copy ended the worker with a segmentation fault, and the request or session got no response (#819).\n- Now: `initialize` gives the object its upstream only when it found the upstream and its server. On an object without an upstream, `Nginx::Upstream#server`, `#server=`, `#keepalive_cache` and `#keepalive_cache=` raise `ArgumentError` (`uninitialized Nginx::Upstream`), and `Nginx::Stream::Connection#upstream_server` and `#upstream_server=` raise `ArgumentError` (`uninitialized Nginx::Stream::Connection`). The exception ends the handler like any other exception of the script: a `rescue` in the script catches it, and otherwise ngx_mruby logs it, the request gets 500, and the stream session is closed. The worker goes on to serve the next request and session. An `initialize` that succeeds after one that raised gives the object its upstream, and the methods work again. A copy made with `dup` or `clone` has no upstream, and the methods raise on it in the same way; the original object keeps its upstream (#819).\n- Why it changed:\n  - The defect: `initialize` stored the context of the object (the upstream, its peers and its server) before it checked them, and freed the old context and raised before it stored a new one for an upstream with more than one server; the methods read that context without checking that it held an upstream (#816).\n  - Why the old behavior could not be kept: an object without an upstream has no server to return, change or keep connections for. `nil` from `#server` was the result of reading an empty context, not a value that the method defined, and the next method on the same object ended the worker, which also ended the other requests that the worker was serving. Raising for every upstream method is the one behavior that the methods can have on such an object. `ArgumentError` with `uninitialized` and the name is what the bundled mruby raises for its own objects whose `initialize` did not run, such as `Time` (`uninitialized time`) and `Range` (`uninitialized range`).\n  - What the documentation promised: [Nginx::Upstream#new](https://github.com/matsumotory/ngx_mruby/blob/v2.7.8/docs/class_and_method/README.md#nginxupstreamnewstring---upstream) and [Nginx::Stream::Connection#new](https://github.com/matsumotory/ngx_mruby/blob/v2.7.8/docs/class_and_method/README.md#nginxstreamconnectionnew) in 2.7.8 said that the method raises `RuntimeError` when no upstream has the name, and said nothing about the object","is_prerelease":false},"readme":true,"readme_zh":false,"news":[],"stale":false,"snapshot_at":"2026-11-16T09:23:14Z","history_start":"2026-09-06"}