summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* core: make object cache LIFO1.6.13dormando2022-01-121-1/+1
| | | | | was originally LIFO and I broke that when switching to the queue.h code. This is friendlier for cache.
* proxy: compile fix for non-uring mode.dormando2022-01-121-0/+6
|
* proxy: uring event thread periodic updaterdormando2022-01-121-0/+34
| | | | | liburing features should be 1:1 now. needs bug testing and then a rewiring for sqe/cqe starvation issues.
* proxy: bad backend retry code for uringdormando2022-01-121-10/+60
|
* proxy: basic timeout support for liburing modedormando2022-01-121-13/+48
| | | | still needs backend retry, connect, and a few other timeouts.
* meta: protocol.txt updates for CAS returndormando2022-01-121-1/+6
|
* meta: test coverage for cas fixesdormando2022-01-121-0/+35
|
* meta: fix meta deletedormando2022-01-121-2/+1
| | | | compared cas token was always zero...
* meta: fix CAS ('c') return valuesdormando2022-01-121-1/+3
| | | | | | | This should now align with the binary protocol. It might make sense for this to return the _current_ CAS value of the underlying item in the cases of EX... binprot does not currently do this, and the storage code is shared between binary and text so I can't change them independently.
* core: fix use-after-free for text multigetsdormando2022-01-111-1/+1
| | | | | | | | | | | Reported in #849 - this fixes copying a read buffer after freeing the original read buffer. This didn't matter for years since the cache code didn't touch the buffer, but recently it can reuse the first 8 bytes as a pointer to the internal freelist. Thus in some situations where large reads happen the command can get corrupted, returning an unhelpful "ERROR" to the end user.
* proxy: fix uring crash on backend disconnectdormando2021-12-021-1/+17
| | | | one TODO too-far, apparently.
* Replace OPENSSL_VERSION_NUMBER check with defined(TLS1_3_VERSION) check for ↵Kevin Lin2021-11-232-3/+3
| | | | | | | TLS v1.3 compatibility This provides compatibility with other SSL libraries like LibreSSL with different semantics of OPENSSL_VERSION_NUMBER.
* Fix full unit test suite under test_tlsKevin Lin2021-11-235-16/+37
| | | | | This allows `make test_tls` to reliably pass when running without parallelism.
* Track store errors in thread statsKevin Lin2021-11-236-7/+44
| | | | | | Add two new stat keys, `store_too_large` and `store_no_memory`, to track occurrences of storage request rejections due to writing too large of a value and writing beyond available provisioned memory, respectively.
* Fix time-of-check time-of-use bugskokke2021-11-234-13/+11
| | | Fixing 'bugs' of the pattern: 'assert(ptr != 0)' after 'ptr' was already dereferenced
* Fix for #837 - tests fail on OS Xdormando2021-11-221-6/+2
| | | | | | | | Always at least try to setrlimit to what we want it to be, but in debug mode ignore if it fails. This isn't the greatest workaround but will ensure the next release works under both valgrind and OS X. A better way to detect valgrind (importing their huge .h file I guess?) would mean we can skip setrlimit in that specific case only.
* extstore: avoid looping IO queues on submissiondormando2021-11-181-16/+24
| | | | | | | | | with low (ie; 1) IO threads, and a long IO depth (10k+) that might suddenly appear during a disk hiccup, we can cause a slowdown as each worker thread submission walks the entire queue. this fully avoids walking objects while holding any lock, though we can still do that a bit on the IO thread's end when reading the queue.
* tests: maxconns test when extstore enableddormando2021-11-031-24/+42
| | | | seems to pass...
* core: remove cdefs include from queue.hdormando2021-10-061-2/+0
| | | | | | compatibility issue - seems to only exist to ensure NULL is defined properly; but at the point in which we include the queue.h, NULL most certainly exists.
* proxy: initial commit.dormando2021-10-0525-10/+6162
| | | | | | | | | | | | | | | See BUILD for compilation details. See t/startfile.lua for configuration examples. (see also https://github.com/memcached/memcached-proxylibs for extensions, config libraries, more examples) NOTE: io_uring mode is _not stable_, will crash. As of this commit it is not recommended to run the proxy in production. If you are interested please let us know, as we are actively stabilizing for production use.
* add queue.h in archive1.6.12Remi Collet2021-09-281-0/+1
|
* Expose number of currently active watchers in stats1.6.11Kevin Lin2021-09-277-5/+43
| | | | | The stat key `log_watchers` indicates the number of active connected `watch` clients.
* Properly accommodate IPv6 addresses in LOG_CONNEVENTS logsKevin Lin2021-09-273-7/+8
|
* Configurable minimum supported TLS protocol versionKevin Lin2021-09-277-6/+120
| | | | | | | `-o ssl_min_version` can be used to configure the server to only accept handshakes from clients with a minimum TLS protocol version. Currently supported options are TLS v1.0, TLS v1.1, TLS v1.2, and TLS v1.3 (OpenSSL 1.1.1+ only).
* core: fix hang bug in extstoredormando2021-08-092-0/+17
| | | | | | | | | | The previous commit (IO queue submit if queue is not NULL, instead of queue count) exposed an apparent long standing bug in extstore: do an ascii-multiget request with multiple keys, but one too-long or otherwise garbage key. This will reset the queue count to 0 but leave a stack pointer to now freed memory. The next request could infinite loop, as this test was causing.
* core: io_flow requires triggering on stackdormando2021-08-091-2/+1
| | | | | instead of queue counter. only use the queue counter for figuring out when to return the connection
* core: io_queue flow second attemptdormando2021-08-095-88/+120
| | | | | | | | | | | probably squash into previous commit. io->c->thead can change for orpahned IO's, so we had to directly add the original worker thread as a reference. also tried again to split callbacks onto the thread and off of the connection for similar reasons; sometimes we just need the callbacks, sometimes we need both.
* core: io_queue_t flow modedormando2021-08-095-21/+67
| | | | | | | | | | | instead of passing ownership of (io_queue_t)*q to the side thread, instead the ownership of IO objects are passed to the side thread, which are then individually returned. The worker thread runs return_cb() on each, determining when it's done with the response batch. this interface could use more explicit functions to make it more clear. Ownership of *q isn't actually "passed" anywhere, it's just used or not used depending on which return function the owner wants.
* thread: use eventfd for worker notify if availabledormando2021-08-093-58/+104
| | | | | | now that all of the read/writes to the notify pipe are in one place, we can easily use linux eventfd if available. This also allows batching events so we're not firing the same notifier constantly.
* thread: unify worker notify interfacedormando2021-08-093-106/+106
| | | | | | | worker notification was a mix of reading data from pipe or examining a an object queue stack. now it's all one interface. this is necessary to switch signalling to eventfd or similar, since we won't have that pipe to work with.
* thread: per-worker-thread connection event queuesdormando2021-08-092-80/+39
| | | | | | | help scalability a bit by having a per-worker-thread freelist and queue for connection event items (new conns, etc). Also removes a hand-rolled linked list and uses cache.c for freelist handling to cull some redundancy.
* core: cache.c cleanups, use queue.h freelistdormando2021-08-094-145/+31
| | | | | | | | | cache constructors/destructors were never used, which just ended up being wasted branches. Since there's no constructor/destructor for cache objects, we can use the memory itself for the freelist. This removes a doubling realloc for the freelist of cache objects and simplifies the code a bunch.
* core: add queue.h to replace handrolled queues.dormando2021-08-092-0/+873
| | | | | FreeBSD version as there seems to be portability issues if you just use sys/queue, plus some extra features I like in this one.
* logger: simplify logging codedormando2021-08-092-311/+256
| | | | | | | | | | Adding a new type of log entry required updating code in a bunch of places. Now we use callbacks in the entry structure instead, cutting down the code and some awkwardness. Should also make it easier for plugins/extra systems to add log entries. Moving the writer/parsers to their own section makes the actual logging code easier to follow, as an added bonus.
* logger: avoid polling without watchersdormando2021-08-092-1/+11
| | | | | | | | | Inspired by #768 - logger thread would wake up once per second looking for watchers or log entries, but without any watchers. Now sleeps on a condition. Note that if I ever actually get logger to syslog/stdout/stderr/etc working properly this will still always poll.
* Implement LOG_CONNEVENTS watcher flag for connection state transitionsKevin Lin2021-08-078-2/+183
| | | | | | | | Add support for `watch connevents` to report opened (`conn_new`) and closed (`conn_close`) client connections. Event log lines indicate the connection's remote IP, remote port, and transport type. `conn_close` events additionally supply a reason for the closing the connection.
* Report item sizes for fetch, mutation, and eviction watchersKevin Lin2021-08-065-14/+50
| | | | | | This adds a new field `size` to logger entry lines for item_get, item_store, and eviction events indicating the size of the associated item in bytes.
* Fix typos in doc/code comments (tem->item, etc)Tyson Andre2021-08-055-7/+7
| | | | | Note: Do not fix typos in crc32.c because it's copied from an upstream source
* Fix minor severity heap buffer overflow reading `--auth-file`1.6.10Tyson Andre2021-07-251-8/+14
| | | | | | | | | | | Fixes #805 Allocate an extra byte for reading the last entry when there is no `\n` at the end of the file. Also, check if the user contains null bytes when reading the last entry. Unrelatedly, add handling in case the auth file size changes while it is being read.
* stats_prefix.c: Check for NDEBUG before using total_written variableKhem Raj2021-07-251-2/+6
| | | | | | | | | | | | | When using NDEBUG assert macro is ineffective which is caught by latest clang and reports that total_written is set but unused. Therefore check for NDEBUG to make sure assert is used only when its effective Fixes error: variable 'total_written' set but not used [-Werror,-Wunused-but-set-variable] size_t size = 0, written = 0, total_written = 0; ^ Signed-off-by: Khem Raj <raj.khem@gmail.com>
* .gitignore updatedormando2021-07-251-0/+1
| | | | my clang vim plugin whatevers creates a .cache directory.
* Add settings stat for shutdown_command enabledKevin Lin2021-07-253-1/+5
|
* [docker] Add user and expose the memcached portHervé Beraud2021-07-254-1/+13
| | | | | | | | | | | | | | | These changes aim to improve our memcached devtools images to allow us to reuse them during development stages. These changes create a memcached user for all the images, switch to this user by default once memcached have been configured for building. That allow to run the memcached server directly when the containers are started, else, without the user the run will fail as we try to execute memcached as root user. Also we should notice that the alpine image has been fixed by adding git to the list of the requirements to install. Else the build will fails.
* meta: remove EXPERIMENTAL mark + doc fixesdormando2021-07-251-12/+12
|
* meta: response code OK -> HDdormando2021-06-105-44/+74
| | | | | | | | | | | | | | I had the response code as "HD" in the past, but standardized on OK while merging a number of "OK-like" rescodes together. This was a mistake; as many "generic" memcached response codes use "OK". Most of these are management or specialized uncommon commands. With this, a client response parser can know for sure if a response is to a meta command, or some other command. `-o meta_response_old` starttime option has been added, valid for the next 3 months, which switches the response code back from HD to OK. In case any existing users depended on this and need time to migrate.
* meta: fix metaset syntaxdormando2021-06-103-56/+60
| | | | | | | payload length is now part of the main command rather than a flag/token pair. This allows byte swallow to be more reliable in the case of a flag parsing error, and makes sets easier to parse and buffer for servers implementing the protocol.
* meta: repairs to mset commanddormando2021-06-102-83/+127
| | | | | | | allows returning cas value of the new item on set. also fixes an extra space that was tagged onto the response line. which I had not noticed because all of the tests were looking for a space after the response line :( Bad copypasta from the metaget tests.
* hash: add XXH3 to list of hash algorithms.dormando2021-06-095-4/+5341
| | | | | | | | | | | | needs more testing. in a "pure miss" test to help show hashing overhead, with four worker threads and large ascii multigets there is a measurable performance boost for longer keys. Very short keys (10-15 bytes) are about even. for 150ish byte keys 12m rps -> 13m rps roughly. Not too bad! need to test hash table distribution for large sets of keys before merging. need to consider if worth switching the defaults now or later.
* fix arm64 crc32 on old glibc/gcc.dormando2021-06-081-0/+6
| | | | | patch by @sergey-dryabzhinsky on github, but he deleted the repo so I rewrote the commit.
* Update AUTHORSBrian Aker2021-06-071-0/+1
|