-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with the NotFound Error of the App web dir data #201
Comments
Based on the design of ChunkReaderWithHash, a complete Hash can be generated for verification only when there is only one chunk that is sequentially read and completely read. Therefore, from a code perspective, it seems that there are several possibilities and improvements: 1. Seek occurred during the read processChunkReaderWithHash itself supports the Seek trait. If a seek call occurs during the read process, it will definitely result in an incorrect Hash result. However, in actual use, the reader based on ChunkReaderWithHash is only used in the BDT layer for a chunk task, and only the Read (AsyncRead) trait is used. The current BDT layer code is as follows: CYFS/src/component/cyfs-bdt/src/ndn/chunk/cache/cache.rs Lines 111 to 123 in 1d8a79f
From the above code, it can be seen that it is a sequential read based on io::copy, and each read operation is a complete chunk without any seek operation. However, this is a factor to consider when calculating the hash. 2. The internal poll_read returned Poll::Ready(Ok(0)) prematurelySize=0 indicates that this chunk was read in advance, but are there other possibilities that cause the chunk to end prematurely without being completely read? 3. Temporarily remove error_handlerIn the case of verification errors, do not delete the corresponding tracker record for the time being, to prevent accidental deletion. In addition, the following two aspects have been improved for this issue:
|
To better fix and improve this issue, here are some suggestions for reference: #204 |
Currently, based on feedback from some users, there is a small probability that the web dir recorded during installation for a particular app may disappear.
Relate background knowledge
During the installation of an app, the current version's web dir will call the cyfs-stack's trans.publish_file to register with the stack. The stack will then perform several key operations:
When the stack receives requests for the corresponding dir/files/chunks' binary data, it will perform the following operations:
The tracker plays a key role here, especially for directly registered external files.
A difficult situation
To handle the uncontrollable operations, such as external file modification and deletion, which may cause incorrect chunk data, a hash verification is added in step 2 above. If an inconsistency is found in the hash after reading, an error will be returned, and the tracker record will be deleted (considered invalid).
Adding Hash verification during reading, from a performance perspective, uses a mechanism that calculates the Hash while reading. Verification is done when the reading is complete. The corresponding code is as follows:
CYFS/src/component/cyfs-util/src/util/read_helper.rs
Lines 95 to 106 in 1d8a79f
The Problem and possible cause analysis
Therefore, the issue described at the beginning may have two possible situations:
App-manager's version control of the app's web dir has an error
For example, Inconsistent web dir data, etc.
The verification reading mechanism has bugs
In other words, ChunkReaderWithHash may produce incorrect verification results under certain circumstances, causing records with correct data to be deleted from the tracker.
Currently, from the logs received from user feedback, it is unlikely that there is a problem with step 1. Therefore, the focus should be on step 2 to analyze and fix the issue.
The text was updated successfully, but these errors were encountered: