<feed xmlns='http://www.w3.org/2005/Atom'>
<title>unit.git/src/python, branch 1.26.0-1</title>
<subtitle>Universal Web Application Server</subtitle>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/'/>
<entry>
<title>Moving request limit control to libunit.</title>
<updated>2021-10-28T14:46:54+00:00</updated>
<author>
<name>Max Romanov</name>
<email>max.romanov@nginx.com</email>
</author>
<published>2021-10-28T14:46:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=bba97134e983541e94cf73e93900729e3a3e61fc'/>
<id>bba97134e983541e94cf73e93900729e3a3e61fc</id>
<content type='text'>
Introducting application graceful stop.  For now only used when application
process reach request limit value.

This closes #585 issue on GitHub.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Introducting application graceful stop.  For now only used when application
process reach request limit value.

This closes #585 issue on GitHub.
</pre>
</div>
</content>
</entry>
<entry>
<title>Python: creating and reusing asgi_add_reader() wrapper.</title>
<updated>2021-10-28T14:46:52+00:00</updated>
<author>
<name>Max Romanov</name>
<email>max.romanov@nginx.com</email>
</author>
<published>2021-10-28T14:46:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=803e0373029a80994a85781d0b73b6cfa95bcf5a'/>
<id>803e0373029a80994a85781d0b73b6cfa95bcf5a</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Python: fixing misprint in error message.</title>
<updated>2021-08-09T07:15:00+00:00</updated>
<author>
<name>Max Romanov</name>
<email>max.romanov@nginx.com</email>
</author>
<published>2021-08-09T07:15:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=3580842d34f8543f7bb41551f7a0dec8723289a8'/>
<id>3580842d34f8543f7bb41551f7a0dec8723289a8</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Python: using default event_loop for main thread for ASGI.</title>
<updated>2021-07-20T07:37:54+00:00</updated>
<author>
<name>Max Romanov</name>
<email>max.romanov@nginx.com</email>
</author>
<published>2021-07-20T07:37:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=f27fbd9b4d2bdaddf1e7001d0d0bc5586ba04cd4'/>
<id>f27fbd9b4d2bdaddf1e7001d0d0bc5586ba04cd4</id>
<content type='text'>
Unit's ASGI implementation creates a new event loop to run an application for
each thread since 542b5b8c0647.  This may cause unexpected exceptions or
strange bugs if asyncio synchronisation primitives are initialised before the
application starts (e.g. globally).

Although the approach with a new event loop for the main thread is consistent
and helps to prepare the application to run in multiple threads, it can be a
source of pain for people who just want to run single-threaded ASGI
applications in Unit.

This is related to #560 issue on GitHub.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Unit's ASGI implementation creates a new event loop to run an application for
each thread since 542b5b8c0647.  This may cause unexpected exceptions or
strange bugs if asyncio synchronisation primitives are initialised before the
application starts (e.g. globally).

Although the approach with a new event loop for the main thread is consistent
and helps to prepare the application to run in multiple threads, it can be a
source of pain for people who just want to run single-threaded ASGI
applications in Unit.

This is related to #560 issue on GitHub.
</pre>
</div>
</content>
</entry>
<entry>
<title>Python: fixing exceptions in Future.set_result for ASGI implementation.</title>
<updated>2021-07-20T07:37:53+00:00</updated>
<author>
<name>Max Romanov</name>
<email>max.romanov@nginx.com</email>
</author>
<published>2021-07-20T07:37:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=dfbdc1c11a201e46d61f4bc61cfbe5741fc4fd70'/>
<id>dfbdc1c11a201e46d61f4bc61cfbe5741fc4fd70</id>
<content type='text'>
An ASGI application can cancel the Future object returned by the receive()
call.  In this case, Unit's ASGI implementation should not call set_result()
because the Future is already handled.  In particular, the Starlette framework
was noted to cancel the received Future.

This patch adds a done() check for the Future before attempting a set_result().

This is related to #564 issue on GitHub.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
An ASGI application can cancel the Future object returned by the receive()
call.  In this case, Unit's ASGI implementation should not call set_result()
because the Future is already handled.  In particular, the Starlette framework
was noted to cancel the received Future.

This patch adds a done() check for the Future before attempting a set_result().

This is related to #564 issue on GitHub.
</pre>
</div>
</content>
</entry>
<entry>
<title>Python: fixing ASGI receive() issues.</title>
<updated>2021-07-20T07:37:50+00:00</updated>
<author>
<name>Max Romanov</name>
<email>max.romanov@nginx.com</email>
</author>
<published>2021-07-20T07:37:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=567545213d95e608b54ce92bfc33fac4327a9f93'/>
<id>567545213d95e608b54ce92bfc33fac4327a9f93</id>
<content type='text'>
The receive() call never blocks for a GET request and always returns the same
empty body message.  The Starlette framework creates a separate task when
receive() is called in a loop until an 'http.disconnect' message is received.

The 'http.disconnect' message was previously issued after the response header
had been sent.  However, the correct behavior is to respond with
'http.disconnect' after sending the response is complete.

This closes #564 issue on GitHub.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The receive() call never blocks for a GET request and always returns the same
empty body message.  The Starlette framework creates a separate task when
receive() is called in a loop until an 'http.disconnect' message is received.

The 'http.disconnect' message was previously issued after the response header
had been sent.  However, the correct behavior is to respond with
'http.disconnect' after sending the response is complete.

This closes #564 issue on GitHub.
</pre>
</div>
</content>
</entry>
<entry>
<title>Python: support for multiple targets.</title>
<updated>2021-05-20T13:02:45+00:00</updated>
<author>
<name>Oisin Canty</name>
<email>o.canty@f5.com</email>
</author>
<published>2021-05-20T13:02:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=f60389a782470e31dc555ab864784b536f2544ca'/>
<id>f60389a782470e31dc555ab864784b536f2544ca</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Libunit: processing single port message.</title>
<updated>2020-12-29T16:01:24+00:00</updated>
<author>
<name>Max Romanov</name>
<email>max.romanov@nginx.com</email>
</author>
<published>2020-12-29T16:01:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=d65a66f9d813294917822554311281c5e1a7126b'/>
<id>d65a66f9d813294917822554311281c5e1a7126b</id>
<content type='text'>
This partially reverts the optimisation introduced in 1d84b9e4b459 to avoid an
unpredictable block in nxt_unit_process_port_msg().  Under high load, this
function may never return control to its caller, and the external event loop
(in Node.js and Python asyncio) won't be able to process other scheduled
events.

To reproduce the issue, two request processing types are needed: 'fast' and
'furious'.  The 'fast' one simply returns a small response, while the 'furious'
schedules asynchronous calls to external resources.  Thus, if Unit is subjected
to a large amount of 'fast' requests, the 'furious' request processing freezes
until the high load ends.

The issue was found by Wu Jian Ping (@wujjpp) during Node.js stream
implementation discussion and relates to PR #502 on GitHub.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This partially reverts the optimisation introduced in 1d84b9e4b459 to avoid an
unpredictable block in nxt_unit_process_port_msg().  Under high load, this
function may never return control to its caller, and the external event loop
(in Node.js and Python asyncio) won't be able to process other scheduled
events.

To reproduce the issue, two request processing types are needed: 'fast' and
'furious'.  The 'fast' one simply returns a small response, while the 'furious'
schedules asynchronous calls to external resources.  Thus, if Unit is subjected
to a large amount of 'fast' requests, the 'furious' request processing freezes
until the high load ends.

The issue was found by Wu Jian Ping (@wujjpp) during Node.js stream
implementation discussion and relates to PR #502 on GitHub.
</pre>
</div>
</content>
</entry>
<entry>
<title>Python: multiple values in the "path" option.</title>
<updated>2020-12-22T14:53:41+00:00</updated>
<author>
<name>Valentin Bartenev</name>
<email>vbart@nginx.com</email>
</author>
<published>2020-12-22T14:53:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=cac762ab7ef22798d0f1d0813201c0018bd589a1'/>
<id>cac762ab7ef22798d0f1d0813201c0018bd589a1</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Python: WSGI environment copying moved out of request processing.</title>
<updated>2020-12-14T14:15:49+00:00</updated>
<author>
<name>Valentin Bartenev</name>
<email>vbart@nginx.com</email>
</author>
<published>2020-12-14T14:15:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.sigsegv.uk/unit.git/commit/?id=8d65a3303bde4fa2725310cd38af311e503e75ae'/>
<id>8d65a3303bde4fa2725310cd38af311e503e75ae</id>
<content type='text'>
The WSGI environment dictionary contains a number of static items, that are
pre-initialized on application start.  Then it's copied for each request to be
filled with request-related data.

Now this dictionary copy operation will be done between processing of requests,
which should save some CPU cycles during request processing and thus reduce
response latency for non-peak load periods.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The WSGI environment dictionary contains a number of static items, that are
pre-initialized on application start.  Then it's copied for each request to be
filled with request-related data.

Now this dictionary copy operation will be done between processing of requests,
which should save some CPU cycles during request processing and thus reduce
response latency for non-peak load periods.
</pre>
</div>
</content>
</entry>
</feed>
