Commit Graph

2478 Commits

Author SHA1 Message Date
Max Romanov 5196cf4d50 Rescheduling of pending request after configured timeout.
New optional configuration parameter introduced: limits.reschedule_timeout.
Default value 1 second.  In the case when request is written to the port
socket 'in advance', it is called 'pending'.

On every completed request, the head of pending request is checked against
reschedule timeout.  If this request waiting for execution longer than
timeout, it is cancelled, new port selected for this request.
2017-12-27 17:48:04 +03:00
Max Romanov baa8c9387b Fixing code style. 2017-12-27 17:47:42 +03:00
Max Romanov bef2ec483e Fixing application timeout.
Application timeout limits maximum time of worker response in processing
particular request.  Not including the time required to start worker,
time in request queue etc.
2017-12-27 17:47:18 +03:00
Max Romanov ab138c9166 Changing worker selection precedence.
This patch increase precedence of non-started worker over busy worker.

1. idle worker;
2. start new worker;
3. busy worker, but can accept request in advance;
2017-12-27 17:46:39 +03:00
Max Romanov 89c0f7c5db Implementing the ability to cancel request before worker starts processing it. 2017-12-27 17:46:17 +03:00
Valentin Bartenev 45d08d5145 HTTP parser: introduced nxt_http_parse_fields(). 2017-12-27 15:45:23 +03:00
Max Romanov be36cf52c8 Introducing application 'atexit' hook.
Finalizing Python interpreter.

This closes #65 issue on GitHub.
2017-12-27 14:02:11 +03:00
Sergey Kandaurov cdfdbc43eb Enabled exporting symbols for NetBSD. 2017-12-26 17:55:48 +03:00
Igor Sysoev 2ab29f6cc3 nxt_conn_close() should disable all pending write operations. 2017-12-26 17:31:37 +03:00
Valentin Bartenev 95a9cb94d5 HTTP parser: fixed memory overflow in the collisions test.
The level hash uses the NULL value as the indicator of a free entry in a bucket.
So, inserting a NULL value breaks the hash and can lead to a bucket overflow.

In case of the collision counter, the value wasn't initialized, since it's not
needed for the purpose of checking collisions.  As a result, it might contain
any garbage from the stack and in some rare cases the value was NULL.

Now the value is initilized.
2017-12-26 17:18:57 +03:00
Valentin Bartenev 8830d73261 HTTP parser: reworked header fields handling. 2017-12-25 17:04:22 +03:00
Max Romanov 392abd03e5 Restoring apps in case of reconfiguration error. 2017-12-25 16:24:54 +03:00
Max Romanov 4e403c17da Introducing --lib-path options for Python module linkage.
This option is useful when python-config does not setup path to libpython,
which is non standard.
2017-12-15 14:06:15 +03:00
Max Romanov 799cff5f3e Introducing Unit version check in Go package.
To communicate with the Go program, Unit setup environment variable
named NXT_GO_PORTS with value contains Unit version, stream id to confirm
application is started, and Unit ports information.  Go Unit package parses
this string and compares runtime version with compile time version.  In case
of parse error or version mismatch, ListenAndServe() returns with the error.
2017-12-13 18:12:13 +03:00
Andrey Zelenkov b680e944d6 Tests: removed unused decorators. 2017-12-13 15:26:32 +03:00
Andrey Zelenkov d2bf066b1c Tests: http() function introduced. 2017-12-13 15:23:32 +03:00
Andrey Zelenkov f7c386ece3 Tests: fixed "negative workers" test. 2017-12-12 18:54:27 +03:00
Valentin Bartenev 67d72d46f7 HTTP parser: improved detection of corrupted request line. 2017-12-08 19:18:00 +03:00
Valentin Bartenev 20d720dfc5 HTTP parser: slightly improved readability of code.
As suggested by Igor Sysoev.
2017-12-08 19:18:00 +03:00
Valentin Bartenev 4be9774540 Fixed protocol version string handling in router. 2017-12-07 17:02:05 +03:00
Andrey Zelenkov 3b6d3151f1 Tests: added basic PHP tests. 2017-12-06 15:36:05 +03:00
Andrey Zelenkov 7ae5bef233 Tests: check_modules() function introduced. 2017-12-06 15:35:28 +03:00
Andrey Zelenkov 79b1d4f5ff Tests: port range changed to 7xxx. 2017-12-06 15:34:58 +03:00
Andrey Zelenkov 078d44ea71 Tests: removed extra parameter from range() call. 2017-12-06 15:34:06 +03:00
Andrey Zelenkov 487253754c Tests: waitforfiles() optimization. 2017-12-06 15:33:45 +03:00
Andrey Zelenkov 782fa1118d Tests: don't exceed 79 characters. 2017-12-06 15:32:09 +03:00
Max Romanov d14c0774c7 Go: removing request registry.
Passing unsafe.Pointers (void *) from Go to C is complicated by an attempt
to make such pointers less unsafe.

A straightforward optimization is to replace 'unsafe.Pointer' with 'uintptr'
(thanks to Xin Huang for the idea: https://stackoverflow.com/a/44826533 ).

As a result, request registry with mutex is gone.
2017-12-06 12:16:02 +03:00
Max Romanov 0db4d25316 Fixing Go package build in NetBSD.
Bug introduced in 585c8068a6d7.
2017-12-05 17:06:37 +03:00
Max Romanov cdf900cf2c Packaging changes for updated Go package.
- package name changed to 'nginx/unit';
- source files installed in /usr/share/gocode;
- rpm and deb go packages made noarch.
2017-12-01 16:59:41 +03:00
Max Romanov 40eb1f8b9b Making Go package source distributable and renaming to 'nginx/unit'.
All header files are copied to Go package sources.  As the result,
package can be (re-)build when required.

This closes #23 issue on GitHub.
2017-12-01 16:57:30 +03:00
Max Romanov ffb1c68609 Initializing port_msg fields with zeroes in Go package. 2017-12-01 16:51:30 +03:00
Max Romanov 630ec3f1ec Using compiler capability to generate dependencies.
This closes #58 issue on GitHub.
2017-12-01 16:28:06 +03:00
Max Romanov 1add36a7ee Using --ld-opt when linking modules. 2017-11-29 18:49:08 +03:00
Max Romanov 3781950bad Introducing python virtualenv configuration.
New parameter 'home' for python application allows to configure
application-specific virtualenv path.

This closes #15 issue on GitHub.
2017-11-29 18:48:55 +03:00
Andrey Zelenkov ec4ad8780e Tests: "verbose" mode introduced. 2017-11-29 15:23:22 +03:00
Andrey Zelenkov 75198f82b1 Tests: waitforfiles function introduced. 2017-11-29 15:23:09 +03:00
Andrey Zelenkov 4d772a9cd0 Tests: fixed port number in test_basic.t. 2017-11-28 21:59:31 +03:00
Andrey Zelenkov cf09ca655a Tests: changed shebang to the default. 2017-11-28 16:06:14 +03:00
Max Romanov ec411569e7 Fixing build on Solaris. 2017-11-02 15:32:46 +03:00
Igor Sysoev eb5c49ead9 Timer should be marked as it is not in tree after deletion.
This closes #64 issue on GitHub.
2017-11-27 18:50:31 +03:00
Igor Sysoev 40160621a9 Removed uncontext.h.
This removal was missed the changeset 2aad6a5fac13.
2017-11-27 18:50:18 +03:00
Igor Sysoev 80e8ce8322 A number of engine connections is decreased on connection close. 2017-11-27 17:52:28 +03:00
Andrey Zelenkov 863377441b Tests: added basic infrastructure. 2017-11-21 20:51:21 +03:00
Andrey Zelenkov 78a77c3e38 Tests: move existing tests to "src" folder. 2017-11-21 18:55:28 +03:00
Valentin Bartenev 89a1c66dd0 Fixed crash on invalid JSON number. 2017-11-21 18:41:43 +03:00
Max Romanov 6bbed85899 Fixing Coverity warnings.
CID 200496
CID 200494
CID 200490
CID 200489
CID 200483
CID 200482
CID 200472
CID 200465
2017-11-20 17:08:29 +03:00
Max Romanov fa76ea700f Fixing racing condition in request.msgs usage. 2017-10-27 11:05:37 +03:00
Max Romanov 1d11f8cfbb Fixing Go program crash.
Go request registration should be removed before C request memory freed.

C request address used as a key in Go map.  Freed memory can be instantly
reused for other request and older request registration should removed at this
point to avoid collisions.
2017-10-27 11:05:22 +03:00
Max Romanov 51396fea83 Checking the result of shared memory buffer allocation.
This closes #57 issue on GitHub.
2017-10-25 15:09:07 +03:00
Valentin Bartenev 5ed4d7b9dc Avoiding compilation on systems with no working shared memory. 2017-10-25 14:57:18 +03:00