Commit Graph

32 Commits

Author SHA1 Message Date
Haley Weslin 9d60ac01d0 Fix non-contraction it's in set_value.rs
This uses "its" in place of "it's" when not a contraction.
2023-09-25 19:20:57 +00:00
Christien Rioux c7d4462e0e more clippy 2023-09-17 22:12:25 -04:00
Christien Rioux 6438a64fc7 clippy work 2023-09-17 19:37:02 -04:00
Christien Rioux 60a7e90712 dht fixes 2023-09-09 21:44:16 -04:00
Christien Rioux 853976789f fix crash and clean up record data size housekeeping 2023-09-09 13:30:48 -04:00
Christien Rioux b3354194e0 repo fix 2023-09-02 18:50:12 -04:00
Rivka Segan 5dd0a3793b call set_record_data_size with accumulated size
set_subkey corrupts record_data_size in a Record struct by calling
set_record_data_size with a value that depends only on the length of
the new subkey value. This leads to various undesirable outcomes, such
as: applications can write more than MAX_RECORD_DATA_SIZE without
encountering the intended "veilid.error.VeilidAPIErrorGeneric:
label='Generic' message='dht record too large'" error message, and
"panicked at 'attempt to subtract with overflow'" (i.e., an attempt to
set a negative value of a size) if a subkey's new length is less than
a subkey's old length. Typically, record_data_size in a Record struct
will be incorrect if a value was set for more than one subkey. Some
users might want to start over with a table_store that doesn't have
any incorrect record_data_size values.

The issue begins here:
https://gitlab.com/veilid/veilid/-/blob/6f71c6a00a6584e3b95aac1cc1d80f92d8c3d2d2/veilid-core/src/storage_manager/record_store.rs#L583-L586

and is triggered here:
https://gitlab.com/veilid/veilid/-/blob/6f71c6a00a6584e3b95aac1cc1d80f92d8c3d2d2/veilid-core/src/storage_manager/record_store.rs#L613-L615

It should be clear that new_record_data_size is only related to the
subkey that is currently being set. The amount of data in the record,
before set_subkey is called, is ignored. It appears that
new_total_size, not new_record_data_size, was intended to be used for
set_record_data_size, and this change succeeds for me in limited
testing but I don't have a comprehensive test suite.

One way to reproduce is by running the code from
https://gitlab.com/vatueil/veilid-file on a greater than 1 MB file
while watching variable values within
veilid-core/src/storage_manager/record_store.rs. For example: "poetry
run file put /usr/bin/tcpdump" (1.3 MB on Ubuntu 23.04). With the
original Veilid code, each of the dozens of subkey writes is checking
whether a roughly 32K value is greater than 1048576, it never is, and
thus there is never a "dht record too large" error. With the patch in
this MR, each of the dozens of subkey writes is checking whether an
ever-increasing value is greater than 1048576, it eventually is, and
the "dht record too large" error is printed. With the patch, one can
work with smaller files, e.g., do "poetry run file put /usr/bin/ssh"
(0.8 MB) followed by "poetry run file get VLD0:<_insert_key_here_>
ssh-copy" and the retrieved file ssh-copy is identical to
/usr/bin/ssh.

The more detailed behavior is that the modified code has
record.total_size of 350 on the first iteration, then 33596, 66842,
100088, etc. The original code also has record.total_size of 350 on
the first iteration, but then stays at 33246 forever (33246 is the
user-supplied subkey size of 32768, plus 128, plus the minimum record
size of 350),
2023-08-26 07:08:47 +00:00
Christien Rioux 10ec693fb4 Merge branch 'fix/value-data-api-crash' into 'main'
fix: large value_data length in api crashes server

See merge request veilid/veilid!139
2023-08-22 19:00:50 +00:00
Cheradenine Zakalwe 0ce19d85fa fix: large value_data length in api crashes server 2023-08-22 19:00:49 +00:00
pbarry25 0b018edfe5 Fix minor typos 2023-08-21 20:12:20 -05:00
Christien Rioux 2c779b2257 fanout debugging 2023-08-18 00:06:21 -04:00
Christien Rioux b2503ae789 offline work 2023-08-18 00:06:21 -04:00
Christien Rioux 435469ce94 offline subkey writes 2023-08-18 00:06:21 -04:00
Christien Rioux ef327fb963 crash fix 2023-08-18 00:06:21 -04:00
John Smith 422a645708 python and api fixes 2023-07-30 16:45:20 -04:00
Christien Rioux 00aad2c728 bugfixes 2023-07-25 01:04:22 -04:00
Christien Rioux 3224a315c3 proper node info filter for fanout 2023-07-20 17:52:45 -04:00
Christien Rioux 80cb23c0c6 remove rkyv 2023-07-15 19:35:22 -04:00
John Smith d290a66f32 dht fixes 2023-07-01 10:45:31 -04:00
John Smith 176d9ac68e dht testing work 2023-06-29 22:18:45 -04:00
John Smith 05a9ee754e cleanup dht stuff and client/server api 2023-06-28 23:15:06 -04:00
John Smith 291e3ef2fe add better dht debugging 2023-06-26 21:29:02 -04:00
John Smith 297908796c remove owo colors 2023-06-25 14:09:22 -04:00
John Smith 234f048241 simplify tracing 2023-06-24 22:59:51 -04:00
John Smith 1c8ecab2b6 cli fixes 2023-06-20 23:46:39 -04:00
John Smith f17c2f62cb xfer 2023-06-19 22:35:49 -04:00
John Smith ea651e526d xfer 2023-06-19 11:29:33 -04:00
John Smith 2314fcb57e more release lifetime cleanup and base class contextmanager stuff 2023-06-18 20:57:51 -04:00
John Smith b6e055e47d test work 2023-06-18 18:47:39 -04:00
John Smith d114ea3b72 crufy 2023-06-15 20:29:12 -04:00
John Smith 06081df22a json schema generation 2023-06-04 21:22:55 -04:00
John Smith 0a890c8707 removing dev branch, many changes 2023-05-29 19:24:57 +00:00