http: allow all forks to process HTTP requests
This MR allows the http
module to run on all forks.
Merge request reports
Activity
- Resolved by Petr Špaček
- Resolved by Petr Špaček
added 1 commit
- 57944f9f - modules/http: allow passing server options to http configuration
added 10 commits
- 57944f9f...9bdfbdd8 - 9 commits from branch
master
- 1f9d5826 - modules/http: allow passing server options to http configuration
- 57944f9f...9bdfbdd8 - 9 commits from branch
added feature label
The old version allowed only one fork to serve HTTP (the one with the worker.id = 0). Now any fork can serve HTTP (because of reuseport), which is good for supporting things like DNS over HTTPS etc., but I think the command fan-out doesn't work if it's running on on non-primary fork. Let me fix that.
So there are two problems before all forks can fully serve HTTP:
- Only the first fork can send commands to the other forks, which means that if any other fork gets the HTTP request, it won't "see" the rest of the forks
- Handling of the remote commands is synchronous, so if two forks send each other commands, they will deadlock
I will try to rewrite most of the the remote commands functionality to Lua so that it's possible to make it non-blocking with cqueues (just like the HTTP module).
Hmm, this is a problem because cqueues are not packaged in Fedora/EPEL and other distros. Do you see a way to keep it optional dependency?
Edited by Petr Špaček@vavrusam: the point is that the http module can be easily omitted in case some distro/developer/... doesn't want to bother packaging/obtaining cqueues.
added 19 commits
- e6988214...b18846d9 - 5 commits from branch
master
- bb2f1c46 - daemon: added callback for resolve() query initialisation
- 00cb5245 - daemon: fixed memory leaking from wrk_resolve on some input errors
- b88714db - lib/resolve: add support for per-request logging
- 80abd563 - lib/rplan: remember request context in each query
- 937ec9a6 - lib: added support for trace_log for verbose messages
- 17d9bd86 - modules/http: added /trace endpoint for request log tracing, added tests
- 3f56c970 - modules/http: updated format of the /trace log
- 6f750103 - clean up on module test success, fix priming query failing predict test
- 6cc0b704 - ci: added lua-http dependency to build, fixed test for http
- 98f3284a - main: close loop after it's finished to please valgrind
- 07ef83cb - kres: added support for NULL type
- d66d1563 - modules/http: added selected records to /trace endpoint
- 3255c2a0 - modules/http: allow passing server options to http configuration
- e06ad114 - Implement worker coroutines for asynchronous background processing
Toggle commit list- e6988214...b18846d9 - 5 commits from branch
I tried to make cqueues as optional as possible, but it doesn't make sense to me to make IPC work correctly without it (because it's inherently synchronous, so two forks talking to each other would deadlock). I tried to provide some reasoning in the commit message and MR header, so please let me know if that's acceptable. The daemon will still work without the library, but it's not going to be as nice.
added 1 commit
- 65fc7f56 - Implement worker coroutines for asynchronous background processing
added 1 commit
- b5c2df3e - Implement worker coroutines for asynchronous background processing
added 1 commit
- d78095d5 - daemon/worker: allow large responses for outbound over TCP
added 45 commits
- d78095d5...c75b1176 - 42 commits from branch
query-trace
- b91ff55a - modules/http: allow passing server options to http configuration
- d2c1aa04 - Implement worker coroutines for asynchronous background processing
- 55fc6c7e - daemon/worker: allow large responses for outbound over TCP
Toggle commit list- d78095d5...c75b1176 - 42 commits from branch
added 4 commits
Toggle commit listadded 4 commits
- c34ad084 - added knot_dname_t * to Lua string wireformat conversion function
- 0146a88f - daemon: unified query completion callback with trace callback in resolve
- 13debc30 - lib: added kr_rplan_last() function to get last processed query
- c9f5878a - tests/config: all tests can now be asynchronous with worker.coroutine
Toggle commit listmentioned in merge request !405 (merged)
added 446 commits
-
49087d4a...fa4ea355 - 446 commits from branch
query-trace
-
49087d4a...fa4ea355 - 446 commits from branch
@vcunat there's one commit left to allow
http
module to run on all forks, I've rebased the branch and updated the MR to reflect that.Edited by Marek Vavrusaassigned to @gdemidov
@vavrusam Could you rebase please this branch over master? I will merge it then.
added 232 commits
- fa4ea355...bba85538 - 231 commits from branch
master
- 165e1411 - modules/http: allow passing server options to http configuration
- fa4ea355...bba85538 - 231 commits from branch
Hmm, the rebase broke tests:
ok 1 - creates server instance ok 2 - binds to an interface not ok 3 - static page return 200 OK # Trouble in /builds/knot/knot-resolver/modules/http/http.test.lua around line 36 not ok 4 - static page has non-empty body # Trouble in /builds/knot/knot-resolver/modules/http/http.test.lua around line 37 not ok 5 - static page has text/html content type # Trouble in /builds/knot/knot-resolver/modules/http/http.test.lua around line 38 ok 6 - custom page return 200 OK ok 7 - custom page has non-empty body ok 8 - custom page has custom content type ok 9 - non-existent page returns 404 not ok 10 - /stats page return 200 OK # Trouble in /builds/knot/knot-resolver/modules/http/http.test.lua around line 49 not ok 11 - /stats page has non-empty body # Trouble in /builds/knot/knot-resolver/modules/http/http.test.lua around line 50 not ok 12 - /stats page has correct content type # Trouble in /builds/knot/knot-resolver/modules/http/http.test.lua around line 51 not ok 13 - /metrics page return 200 OK # Trouble in /builds/knot/knot-resolver/modules/http/http.test.lua around line 54 not ok 14 - /metrics page has non-empty body # Trouble in /builds/knot/knot-resolver/modules/http/http.test.lua around line 55 not ok 15 - /metrics page has correct content type # Trouble in /builds/knot/knot-resolver/modules/http/http.test.lua around line 56 not ok 16 - /trace page return 200 OK # Trouble in /builds/knot/knot-resolver/modules/http/http.test.lua around line 59 not ok 17 - /trace page has non-empty body # Trouble in /builds/knot/knot-resolver/modules/http/http.test.lua around line 60 not ok 18 - /trace page has correct content type # Trouble in /builds/knot/knot-resolver/modules/http/http.test.lua around line 61 not ok 19 - /trace checks type # Trouble in /builds/knot/knot-resolver/modules/http/http.test.lua around line 64 not ok 20 - /trace requires name # Trouble in /builds/knot/knot-resolver/modules/http/http.test.lua around line 66 1..20 Expected return code '0' got '14'. tests/config/test_config.mk:20: recipe for target 'modules/http/http.test.lua' failed
assigned to @vavrusam
mentioned in commit 4eedc70c
mentioned in commit 111590ad