Commit graph

134 commits

Author SHA1 Message Date
07f4ecd2d7 Make a number of improvements to cache handling.
- Items that are too big for the cache are now no longer immediately
  evicted; everything else is. This is probably not desirable, but it is
  not unexpected.
- Multithreading now should work as expected; DbRefs are locked before
  they are updated from the disk, and they are not evicted from the cache
  if they are locked by another thread.
- The cache may be no smaller than 1024 bytes. Previously the caller of
  DbOpen() could choose to disable the cache, and provisions were made in
  the code to support this, but this is now no longer possible because
  without the cache, there would be no way to know what files were open,
  which could lead to a race condition if two threads open the same file.
2022-11-18 22:17:56 +00:00
045c6d8644 Cache eviction 2022-11-18 20:42:08 +00:00
e7ad166877 Fix some memory leaks in Db 2022-11-18 19:36:15 +00:00
f6851de75f Fix a few bugs in JsonDecode(). It should now properly decode objects. 2022-11-18 14:51:44 +00:00
2e6c129263 Fix a mutex bug in Db and some memory errors in Json 2022-11-17 23:51:45 +00:00
d26fad4619 Add UtilMkdir() to recursively make directories 2022-11-17 22:57:29 +00:00
9597894356 Fix some warnings on GCC.
These aren't really anything to be concerned about, but making GCC feel good
about my code makes me feel better about my code.
2022-11-17 19:33:59 +00:00
46cc1df385 Do some Db work 2022-11-15 18:20:05 +00:00
a356403cfd Finish DbComputeSize() 2022-11-12 18:26:31 +00:00
8e71cc833c Change behavior of "id" configuration directive. 2022-11-08 17:53:01 +00:00
efbbf42a6e Fix memory and connection closing errors. 2022-11-08 01:05:28 +00:00
37ee7700f4 Start writing a function to compute the in-memory size of an object. 2022-11-06 00:47:17 +00:00
0a4c9f3751 Apply part of #32 (Thanks LDA <lda@devhonk.tk) 2022-11-05 01:29:20 +00:00
84abff7fb8 Tune the memory table size a little bit.
No idea if this hurts or helps, actually, but now we have a tunable
constant, instead of a magic number.
2022-11-02 16:46:22 +00:00
a8beded518 Fix occasional "Bad Request" response by waiting for data to be sent.
This also makes UtilGetDelim() and UtilGetLine() thread safe in that it
isn't setting a global errno. Of course, errno should be thread safe
already, but this makes it much less ambiguous.
2022-11-02 16:21:03 +00:00
92cc2206a1 Fix a few things to make Telodendria compile and run on Cygwin. 2022-11-02 15:20:37 +00:00
6992f36c86 Fix segfault in fclose() on Linux. 2022-11-02 00:35:05 +00:00
5af229a86e Apply #31 2022-11-02 00:18:13 +00:00
757938b293 Fix segvault if no config file was specified. 2022-11-01 09:47:25 -04:00
82d460da6f Fix some sneaky memory bugs and resource leaks. 2022-11-01 09:04:15 -04:00
bbee9dcea6 Fix some more bugs. 2022-10-31 20:41:50 -04:00
63dbf9ae35 Fix a few more memory bugs. Still have some to tackle. 2022-10-31 19:52:37 -04:00
ead65e7334 Fixed some misc bugs I found while debugging a memory error. 2022-10-31 11:07:32 -04:00
fd50fd83fb Misc changes throughout the codebase during testing. 2022-10-31 08:12:42 -04:00
b24ab05e8b Revert revision 1.4: Memory in O(1) time.
This has some bugs in it that I don't have time to work out right
now. Best to revert to a known working version as the project gains
attention until I can address this properly.
2022-10-31 08:08:32 -04:00
bcff59bacb Store memory info in the allocated block, not as a separate block.
This will eventually enable us to get memory information in O(1) time.
Right now, we're still O(n) because MemoryInfoGet() still has to check to
see if the allocation is known or not.
2022-10-28 14:07:44 -04:00
f90b987218 Add a Db to the matrixArgs so that routes can access it. 2022-10-24 14:36:48 -04:00
624b080d47 Add max-cache option to the config file 2022-10-24 13:40:21 -04:00
e009536065 Begin prototyping persistent storage API 2022-10-24 12:44:29 -04:00
5ca5ec7dd4 Complete parameter parsing 2022-10-15 19:17:49 -04:00
52abd18324 First revision of param parsing 2022-10-15 18:54:34 -04:00
b645a0b2c1 Hook param parsing into the request logic. 2022-10-15 16:28:32 -04:00
648ce5c4cc Remove NonPosix.h; it seems to be causing more trouble than it's worth. 2022-10-15 11:45:23 -04:00
887c4e4d5b Fix some warnings generated by Cygwin's GCC. 2022-10-15 10:28:03 -04:00
4707f0f4c8 Clean up some NonPosix.h stuff so we can build on Linux.
It appears that SOCK_NONBLOCK is not actually POSIX. According to the
OpenBSD man page, it will be soon, and according to the Linux man page,
it is a Linux extension. However, fcntl() with O_NONBLOCK seems to be
portable across both systems.
2022-10-15 10:08:52 -04:00
bb93cae99a Remove non-standard __FUNCTION__ use.
This cripples the Memory API just a little bit, but I'm sure we'll still
get useful enough information.
2022-10-15 09:34:47 -04:00
0c03c71081 Allow logging to the syslog 2022-10-14 20:55:15 -04:00
31719c2cd6 Tell exactly where the leaked pointer is, so it can be grepped. 2022-10-13 12:46:41 -04:00
65dad27902 Fix some server context memory leaks. 2022-10-13 12:34:17 -04:00
80366fc294 Fix a few more calls to free() 2022-10-13 12:27:24 -04:00
8cb86e8f67 Use new Memory API for all memory allocations. 2022-10-13 12:18:42 -04:00
945acd1adf Format source code 2022-10-13 09:09:26 -04:00
2df0cd9d26 Begin integrating new Memory API 2022-10-13 09:08:05 -04:00
8ae86b18fe Add hook functionality so we can log allocations and deallocations. 2022-10-13 08:50:27 -04:00
2d49ac78b8 Add custom memory management code.
This will be helpful in detecting leaks among other things, and may help
with controlling the cache size as well.
2022-10-12 21:29:05 -04:00
1353fa6429 Remove chroot option; log into the data directory automatically. 2022-10-11 12:00:36 -04:00
5d9b0df0bf Remove the redundant chroot option. This simplifies the config a bit. 2022-10-11 11:38:34 -04:00
414b8d47be Add HashMapFunctionSet() to allow custom hash functions. 2022-10-11 09:27:34 -04:00
744f38784c Finish HashMap documentation 2022-10-10 15:08:19 -04:00
79fc20314f Format source code. 2022-10-10 13:14:52 -04:00