Commit Graph

1891 Commits

Author SHA1 Message Date
Valentin Bartenev
b04832da84 Disabled logging alerts to syslog.
It feels to be causing more harm than good, because syslog() can be blocking,
which is even more critical under resource exhaustion conditions when some
alerts are expected.
2021-03-24 08:05:07 +03:00
Sergey A. Osokin
175ef1c1db Java: upgrading third-party components. 2021-03-22 17:15:12 +03:00
Valentin Bartenev
99337728ed Fixed building the PHP 5 module with ZTS, broken by dab8544b5440.
This closes #525 issue on GitHub.
2021-03-15 15:03:32 +03:00
Valentin Bartenev
4c261a7ff8 Ruby: fixed encodings initialization.
The Ruby interpreter expects an explicit setlocale() call before initialization
to pick up character encodings in the "Encoding" class from the environment.

This closes #531 issue on GitHub.
2021-03-15 15:03:32 +03:00
Valentin Bartenev
b0a1266835 Fixed certificates loading on startup with some filesystems.
It appears that readdir() on Linux detects file types unreliably, always setting
the "d_type" field to DT_UNKNOWN for some less common filesystems.  As a result,
all files were skipped and no certificate bundles were found when the state
directory was located on such filesystems.

Skipping "." and ".." instead of any non-regular files should be enough, as no
other non-regular files normally appear in this directory.

This closes #368 issue on GitHub.
2021-03-15 14:57:31 +03:00
Valentin Bartenev
a1107e859b Fixed TLS connection shutdown on errors.
An immediate return statement on connection errors was mistakenly added to the
beginning of nxt_openssl_conn_io_shutdown() in ecd3c5bbf7d8, breaking the TLS
connection finalization procedure.  As a result, a TLS connection was left
unfinalized if it had been closed prematurely or a fatal protocol error had
occurred, which caused memory and socket descriptor leakage.

Moreover, in some cases (notably, on handshake errors in tests with kqueue on
macOS) the read event was triggered later and nxt_h1p_conn_error() was called
the second time; after the change in af93c866b4f0, the latter call crashed the
router process in an attempt to remove a connection from the idle queue twice.
2021-03-15 14:57:01 +03:00
Max Romanov
1950d0aee2 Closing app outgoing shared memory file descriptor.
This fixes file descriptor leakage in router.  Shared memory file used to
send data from router to application.  These files are shared among all
processes of same application and router keeps the opened file descriptor since
06017e6e3a5f commit.
2021-03-02 19:33:37 +03:00
Max Romanov
73ac0496fe Fixing warnings on Solaris.
pthread_t on Solaris is an integer type with size not equal to pointer size.
To avoid warnings, type casts to and from pointer needs to be done via
uintptr_t type.

This change originally proposed by Juraj Lutter <juraj@lutter.sk>.
2021-03-02 18:31:03 +03:00
Max Romanov
fddde539c9 Fixing NetBSD compatibility.
Instead of PTHREAD_STACK_MIN define, NetBSD requires to get minimum stack
size using sysctl(_SC_THREAD_STACK_MIN).

This change originally proposed by Juraj Lutter <juraj@lutter.sk>.
2021-03-02 18:30:34 +03:00
Andrei Zeliankou
d0591f07d7 Tests: fixed tests to work without openssl support. 2021-02-23 22:25:47 +00:00
Andrei Zeliankou
af3b6ef37d Tests: added regex check. 2021-02-18 21:21:55 +00:00
Valentin Bartenev
ecd0fc5d81 Version bump. 2021-02-16 18:54:00 +03:00
Andrei Zeliankou
cf530e19bc Tests: clear certificates after each test. 2021-02-15 03:11:26 +00:00
Andrei Zeliankou
11f7d833a9 Tests: increased timeout in wait_for_record(). 2021-02-10 16:34:37 +00:00
Andrei Zeliankou
4404097e05 Tests: added "--restart" option.
Now Unit do not restart after each test by default.
2021-02-08 23:32:27 +00:00
Konstantin Pavlov
958bc90caa Regenerated Dockerfiles. 2021-02-05 15:54:51 +03:00
Konstantin Pavlov
6dbb36a537 Docker: added curl run-time dependency.
It is needed for docker-entrypoint scripts to work.
2021-02-05 14:48:52 +03:00
Andrei Belov
bb424d97c0 Added changelog for Python 3.9 module appeared for Fedora 33. 2021-02-04 18:48:59 +03:00
Valentin Bartenev
774a6034d9 Added tag 1.22.0 for changeset 331bdadeca30 2021-02-04 18:29:31 +03:00
Valentin Bartenev
98228f8ac8 Generated Dockerfiles for Unit 1.22.0. 2021-02-04 18:22:33 +03:00
Valentin Bartenev
56626b9232 Added version 1.22.0 CHANGES. 2021-02-04 18:22:33 +03:00
Valentin Bartenev
bde6a2afd4 Reordered changes for 1.22.0 by significance (subjective). 2021-02-04 18:22:33 +03:00
Andrei Zeliankou
42725137f7 Tests: added tests for "path" option in Python application. 2021-02-04 15:09:54 +00:00
Artem Konev
f2d9633566 Updated phrasing and corrected errors in docs/changes.xml. 2021-02-04 14:34:42 +00:00
Max Romanov
75a5dcfc4e Fixing shared app queue unmap size.
Shared app queue takes more memory than port memory.  To unmap all memory pages
correct size need to be specified for munmap() call.  Otherwise 4 Mb memory
leaked on each configured application removal.

The issue was introduced in 1d84b9e4b459.
2021-02-03 23:23:28 +03:00
Max Romanov
b1685dbc76 Fixing possible NULL dereference.
For listen socket request reply port can be NULL if Router crashes immediately
after issuing the request.

Found by Coverity (CID 366310).
2021-02-03 23:23:17 +03:00
Max Romanov
8c88537e6e Using shared memory to pass configuration to main process.
This patch is required to remove fragmented messages functionality.
2021-02-03 23:23:06 +03:00
Konstantin Pavlov
d4d704bc7f Docker: reverted 44154b830401.
Automatic synchronisation is now set up, so manual pushes to AWS ECR are
discouraged.
2021-02-02 16:46:10 +03:00
Valentin Bartenev
93ac087e96 Fixed building by GCC 10 with -flto and -O2.
This closes #467 issue on GitHub.
2021-02-01 18:55:49 +03:00
Konstantin Pavlov
510bdf15be Regenerated Dockerfiles. 2021-02-01 18:05:12 +03:00
Konstantin Pavlov
df8ac184fd Docker: based docker images off official languages ones.
Language versions are bumped to:
 - python 3.9
 - ruby 2.7
 - go 1.15
 - node 15
 - perl 5.32

Removed images:
 - python 2.7 due to EOL
 - full/latest due to incompatibility with the new scheme
2021-01-13 22:33:14 +03:00
Valentin Bartenev
0ddbc00d7d Fixed changelog style. 2021-01-28 19:22:17 +03:00
Max Romanov
46a8c98a1a Removing unused mutex from nxt_process_t. 2021-01-28 18:32:12 +03:00
Max Romanov
e4e444b827 Router: fixing crash after WebSocket processing.
After WebSocket processing, the application port was released with incorrect
reason ("got request"), unnecessarily decrementing the active request counter.

The assertion was triggered only on application removal; a test was added
for this case.
2021-01-28 17:13:52 +03:00
Max Romanov
3855f1c032 Router: fixing error handling in config request.
The controller process awaits the response from the router for every
configration change request.  This patch adds error reporting for various error
conditions which may happen because of file descriptors or memory shortage.

Lack of a response lead to the controller awaiting the response, thus being
unable to process other client reconfiguration requests that also became stuck.
2021-01-27 17:32:03 +03:00
Andrei Belov
e4f7d1a29c Packages: added Fedora 33 support. 2021-01-26 13:06:30 +03:00
Max Romanov
9b76505bf7 Router: fixing assertion in shortage of file descriptors.
Each application in router process required fd for a request queue shared
memory.  When the number of file descripts close to the limit, and port sockets
successfully opened, router needs to properly handle the errors.

This patch closes port sockets before destroying port structure to avoid
file descriptors leakage and assertion in debug build.
2021-01-25 13:13:17 +03:00
Valentin Bartenev
6e28263d65 Bumping year in copyright notice. 2021-01-18 16:48:47 +03:00
Andrei Zeliankou
d43a84139d Tests: added missing checks for configuration results. 2021-01-14 03:04:20 +00:00
Andrei Zeliankou
5d983ea762 Tests: added test for "procfs" option. 2021-01-13 06:24:41 +00:00
Andrei Zeliankou
22dac5bd62 Tests: "language_deps" option checked more carefully. 2021-01-13 06:24:32 +00:00
Andrei Zeliankou
db9b70932b Tests: waitformount() and waitforunmount() introduced. 2021-01-13 06:24:26 +00:00
Andrei Zeliankou
6dc9c47ccd Tests: style. 2021-01-13 06:22:43 +00:00
Andrei Zeliankou
f5ac143246 Tests: unit_stop() removed where possible.
Since wait_for_record() was introduced there is no need
to stop Unit before parsing unit.log.
2021-01-12 06:20:23 +00:00
Tiago Natel de Moura
a0bc946db3 Tests: fixed test_respawn.py to act upon test processes.
Running `test_respawn_` test cases on a machine with Unit
daemon in background would fail tests because `ps ax` was
used without filtering out other unit instances.

This patch also prevents from tests killing other Unit
processes not related to tests.
2021-01-08 10:38:46 +00:00
Tiago Natel de Moura
13a06497de Tests: reordered asserts to avoid a test race.
The mount points are unmounted in the main process after it
detects the app process died.  By testing the `tmpfs: true`
first, it happens that main could start the `tmpfs: false`
test case before main cleans the old process mount points.
2021-01-07 16:51:27 +00:00
Max Romanov
d65a66f9d8 Libunit: processing single port message.
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.
2020-12-29 19:01:24 +03:00
Max Romanov
d3d6864bdc Node.js: ServerRequest and ServerResponse compliance to Stream API.
ServerRequest now inherit stream Readable object.  ServerResponse
provides 'writable' property.

Thanks to Wu Jian Ping (@wujjpp).

This closes #274, closes #317 issues and closes #502 PR on GitHub.
2020-12-29 19:00:54 +03:00
Andrei Belov
3abca42caf Packages: fixed building for Ubuntu 16.04 "xenial".
Changes introduced in a27532e3a17b effectively broke building of the unit
package due to missed dh_installsystemd script in older debhelper 9.x.

Once Ubuntu 16.04 reach EOL, the following actions should be made:
 - this commit should be reverted;
 - minimal debhelper version should be increased to 11.
2020-12-28 12:51:30 +03:00
Andrei Belov
c981ac6558 Packages: fixed an ability to override package version.
This was broken since 00d8049418cf.
2020-12-24 16:17:27 +03:00