Commit Graph

1325 Commits

Author SHA1 Message Date
Valentin Bartenev
e9429324c2 Python: improved error handling if response object isn't iterable.
According to the documentation, PyObject_GetIter():

 | Raises TypeError and returns NULL if the object cannot be iterated.

Previously, this exception wasn't printed or cleared and remained unhandled.
2019-11-14 17:48:48 +03:00
Valentin Bartenev
e189d0a96c Python: fixed handling of errors on response object iteration.
According to the documentation, PyIter_Next():

 | If there are no remaining values, returns NULL with no exception set.
 | If an error occurs while retrieving the item, returns NULL and passes
 | along the exception.

Previously, this exception wasn't properly handled and the response was
finalized as successful.

This issue was introduced in b0148ec28c4d.

A check for PyErr_Occurred() located in the code below might print this
traceback or occasionally catch an exception from one of the two response
close() calls.

Albeit that exceptions from the close() calls also need to be catched,
it's clear that this particular check wasn't supposed to do so.  This is
another issue and it will be fixed later.
2019-11-14 17:48:48 +03:00
Andrei Zeliankou
c7726c0eb1 Tests: proxy tests. 2019-11-14 17:15:29 +03:00
Andrei Zeliankou
efb461c0e1 Tests: run_process() and stop_processes() introduced. 2019-11-14 17:15:20 +03:00
Andrei Zeliankou
b5e3e22a46 Tests: waitforsocket() introduced. 2019-11-14 17:14:55 +03:00
Igor Sysoev
02e197e978 Processing inconsistent proxied response length.
Keepalive connection is disabled if upstream response length
differs from specified in the "Content-Length" field value.
2019-11-14 16:40:02 +03:00
Igor Sysoev
ddde9c23cf Initial proxy support. 2019-11-14 16:39:54 +03:00
Igor Sysoev
57e326b411 Introduced chained buffer completion handlers. 2019-11-14 16:39:48 +03:00
Igor Sysoev
643c433f8e Using event engine memory buffers in HTTP/1 layer. 2019-11-14 16:39:48 +03:00
Igor Sysoev
1ec6353733 Introduced event engine memory buffers. 2019-11-14 16:39:48 +03:00
Igor Sysoev
07c007af57 Event engine memory cache refactored. 2019-11-14 16:39:48 +03:00
Igor Sysoev
d4e3951c4d Using request task. 2019-11-14 16:39:48 +03:00
Igor Sysoev
14e56fe8c8 Replacing pass with action. 2019-11-14 16:39:48 +03:00
Igor Sysoev
96cd6558ce Fixed connect(2) errors processing on old Linuxes.
While connect(2) states that non-blocking connect should use EPOLLOUT:

  EINPROGRESS
    The socket is non-blocking and the connection cannot be completed
    immediately.  It is possible to select(2) or poll(2) for completion by
    selecting the socket for writing.  After select(2) indicates writability,
    use getsockopt(2) to read the SO_ERROR option at level SOL_SOCKET to
    determine whether connect() completed successfully (SO_ERROR is zero)
    or unsuccessfully (SO_ERROR is one of the usual error codes listed here,
    explaining the reason for the failure).

On connect error, Linux 2.6.32 (CentOS 6) may return EPOLLRDHUP, EPOLLERR,
EPOLLHUP, EPOLLIN, but not EPOLLOUT.
2019-11-14 16:39:48 +03:00
Andrei Zeliankou
5452ee458d Tests: fixed websocket tests. 2019-11-13 18:11:24 +03:00
Andrei Zeliankou
45d75ee2cb Tests: added Python test with threading. 2019-11-13 16:51:12 +03:00
Valentin Bartenev
69ff7ce731 Python: releasing GIL while waiting for a request.
It unblocks other threads that can be forked by the application
to work in background.

This closes #336 issue on GitHub.
2019-11-13 16:45:37 +03:00
Andrey Zelenkov
defb14f165 Tests: added Ruby test with constants. 2019-11-13 15:53:56 +03:00
Max Romanov
bdd96bc9ed Ruby: fixing initialization sequence.
There was a change (ruby/ruby@6c70fed) in Ruby 2.6 that moved
RUBY_DESCRIPTION global constant definition out of Init_version().
Unit initialized Ruby incorrectly, so the constant was not defined.

This closes #330 issue on GitHub.
2019-11-13 15:53:49 +03:00
Max Romanov
f2610d2160 Fixing libunit 'off by 2' issue in library.
Name and value in each header are 0-terminated, so additional 2 bytes
should be allocated for them.  There were several attempts to add these
2 bytes to headers in language modules, but some modules weren't updated.
Also, adding these 2 bytes is specific to the implementation which may be
changed later, so extending this mechanics to modules may cause errors.
2019-11-11 18:04:17 +03:00
Andrey Zelenkov
ed3298a3c6 Tests: fixed operator in http.py. 2019-11-08 14:04:32 +03:00
Valentin Bartenev
cc82547782 Respecting AR environment variable to configure ar binary. 2019-11-07 19:53:25 +03:00
Hong Zhi Dao
5d42599e33 Process port refactoring.
- Introduced nxt_runtime_process_port_create().
- Moved nxt_process_use() into nxt_process.c from nxt_runtime.c.
- Renamed nxt_runtime_process_remove_pid() as nxt_runtime_process_remove().
- Some public functions transformed to static.

This closes #327 issue on GitHub.
2019-10-29 16:07:21 +03:00
Max Romanov
65b03a14a7 Allocating process init struct from runtime memory pool.
This avoids memory leak reports from the address sanitizer.
2019-10-29 15:33:45 +03:00
Tiago Natel
4a79e9631b Added clone syscall check for uid/gid mapping.
Now it's possible to pass -DNXT_HAVE_CLONE=0 for debugging.
2019-10-28 16:02:40 +00:00
Tiago Natel
0b02e74abc Releasing the memory of removed thread pools at exit. 2019-10-28 15:49:03 +00:00
Andrey Zelenkov
13b4538fc7 Tests: added test with invalid "working_directory" value. 2019-10-23 16:59:53 +03:00
Andrey Zelenkov
d58fe3db98 Tests: more URI normalization tests. 2019-10-23 16:59:53 +03:00
Andrey Zelenkov
38cfe4cf3d Tests: added USR1 signal test for unit.log. 2019-10-23 16:59:53 +03:00
Andrey Zelenkov
1033cfa3b0 Tests: more static tests. 2019-10-23 16:59:53 +03:00
Andrey Zelenkov
47436e9be5 Tests: improved handshake for websocket tests. 2019-10-23 16:26:06 +03:00
Andrey Zelenkov
f878b6eea5 Tests: style. 2019-10-23 16:05:52 +03:00
Andrey Zelenkov
f5b1ac0dc6 Tests: check initial configuration in test_access_log.py. 2019-10-23 16:05:44 +03:00
Andrey Zelenkov
31bbc755fd Tests: check initial configuration in test_routing.py. 2019-10-23 16:05:40 +03:00
Andrey Zelenkov
1bece759a3 Tests: added flush() in "errors_write" Python application. 2019-10-23 16:05:35 +03:00
Max Romanov
ad518ae6c4 Python: fixing Python 3.8 build with clang.
Python 3.8 has 'tp_print' field in PyTypeObject struct.  This field is
attributed as deprecated.  So, clang generates warning (which is turned to
error) as a result of initializing this field.  From the other hand, it is
impossible to omit this field in positional initialization.  The solution
is to use designated initializer.

Silencing usage message during configure python.

This is related to #331 issue on GitHub.
2019-10-23 14:04:29 +03:00
Tiago Natel
23b94fde83 Improved error logging when uid/gid map is not properly set.
When using "credential: true", the new namespace starts with a completely
empty uid and gid ranges.  Then, any setuid/setgid/setgroups calls using ids
not properly mapped with uidmap and gidmap fields return EINVAL, meaning
the id is not valid inside the new namespace.
2019-10-22 14:46:15 +00:00
Max Romanov
2dbfd7c35e Fixing process crash in case of module load error.
This is related to #330 issue on GitHub.
2019-10-22 16:14:02 +03:00
Max Romanov
8df4468014 Fixing idle connection close function.
There was a typo: nxt_queue_head() used instead of nxt_queue_first() in
connection iteration loop.  This prevents idle connection close on quit.

This closes #334 issue on GitHub.
Thanks to 洪志道 (Hong Zhi Dao).
2019-10-22 16:04:56 +03:00
Max Romanov
e54f5f3dc8 Python: fixing build for Python 3.8.
Thanks to tonyafanasyev.
This is related to #331 issue on GitHub.
2019-10-22 16:04:30 +03:00
Tiago Natel
0beb8ea5e1 Fixed passing false in namespace flags.
This patch closes #328 in github.
2019-10-11 10:00:06 +00:00
Igor Sysoev
09e7357b08 Style fixes. 2019-10-10 19:42:41 +03:00
Igor Sysoev
ec0d5c928e Changed nxt_memcasecmp() interface to avoid casts. 2019-10-10 19:37:40 +03:00
Valentin Bartenev
75453479f3 Configuration: added check for mandatory options of "action". 2019-10-09 15:26:59 +03:00
Andrey Zelenkov
486b202cc1 Tests: default port number used. 2019-10-08 00:28:40 +03:00
Andrey Zelenkov
faf4ad5478 Tests: increased subprocess timeout on Unit exit.
Also changed order of subprocess status checks.
_terminate_process() method removed.
2019-10-08 00:28:40 +03:00
Valentin Bartenev
1b4c96f265 Version bump. 2019-10-07 18:38:41 +03:00
Valentin Bartenev
59db9a3887 Added tag 1.12.0 for changeset b391df5f0102 2019-10-03 17:34:58 +03:00
Valentin Bartenev
946cbd1f10 Generated Dockerfiles for Unit 1.12.0. 2019-10-03 17:08:32 +03:00
Valentin Bartenev
b1cb78ef8e Added version 1.12.0 CHANGES. 2019-10-03 16:30:31 +03:00