Skip to content
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

Checkpoint information is shown on the Downloads Page just after Tribler is run #7770

Closed
drew2a opened this issue Dec 11, 2023 · 7 comments · Fixed by #7939
Closed

Checkpoint information is shown on the Downloads Page just after Tribler is run #7770

drew2a opened this issue Dec 11, 2023 · 7 comments · Fixed by #7939

Comments

@drew2a
Copy link
Contributor

drew2a commented Dec 11, 2023

Describe the bug
Instead of downloads, I see the checkpoint information on the Downloads Page just after Tribler is run. Some time later it turns to the normal downloads.

To Reproduce

  1. Search for Ubuntu
  2. Download any torrent with low seeders count
  3. Close Tribler
  4. Open Tribler
  5. Go to the Downloads Page

Expected behavior
I expect to see the download but I see the checkpoint information instead.

Screenshots
image

Desktop (please complete the following information):

  • OS: macOS
  • Tribler's version: main a25df64ad67e263fe84f65a0faa4753737bf914b
@drew2a drew2a changed the title Checkpoint information is shown on the Downloads Page just after Tribler is run. Checkpoint information is shown on the Downloads Page just after Tribler is run Dec 11, 2023
@qstokkink
Copy link
Contributor

qstokkink commented Dec 11, 2023

This is actually not a bug but a feature (introduced in #7024) and it has been designed like this:

checkpoints = result.get('checkpoints', {})
if checkpoints and self.loading_message_widget:
# If not all checkpoints are loaded, display the number of the loaded checkpoints
total = checkpoints['total']
loaded = checkpoints['loaded']
if not checkpoints['all_loaded']:
# The column is too narrow for a long message, probably we should redesign this UI element later
message = f'{loaded}/{total} checkpoints'
self._logger.info(f'Loading checkpoints: {message}')
self.loading_list_item.textlabel.setText(message)
self.schedule_downloads_refresh()
return

However, we've had a bug for years where the core would not answer any requests while the checkpoints were still being loaded. So, this feature remained hidden.

@drew2a
Copy link
Contributor Author

drew2a commented Dec 11, 2023

@qstokkink, good to know. :)

Perhaps we could fix the layout for it and leave it as it is?

Although I liked the previous (buggy?) behavior, where a user sees downloads in the familiar layout, but with a "waiting for..." status.

@qstokkink
Copy link
Contributor

The feature was implemented to fix #7032, which states the following:

the user can wait until Tribler starts successfully, albeit with a "Loading" page showing for a very long time.

Apparently, the "waiting for..." or "loading" status was unacceptable to the original reporter (@kozlovsky) and having some form of progress shown was necessary.

Personally, I have no strong opinions on this issue. Both the previous resolution and the proposed resolution are fine by me.

@drew2a
Copy link
Contributor Author

drew2a commented Jan 2, 2024

This behavior was introduced in

I've tested it with the following commits:

Related to (has a common root cause):

@qstokkink
Copy link
Contributor

@kozlovsky since you introduced this behavior in #7024, are you OK with reverting your changes?

@kozlovsky
Copy link
Contributor

@qstokkink I'm investigating this

@kozlovsky kozlovsky self-assigned this Jan 5, 2024
@kozlovsky
Copy link
Contributor

The checkpoint counter was initially added to avoid user confusion when Tribler starts with an empty list of downloads. Some users were scared then that "all downloads have disappeared". After the recent updates in the main branch, the delay between the moments when Tribler started and when downloads appeared became even more extensive.

As it turns out, downloads are displayed with a delay because of a blocking call inside the first DownloadManager.load_checkpoint invocation. DownloadManager.load_checkpoint calls DownloadManager.start_download, which in turn calls DownloadManager.start_handle. Then, the entire load_checkpoins loop pauses until enough DHT peers are available before calling ltsession.async_add_torrent to start the actual downloading.

It is possible to fix the issue by splitting DownloadManager.start_handle into two parts, calling the second (delayed) part as a separate task. Then, all checkpoints can be restored without any significant delay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants