<feed xmlns='http://www.w3.org/2005/Atom'>
<title>unit.git/src, branch 1.33.0</title>
<subtitle>Universal Web Application Server</subtitle>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/'/>
<entry>
<title>python: Don't decrement a reference to a borrowed object</title>
<updated>2024-09-13T16:12:39+00:00</updated>
<author>
<name>Andrew Clayton</name>
<email>a.clayton@nginx.com</email>
</author>
<published>2024-09-12T15:48:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=50b1aca3b8318c58f7073fe11911f1f0d52c651d'/>
<id>50b1aca3b8318c58f7073fe11911f1f0d52c651d</id>
<content type='text'>
On some Python 3.11 systems, 3.11.9 &amp; 3.11.10, we were seeing a crash
triggered by Py_Finalize() in nxt_python_atexit() when running one of
our pytests, namely
test/test_python_factory.py::test_python_factory_invalid_callable_value

  2024/09/12 15:07:29 [alert] 5452#5452 factory "wsgi_invalid_callable" in module "wsgi" can not be called to fetch callable
  Fatal Python error: none_dealloc: deallocating None: bug likely caused by a refcount error in a C extension
  Python runtime state: finalizing (tstate=0x00007f560b88a718)

  Current thread 0x00007f560bde7ad0 (most recent call first):
    &lt;no Python frame&gt;
  2024/09/12 15:07:29 [alert] 5451#5451 app process 5452 exited on signal 6 (core dumped)

This was due to

  obj = PyDict_GetItemString(PyModule_GetDict(module), callable);

in nxt_python_set_target() which returns a *borrowed* reference, then
due to the test meaning this is a `None` object we `goto fail` and call

  Py_DECREF(obj);

which then causes `Py_Finalize()` to blow up.

The simple fix is to just increment its reference count before the `goto
fail`.

Note: This problem only showed up under (the various versions of Python
we test on); 3.11.9 &amp; 3.11.10. It doesn't show up under; 3.6, 3.7, 3.9,
3.10, 3.12

Cc: Konstantin Pavlov &lt;thresh@nginx.com&gt;
Closes: https://github.com/nginx/unit/issues/1413
Fixes: a9aa9e76d ("python: Support application factories")
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On some Python 3.11 systems, 3.11.9 &amp; 3.11.10, we were seeing a crash
triggered by Py_Finalize() in nxt_python_atexit() when running one of
our pytests, namely
test/test_python_factory.py::test_python_factory_invalid_callable_value

  2024/09/12 15:07:29 [alert] 5452#5452 factory "wsgi_invalid_callable" in module "wsgi" can not be called to fetch callable
  Fatal Python error: none_dealloc: deallocating None: bug likely caused by a refcount error in a C extension
  Python runtime state: finalizing (tstate=0x00007f560b88a718)

  Current thread 0x00007f560bde7ad0 (most recent call first):
    &lt;no Python frame&gt;
  2024/09/12 15:07:29 [alert] 5451#5451 app process 5452 exited on signal 6 (core dumped)

This was due to

  obj = PyDict_GetItemString(PyModule_GetDict(module), callable);

in nxt_python_set_target() which returns a *borrowed* reference, then
due to the test meaning this is a `None` object we `goto fail` and call

  Py_DECREF(obj);

which then causes `Py_Finalize()` to blow up.

The simple fix is to just increment its reference count before the `goto
fail`.

Note: This problem only showed up under (the various versions of Python
we test on); 3.11.9 &amp; 3.11.10. It doesn't show up under; 3.6, 3.7, 3.9,
3.10, 3.12

Cc: Konstantin Pavlov &lt;thresh@nginx.com&gt;
Closes: https://github.com/nginx/unit/issues/1413
Fixes: a9aa9e76d ("python: Support application factories")
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>http: Fix router process crash whilst using proxy</title>
<updated>2024-09-10T02:12:39+00:00</updated>
<author>
<name>Zhidao HONG</name>
<email>z.hong@f5.com</email>
</author>
<published>2024-09-09T15:15:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=5fde2ff79c92e2bb2ff67e4537640af7d06e73b6'/>
<id>5fde2ff79c92e2bb2ff67e4537640af7d06e73b6</id>
<content type='text'>
When the client closes the connection before the upstream,
the proxy's error handler was calling cleanup operation like
peer close and request close twice, this fix ensures the cleanup
is performed only once, improving proxy stability.

Closes: https://github.com/nginx/unit/issues/828
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When the client closes the connection before the upstream,
the proxy's error handler was calling cleanup operation like
peer close and request close twice, this fix ensures the cleanup
is performed only once, improving proxy stability.

Closes: https://github.com/nginx/unit/issues/828
</pre>
</div>
</content>
</entry>
<entry>
<title>wasm-wc: Enable environment inheritance</title>
<updated>2024-09-04T21:50:59+00:00</updated>
<author>
<name>Robbie McKinstry</name>
<email>thesnowmancometh@gmail.com</email>
</author>
<published>2024-08-28T02:00:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=56c237b347fd0ff3fa182663cbc965e05b158e39'/>
<id>56c237b347fd0ff3fa182663cbc965e05b158e39</id>
<content type='text'>
While the C based wasm language module inherits the process environment
the Rust based wasm-wasi-component language module did not.

One upshot of this is that with wasm-wasi-component you don't get access
to any environment variables specified in the Unit configuration.

wasm-wasi-component was based on wasmtime 17.0.0. This capability wasn't
added to the wasmtime-crate until version 20.0.0.

Now that wasm-wasi-component has been updated to a newer wasmtime-crate
we can enable this functionality.

Closes: https://github.com/nginx/unit/issues/1312
[ Commit message - Andrew ]
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
While the C based wasm language module inherits the process environment
the Rust based wasm-wasi-component language module did not.

One upshot of this is that with wasm-wasi-component you don't get access
to any environment variables specified in the Unit configuration.

wasm-wasi-component was based on wasmtime 17.0.0. This capability wasn't
added to the wasmtime-crate until version 20.0.0.

Now that wasm-wasi-component has been updated to a newer wasmtime-crate
we can enable this functionality.

Closes: https://github.com/nginx/unit/issues/1312
[ Commit message - Andrew ]
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>wasm-wc: bump wasmtime to v24</title>
<updated>2024-09-04T21:50:59+00:00</updated>
<author>
<name>Ava Hahn</name>
<email>a.hahn@f5.com</email>
</author>
<published>2024-08-28T19:50:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=011071aaa1809f63abdc4287c80843c8d6e7e179'/>
<id>011071aaa1809f63abdc4287c80843c8d6e7e179</id>
<content type='text'>
Signed-off-by: Ava Hahn &lt;a.hahn@f5.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Ava Hahn &lt;a.hahn@f5.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>socket: Prevent buffer under-read in nxt_inet_addr()</title>
<updated>2024-08-26T14:18:12+00:00</updated>
<author>
<name>Arjun</name>
<email>pkillarjun@protonmail.com</email>
</author>
<published>2024-08-23T03:45:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=932b914618791b6c9648b1066e0cfe4ee6d25cff'/>
<id>932b914618791b6c9648b1066e0cfe4ee6d25cff</id>
<content type='text'>
This was found via ASan.

Given a listener address like ":" (or any address where the first
character is a colon) we can end up under-reading the addr-&gt;start
buffer here

  if (nxt_slow_path(*(buf + length - 1) == '.')) {

due to length (essentially the position of the ":" in the string) being
0.

Seeing as any address that starts with a ":" is invalid Unit config
wise, we should simply reject the address if length == 0 in
nxt_sockaddr_inet_parse().

Link: &lt;https://clang.llvm.org/docs/AddressSanitizer.html&gt;
Signed-off-by: Arjun &lt;pkillarjun@protonmail.com&gt;
[ Commit message - Andrew ]
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This was found via ASan.

Given a listener address like ":" (or any address where the first
character is a colon) we can end up under-reading the addr-&gt;start
buffer here

  if (nxt_slow_path(*(buf + length - 1) == '.')) {

due to length (essentially the position of the ":" in the string) being
0.

Seeing as any address that starts with a ":" is invalid Unit config
wise, we should simply reject the address if length == 0 in
nxt_sockaddr_inet_parse().

Link: &lt;https://clang.llvm.org/docs/AddressSanitizer.html&gt;
Signed-off-by: Arjun &lt;pkillarjun@protonmail.com&gt;
[ Commit message - Andrew ]
Signed-off-by: Andrew Clayton &lt;a.clayton@nginx.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>http: Add "if" option to the "match" object</title>
<updated>2024-08-20T01:17:24+00:00</updated>
<author>
<name>Zhidao HONG</name>
<email>z.hong@f5.com</email>
</author>
<published>2024-08-15T16:29:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=debd61c3a4f7e5817bf842c2166217929ef80c88'/>
<id>debd61c3a4f7e5817bf842c2166217929ef80c88</id>
<content type='text'>
This feature allows users to specify conditions to check if one
route is matched. It is used the same way as the "if" option in
the access log.

Example:

    {
        "match": {
            "if": "`${headers['User-Agent'].split('/')[0] == 'curl'}`"
        },
        "action": {
            "return": 204
        }
    }
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This feature allows users to specify conditions to check if one
route is matched. It is used the same way as the "if" option in
the access log.

Example:

    {
        "match": {
            "if": "`${headers['User-Agent'].split('/')[0] == 'curl'}`"
        },
        "action": {
            "return": 204
        }
    }
</pre>
</div>
</content>
</entry>
<entry>
<title>http: Get rid of nxt_http_request_access_log()</title>
<updated>2024-08-20T01:17:24+00:00</updated>
<author>
<name>Zhidao HONG</name>
<email>z.hong@f5.com</email>
</author>
<published>2024-08-15T16:09:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=57f939569d3c3db11d8bbc7dd0b45693cbe3344e'/>
<id>57f939569d3c3db11d8bbc7dd0b45693cbe3344e</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>http: Refactor out nxt_tstr_cond_t from the access log module</title>
<updated>2024-08-20T01:17:23+00:00</updated>
<author>
<name>Zhidao HONG</name>
<email>z.hong@f5.com</email>
</author>
<published>2024-08-15T16:06:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=82e168fe01306cf03f8eaba284f31f7285347424'/>
<id>82e168fe01306cf03f8eaba284f31f7285347424</id>
<content type='text'>
This nxt_tstr_cond_t will be reused for the feature of adding "if"
option to the "match" object. The two "if" options have the same usage.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This nxt_tstr_cond_t will be reused for the feature of adding "if"
option to the "match" object. The two "if" options have the same usage.
</pre>
</div>
</content>
</entry>
<entry>
<title>var: Remove unused functions and structure fields</title>
<updated>2024-08-20T01:17:23+00:00</updated>
<author>
<name>Zhidao HONG</name>
<email>z.hong@f5.com</email>
</author>
<published>2024-04-18T10:34:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=5f6ae1a189b1736eb7cc35f1ff8018fd8606db9b'/>
<id>5f6ae1a189b1736eb7cc35f1ff8018fd8606db9b</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>http: Refactor access log write</title>
<updated>2024-08-20T01:17:23+00:00</updated>
<author>
<name>Zhidao HONG</name>
<email>z.hong@f5.com</email>
</author>
<published>2024-04-18T10:31:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=ecb3f86c8528a26d770e93bd5296b780981e20ff'/>
<id>ecb3f86c8528a26d770e93bd5296b780981e20ff</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
