Opened 9 months ago

Last modified 2 months ago

#3322 new bug

All torrents disappear occasionally after restart

Reported by: Alexey104 Owned by:
Priority: minor Milestone: 2.0.4
Component: Unknown Version: develop
Keywords: Cc:

Description

Os: ArchLinux? De: i3wm(4.17.1) Python version: 3.7.4 Deluge version: 2.0.4 dev14(build from github)

Hi! I have about 150 seeding torrents, and sometimes it happens that all of my torrents disappear without any reason(accidental poweroff, for example) after i restart deluge, and there is no archive with backup files created in '~/.config/deluge/archive' directory. So, i have to regularly do a backup of '~/.config/deluge/state' folder to have an ability to restore my session if it happens again. Typically, it happens not often, but i found that this issue occurs with 100% possibility if i run deluge and immediately close it before it fully loads a list of my torrents. If i do that, next time i launch deluge i have an empty torrent list.

Attachments (2)

deluge_torrents_lost.log (128.0 KB) - added by Alexey104 9 months ago.
deluge_normal_startup.log.zip (118.3 KB) - added by Alexey104 9 months ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 9 months ago by Cas

That is frustrating that this issue is still happening. We will have to look further into how to prevent this occurring.

  • Can you provide details of which files are being lost or corrupted?
  • Do you have any logs from the next startup?
  • Is this with deluge standalone or deluged?

Changed 9 months ago by Alexey104

Changed 9 months ago by Alexey104

comment:2 Changed 9 months ago by Alexey104

Hello!
Thanks for your reply!

The issue happens with deluge standalone. I have attached 2 logs:
'deluge_normal_startup.log' - this log was made after normal startup when all seeding torrents was successfully resumed.
'deluge_torrents_lost.log' - this one was made after all seeding torrents from the log above was suddenly removed from the list(of course, they was removed from deluge only, not from hard drive).

comment:3 follow-up: Changed 4 months ago by digifuzzy

Confirm similar situation(All seeding torrents are not displayed.) on 2.0.3 dev23. Using Funtoo x86_64 - python 3.7.6. On restart of deluge (after system reboot) side bar shows correct count of running torrents but list of seeding torrents is missing from main list. Selecting different side bar options does not correct missing seeding torrents in "All Torrents". Torrent listing is being pulled from a server w/ deluge daemon running, so I suspect the problem is with presentation (my probably may differ slightly than what OP original observed).

Last edited 4 months ago by digifuzzy (previous) (diff)

comment:4 Changed 4 months ago by digifuzzy

Tried webUI. Same problem occurs. Was able to get into console. There the count of torrents was wrong and seeding torrents were missing. However, I was able to pipe the errors to file. Traceback below appeared:

Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/deluge/transfer.py", line 130, in _handle_complete_message
    rencode.loads(zlib.decompress(data), decode_utf8=True)
  File "/usr/lib/python3.7/site-packages/deluge/ui/client.py", line 133, in message_received
    d.callback(request[2])
  File "/usr/lib/python3.7/site-packages/twisted/internet/defer.py", line 460, in callback
    self._startRunCallbacks(result)
  File "/usr/lib/python3.7/site-packages/twisted/internet/defer.py", line 568, in _startRunCallbacks
    self._runCallbacks()
--- <exception caught here> ---
  File "/usr/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/lib/python3.7/site-packages/deluge/ui/console/modes/torrentlist/torrentview.py", line 127, in update_state
    self.torrent_names.append(ts['name'])
builtins.KeyError: 'name'

comment:5 Changed 4 months ago by Xuefer

exactly problem i'm suffering. i have to backup too in cron job. the *.bak didn't help much as it get overwritten. archive folder helps sometime until roll'ed after some days gone (let's say i have it restart everyday). since deluge ran in the background in my downloader box, i don't check it often.

i propose using "rename()" to fix this problem before the actual exception is fixed

  1. open(torrents.new), write(), close()
  2. optionally unlink(torrents) if OS is windows
  3. rename(torrents.new, torrents) only after everything's fine:

no exception, no error, no crash, not kill'ed.

since rename() is atomic operation while write() isn't. rename() is a common way to help better fighting data loss in this case, mostly exception and unexpected power loss

comment:6 in reply to: ↑ 3 Changed 2 months ago by Alexey104

digifuzzy:

On restart of deluge (after system reboot) side bar shows correct count of running torrents but list of seeding torrents is missing from main list.


I think my issue is similar, but slightly different. In my case when this issue happens the side bar always shows 0 torrents and the transfer list is also empty. It might happen randomly for me, but i can always reproduce this behaviour by doing the following:

1) Do a backup of 'torrents.state' and 'torrents.fastresume' files.
2) Start 'deluge-gtk'(in standalone mode).
3) It usually takes several seconds to load the list of torrents. At this point, before the torrent list is loaded, right after the GUI is shown up, close deluge.
4) Start deluge again and it will show an empty list with 0 torrents. It is great if you did a backup at step 1 because it let you restore your previous session. Otherwise, you have to manually re-add and recheck all your torrents from scratch.

Last edited 2 months ago by Alexey104 (previous) (diff)

comment:7 follow-up: Changed 2 months ago by Alexey104

I switched deluge to thin client mode, run deluged daemon at the background, and the issue is completely gone. I can kill daemon/client at any time and all torrents persist after restart.

comment:8 in reply to: ↑ 7 Changed 2 months ago by Xuefer

Replying to Alexey104:

I switched deluge to thin client mode, run deluged daemon at the background, and the issue is completely gone. I can kill daemon/client at any time and all torrents persist after restart.

i run deluged in background as always but still as reported

Note: See TracTickets for help on using tickets.