Commit Graph

345 Commits

Author SHA1 Message Date
Max Romanov
ebbe89bd5c Optimized send message allocations.
For empty write queue cases, it is possible to avoid allocation and enqueue
send message structures.  Send message initialized on stack and passed to
write handler.  If immediate write fails, send message allocated from engine
pool and enqueued.
2017-10-04 14:59:35 +03:00
Max Romanov
6a64533fa3 Introducing use counters for port and app. Thread safe port write.
Use counter helps to simplify logic around port and application free.

Port 'post' function introduced to simplify post execution of particular
function to original port engine's thread.

Write message queue is protected by mutex which makes port write operation
thread safe.
2017-10-04 14:58:47 +03:00
Max Romanov
414d508e04 Using engine memiory pool for port write allocations.
To allow use port from different threads, the first step is to avoid using
port's memory pool for temporary allocations required to send data through
the port.  Including but not limited by:
  - buffers for data;
  - send message structures;
  - new mmap fd notifications;

It is still safe to use port memory pool for incoming buffers allocations
because recieve operation bound to single thread.
2017-10-04 14:58:13 +03:00
Max Romanov
ba31199786 Removing mem_pool from port_hash interface.
Memory pool is not used by port_hash and it was a mistake to pass it into
'add' and 'remove' functions.  port_hash enrties are allocated from heap.
2017-10-04 14:57:56 +03:00
Max Romanov
4ae76249ed Fixing memory leak when handling remove pid message.
Worker threads ports need to receive 'remove pid' message to properly handle
application process exit case and finish requests processed by particular
application worker.  Main process send 'remove pid' notification to service
thread port only and this message must be 'proxied' to other running engines.

Separate memory pool created for this message.  For each engine structure
required to post message to engine allocate from the pool using 'retain'
allocation method.  After successfull post structure will be freed using
'release' method.  To completely destroy poll one more 'release' should be
called to release initial reference count.

I'm afraid this should be simplified using good old malloc() and free() calls.
2017-10-04 14:57:29 +03:00
Valentin Bartenev
fcd141936c Version bump. 2017-10-02 17:10:12 +03:00
Igor Sysoev
9416a342b2 Fixed building by modern GCC. 2017-09-27 19:43:26 +03:00
Igor Sysoev
bfa808d689 Event engine memory cache for nxt_sockaddr_t.
Introducing event engine memory cache and using the cache for
nxt_sockaddr_t structures.
2017-09-27 19:22:59 +03:00
Sergey Kandaurov
752038eea8 Fixed building with pthread_t defined as a pointer. 2017-09-27 18:34:24 +03:00
Sergey Kandaurov
9213299d1f Supported linking with -lrt on BSD systems.
OpenBSD lacks support of librt.
2017-09-27 18:34:23 +03:00
Sergey Kandaurov
aac0f06f3d Better checking for shm_open() during configure. 2017-09-27 18:34:23 +03:00
Igor Sysoev
4f4647e187 Fixed "make dist" broken in changeset b18c0fb60032. 2017-09-27 18:34:15 +03:00
Valentin Bartenev
d18113ab66 Changed "path" to "directory" in configure summary.
The "directory" is more specific term, similar to "file".
2017-09-26 17:53:21 +03:00
Igor Sysoev
5635c259f9 Added state directory creation in install procedure. 2017-09-25 20:15:34 +03:00
Igor Sysoev
d04f030d1a Added --bindir and --sbindir options to the summary page. 2017-09-25 20:15:33 +03:00
Igor Sysoev
6b0a3aed22 Style fixes. 2017-09-25 18:04:11 +03:00
Max Romanov
2ae0449262 Checking mallopt() during configure.
mallopt() is absent on Alpine musl.
2017-09-25 17:53:10 +03:00
Igor Sysoev
8e2fd89634 Fixed displaying "echo" program building failure. 2017-09-22 20:13:55 +03:00
Valentin Bartenev
45c1d41f34 Removed fibers from compilation.
It's not used anyway, but breaks building with musl.

This closes issue #5 on GitHub.
2017-09-22 16:42:42 +03:00
Valentin Bartenev
6a78aedb7e README: added project name to the beginning.
Also, for prettier look in output of "cat" and "less" commands,
added an empty line at the end.
2017-09-19 19:05:03 +03:00
Valentin Bartenev
aa7eefe557 Simplified the README file.
Detailed documentation was moved to a separate repository
in order to keep the main repository clean from lots of
documentation edits.

See: http://hg.nginx.org/unit-docs
2017-09-19 18:12:26 +03:00
Max Romanov
4f7e00ef34 Fixing shared memory thread safety issue.
Do not reuse shared memory segment with different port until this segment
successfully received and indexed on other side. However, segment can be used
to transfer data via the port it was sent at any time.
2017-09-18 17:35:24 +03:00
Valentin Bartenev
75a6325656 Fixed memory leak caused by mempool related to request context.
The previous attempt of fixing this in e5a65b58101f hasn't been really
successful, because the actual memory leak was caused not by the request
parse context itself, but its memory pool.
2017-09-16 05:36:06 +03:00
Igor Sysoev
e5b4594376 Go: Fixed a bug introduced in the previous changeset. 2017-09-15 22:31:01 +03:00
Max Romanov
838d9946ac Introducing named port message handlers to avoid misprints. 2017-09-15 20:30:34 +03:00
Max Romanov
1449e27cb4 Fixing memory leak of request parse context. 2017-09-15 20:30:29 +03:00
Max Romanov
0bec14878e Introducing application timeout. 2017-09-15 20:30:24 +03:00
Valentin Bartenev
90ae152ce0 Fixed port handlers arrays. 2017-09-15 14:38:22 +03:00
Igor Sysoev
7c1db30994 Router: more logical code order change.
Updating the router engines list before posting jobs to worker thread
engines is more logical because worker threads may exit after the posting.
However, the previous code was safe because an engine is freed by
the router main thread after worker its thread has exited.
2017-09-15 12:27:24 +03:00
Igor Sysoev
309ba5abf2 Router: fixed segmentation fault.
The router process exited abnormally on reconfiguration if number
of worker threads had been decreased on the previous reconfiguration.
Besides the list of router engines should be updated only after a new
configuration joints have been prepared for all engines.
2017-09-14 22:30:38 +03:00
Valentin Bartenev
4953e5b5cb Configuration persistence.
Now configuration survives server reloads.
2017-09-10 06:22:15 +03:00
Igor Sysoev
72c3e08158 Router: worker threads should quit only if the main thread has
requested this.
2017-09-14 19:53:25 +03:00
Igor Sysoev
4d5e39e8c1 Fixed textual socket name lengths and Unix domain sockaddr length. 2017-09-14 18:16:22 +03:00
Nick Shadrin
f3280c5dc9 Fixed error messages grammar. 2017-09-12 21:14:40 +03:00
Javier Revillas
541f738a7f Removing extra spaces introduced by PR #1.
This closes #24 PR on GitHub.
From 1903735e179a68c5cb661a375a1a022f764ed3f1
2017-09-11 12:36:07 +03:00
Andrei Vagin
962f127939 Fixed a memory leak.
This closes #2 RP on GitHub.
From f13cca01b7aa489dcb6909513f2b781b36ac7fea
2017-09-08 14:10:48 -07:00
Sergey Fedchenko
22c6805949 Cosmetic fixes in port.go.
This closes #5 on GitHub.
From 615369a29511c6021e5623070f082fdb17ff37a2
2017-09-08 14:10:23 -07:00
Igor Sysoev
409dcd3a79 README: Fixed typos.
These closes #9, closes #13, closes #21 issues on GitHub.
2017-09-09 00:04:12 +03:00
Eugene Agafonov
fa42e9c7f9 Fixed typo.
This closes #1 PR on GitHub.
2017-09-07 01:41:22 +03:00
Max Romanov
d87a4fb642 Moving body data before headers for PHP POST.
PHP SAPI tries to read body for POST request before registering
header-specific variables. For other methods, read_post_body() called by SAPI
after variables registration.

This closes #10 issue on GitHub.
2017-09-07 16:39:31 -07:00
Max Romanov
789a101e99 Decalring clean and dist targets as .PHONY. 2017-09-07 16:38:05 -07:00
Valentin Bartenev
2c24b89844 README: fixed "hg clone" command. 2017-09-08 00:01:22 +03:00
Valentin Bartenev
67b8dd0387 README: added mention of the licence in the main section. 2017-09-07 23:59:10 +03:00
Igor Sysoev
1bff7d02fb README: fixed URLs. 2017-09-06 23:52:57 +03:00
Igor Sysoev
f08c68f232 README: shortened description. 2017-09-06 23:46:20 +03:00
Igor Sysoev
4daf74d659 README: fixed URLs. 2017-09-06 23:19:55 +03:00
Andrei Belov
0a03c41114 README: fixed package repository paths. 2017-09-06 23:14:05 +03:00
Igor Sysoev
40ff354361 Added tag 0.1 for changeset f9d308f3fceb 2017-09-06 22:50:26 +03:00
Valentin Bartenev
9e8328f758 README: added features list. 2017-09-06 22:37:07 +03:00
Igor Sysoev
f8c94cbcfb README: added Troubleshooting section. 2017-09-06 20:40:15 +03:00