Skip to content

Commit

Permalink
Need to check the WAITING_STATUS when deal with deleted file.
Browse files Browse the repository at this point in the history
The current logic would have the following bug:
1. Upload work report stuck for a long time (>1 min) due to network instable
2. A call to /storage/delete is invoked to delete a CID which is in the work report being uploaded in #1.
3. Ecall_main_loop is run and then the Workload::deal_deleted_file would be  called, here the CID be deleted in the above #2 step would be erased permanently.
4. Work report upload return back. Since the CID has been deleted in #3 permanently, so this CID would NOT be able to include in the next work report as the deleted_files, then the File size check would fail in Crust Mainnet, resulted in the E10003-FileTransitionError seen in sworker side.
  • Loading branch information
wuhaixian1984 committed Apr 15, 2024
1 parent 1ff3489 commit 5732db1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/enclave/workload/Workload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ void Workload::deal_deleted_file()
{
std::string status = this->sealed_files[pos][FILE_STATUS].ToString();
if ((status[CURRENT_STATUS] == FILE_STATUS_DELETED && status[ORIGIN_STATUS] == FILE_STATUS_DELETED)
|| (status[CURRENT_STATUS] == FILE_STATUS_DELETED && status[ORIGIN_STATUS] == FILE_STATUS_UNVERIFIED)
|| (status[CURRENT_STATUS] == FILE_STATUS_DELETED && status[ORIGIN_STATUS] == FILE_STATUS_UNVERIFIED && status[WAITING_STATUS] == FILE_STATUS_UNVERIFIED)
|| (status[CURRENT_STATUS] == FILE_STATUS_DELETED && status[ORIGIN_STATUS] == FILE_STATUS_LOST))
{
this->sealed_files.erase(this->sealed_files.begin() + pos);
Expand Down

0 comments on commit 5732db1

Please sign in to comment.