summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* proxy: fix subtle parser bug for some cmds1.6.16dormando2022-08-031-2/+14
| | | | | | | in the request parser the new endcap token was always the end of the line, but it should be the start of the next token. For some use cases the scanning stops early, or if we have too many tokens it would make the final token look like the rest of the line.
* proxy: add req:flag_token("F")dormando2022-08-034-0/+43
| | | | | | function accepts a flag, returns (bool, token|nil). bool indicates if the flag exists, and if the flag has a token it is returned instead of nil as the second value.
* proxy: mcp.response code and rline APIdormando2022-08-032-0/+49
| | | | | | | | | Adds resp:code(), which returns code you can compare with mcp.MCMC_CODE_* Adds resp:line(), which returns the raw response line after the command. This can be used in lua while the flag/token API is missing for the response object.
* proxy: add r:has_flag(), fix r:token() lengthdormando2022-08-034-8/+47
| | | | | | | | | Add mcp.request function for quick checking if a flag exists in a request string. Also updates internal code for checking the length of a token to use the endcap properly, and uses that for the r:token(n) requets as well, which fixes a subtle bug of the token length being too long.
* proxy: mcp.request improvementsdormando2022-08-033-5/+40
| | | | | | | | | | - errors if a string value is missing the "\r\n" terminator - properly uses a value from a response object - allows passing in a request object for the value as well - also adds r:vlen() for recovering the value length of a response think this still needs r:flags() or similar?
* proxy: mcplib_request_token() doesn't delimit the final token in a requestSailesh Mukil2022-07-251-7/+4
| | | | | | | | | mcplib_request_token() allows us to parse each token in a request string. The existing implementation delimits tokens using <whitespace>. This approach works for every token but the last one which will be followed by \r\n. This patch uses the token offsets present within the request parser to calculate the token boundaries instead of looping until the next delimiter.
* Disable TLS re-negotiation from SSL contextQu Chen2022-07-241-4/+11
| | | | via SSL_OP_NO_RENEGOTIATION option
* Fix undefined behavior and warning with clangTom Stellard2022-07-241-5/+4
| | | | | | This fixes a warning from clang about undefined behavior: error: embedding a directive within macro arguments has undefined behavior [-Werror,-Wembedded-directive]
* fix the hashstring size for evcache ketamaPrudhviraj K2022-07-242-0/+7
| | | | add proxy_debug flag for protocol handler in verbose printing
* Fix FTBFS with GCC 12 on ppc64elSergio Durigan Junior2022-07-241-1/+1
| | | | | | | GCC 12 on ppc64el complains about "key" being undefined on testapp.c. This commit silences the error. Signed-off-by: Sergio Durigan Junior <sergiodj@sergiodj.net>
* proxy: fix race crash from io obj use-after-freedormando2022-07-241-2/+12
| | | | | | | | | obvious once tracked down: STAILQ_FOREACH is actively using io->io_next, and the return call can free and potentially reuse the object if the thread gets suspended. There're _SAFE forms of the FOREACH but the reset flow shouldn't happen often enough to be worth using more than this standard pattern.
* proxy: fix mcp.await() when using extended argsdormando2022-07-241-8/+14
| | | | | | was checking the third lua arg, popping it, then likely never finding the fourth arg. now checks fourth arg first and pops it, then works backwards.
* proxy: add missing errno.h include to proxy.hdormando2022-07-241-0/+1
|
* proxy: fix potential corruption on partial writedormando2022-07-241-0/+1
| | | | | | | | If a command was partially sent we were not decrementing the byte sum cache. This would lead to listening on the wrong event and potentially causing corruption. It might be better to remove the cache to avoid mistakes like this and for loop it each time.
* proxy: fix uring modedormando2022-07-242-14/+11
| | | | | | | | | well I tested it a few times during the code split PR, but apparently not with the final PR. This updates the API and also fixes some compilation issues. There will still be bugs until I reorganize the sqe/cqe lifecycle but it can still be tested.
* proxy: rework backend buffer handlingdormando2022-07-243-106/+89
| | | | | | | | | | | experimental change. *io_uring mode is presently broken* there are some potential protocol desync bugs due to mcmc handling its own buffers and the newer event handler handling its own syscalls. this change should have better separation of code for the buffer tracking. if this change works I will add some optimizations to reduce memmove's.
* mcmc: experimental apidormando2022-07-243-111/+119
|
* tests: skip whitespace on vendor/*dormando2022-07-032-2/+2
|
* tls: Add switch to opt-in to kernel TLS on OpenSSL 3.0.0+Kevin Lin2022-07-035-0/+26
|
* checks port number at start timeDavid Carlier2022-07-031-0/+5
|
* Fix a memory leak in cache_limit_revised_downward_testRaphael Isemann2022-07-031-0/+2
|
* Add a command to dump keys for memcached-toolJunji Hashimoto2022-07-031-0/+26
|
* 'proxyreqs' does not work unless 'proxyuser' also providedSailesh Mukil2022-04-121-2/+2
| | | | | Ideally we should be able to see the requst logs only after: "watch proxyreqs"
* proxy: replace proxycmds stream with proxyreqsdormando2022-04-087-65/+9
| | | | | | | | | delete the magic logging and require mcp.log_req* be used if you want those types of entries to appear. keeps a separate data stream from "proxyuser" just in case that's useful. proxycmds wasn't able to get enough context to autogenerate useful log lines, so I'd rather not have it in there at all.
* proxy: mcp.log_req* API interfacedormando2022-04-088-9/+232
| | | | | | Lua level API for logging full context of a request/response. Provides log_req() for simple logging and log_reqsample() for conditional logging.
* Fix buffer overflow and prevent recv() of 0 byte1.6.15Fei Hu2022-03-071-4/+3
|
* proxy: allow await() to be called recursivelydormando2022-03-024-22/+40
| | | | | | | | previously mcp.await() only worked if it was called before any other dispatches. also fixes a bug if the supplied pool table was key=value instead of an array-type table.
* proxy: mcp.request(cmd, [val | resp])dormando2022-03-011-1/+13
| | | | | | | | | mcp.request can now take a response object and internally copy the value. bit faster than doing it through C. iterating from here should allow taking a reference to the resp object and directly pointing to its value, but we need to make resp objects immutable first.
* proxy: hacky method of supporting noreply/quietdormando2022-03-014-6/+110
| | | | | | | | | | | | | | | | avoids sending the response to the client, in most cases. works by stripping the noreply status from the request before sending it along, so the proxy itself knows when to move the request forward. has sharp edges: - only looking at the request object that's actually sent to the backend, instead of the request object that created the coroutine. - overriding tokens in lua to re-set the noreply mode would break the protocol. So this change helps us validate the feature but solidifying it requires moving it to the "edges" of processing; before the coroutine and after any command assembly (or within the command assembly).
* proxy: add ring_hash builtindormando2022-02-2411-57/+904
| | | | | | | | | | | | | this is ketama-based, with options for minor compat changes with major libraries. does _not_ support weights. The weights bits in the original ketama broke the algorithm, as changing the number of points would shift unrelated servers when the list changes. this also changes backends to take a "name" specifically, instead of an "ip address". Though note if supplying a hostname instead of an IP there might be inline DNS lookups on reconnects.
* proxy: fix logger entry memory corruptiondormando2022-02-241-0/+1
| | | | | | wasn't setting e->size of the log entry, so the data would corrupt. think I need an assert on e->size not being set from the function?
* storage: parameterize the compaction thread sleepdormando2022-02-219-15/+32
| | | | | | allows tests to run faster, let users make it sleep longer/less time. Also cuts the sleep time down when actively compacting and coming from high idle.
* proxy: pull chunks into individual c filesdormando2022-02-1811-3916/+3964
| | | | | | | | | now's a good time to at least shove functional subsections of code into their own files. Some further work to clearly separate the API's will help but looks not too terrible. Big bonus is getting the backend handling code away from the frontend handling code, which should make it easier to follow.
* proxy: documentation updatesdormando2022-02-182-8/+26
|
* proxy: "stats settings" for proxydormando2022-02-171-0/+4
| | | | not sure if I want to add the config file path since that could end up being an info leak.
* proxy: await improvementsdormando2022-02-171-29/+101
| | | | | | | | | | | | Adds MCP_AWAIT_* options as 4th argument. If waiting for a subset of requests instead of all requests, the 4th argument can specify what type of responses are considered valid. Also now includes _all_ observed results in the result table, when a specific number of "good" results are requested. The caller is supposed to filter for its intent. This allows observation of error codes if all requested results fail or it otherwise fails to meet its result conditions (via AWAIT_*)
* proxy: trivial support for SO_KEEPALIVE on backenddormando2022-02-162-4/+34
| | | | | global only setting, not able to be changed for existing backends on config reload. a few fixes would improve but not can do later.
* mcmc: upstream update for SO_KEEPALIVEdormando2022-02-162-1/+10
|
* proxy: fix crash on `stats proxy` sans user statsdormando2022-02-141-2/+4
| | | | | | | Fix is a little subtle: there's a race condition when a user stat is added to the global context but the worker threads aren't updated yet. So we check that the context in the user thread has enough stats slots to iterate, and that the user thread has stats at all.
* proxy: enable backend_total statdormando2022-02-111-4/+8
|
* proxy: track in-flight requestsdormando2022-02-113-34/+24
| | | | | | | I wanted to do this via lua with some on-close hooks on the coroutine but this might work for now. not 100% sure I caught all of the incr/decr cases properly. Was trying to avoid hitting the counters too hard as well.
* proxy: add some basic logging for backend errorsdormando2022-02-113-14/+41
|
* proxy: logging improvements + lua mcp.log()dormando2022-02-115-10/+36
| | | | | | | adds watch commands for: proxycmds - internal raw timing log (tbd?) proxyevents - config updates, internal errors, etc proxyuser - logs generated by mcp.log()
* proxy: add stats for commands seendormando2022-02-112-8/+52
| | | | added to "stats proxy" output. counters of commands seen at inbound.
* tests: workaround for t/watcher.t race1.6.14dormando2022-02-091-0/+1
| | | | need better option for this.. seems to fix this one thing.
* restart: fix typo in error messageBaptiste Mille-Mathias2022-02-091-1/+1
| | | | valiate -> validate
* Extend extbuf in try_read_command_binary functionTomas Korbar2022-02-091-1/+4
| | | | | | Extbuf needs to have 48 bytes because it is used for protocol_binary_request_incr union. Unions member message is alligned to 48 bytes.
* tests: repair race in maxconns.t testdormando2022-02-091-2/+11
| | | | | lsitener thread may not have actually accepted everything by the time we start closing them, so it might not show rejected connections.
* Fix more int overflow issues in hashtabledormando2022-02-091-7/+7
| | | | | | | | Previous commit fixes the main hash addressing, this adds further repairs to hash expansion and hash table walker. HASHPOWER_MAX stays at 32, since the computed hashvalue is 32bit and going beyond that would break things rather badly :)
* Fix integer overflow in hashsize calculation.Gabe Van Engel2022-02-091-4/+1
| | | | | | Remove use of confusing ub4 type in hashsize calculation, which actually needs to be greater than 4 byte. Remove unused ub4 and ub1 typedefs.