id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc 2889,"""Too many files open"" error and losing all torrents",MaycneSonahoz,,"Hi, A few weeks ago i got an important issue: Deluge lost all my torrents. More precisely, the torrent list got empty, though the files and torrent files were still there. After a small investigation, i found out that the ~/.conf/deluge/state/torrents.state and torrents.state.bak files had been deleted. After opening Deluge again, from the terminal, after some time i got errors of the following kind: {{{ [ERROR ] 19:43:26 torrentmanager:833 Unable to save /home/maycne/.config/deluge/state/torrents.fastresume: [Errno 24] Trop de fichiers ouverts: '/home/maycne/.config/deluge/state/torrents.fastresume.tmp' [ERROR ] 19:43:32 core:248 There was an error adding the torrent file ed965dd1d26331357302f877482526e90c0d0515.torrent [ERROR ] 19:43:32 core:249 local variable 'ex' referenced before assignment Traceback (most recent call last): File ""/usr/lib/python2.7/site-packages/deluge/core/core.py"", line 246, in add_torrent_file File ""/usr/lib/python2.7/site-packages/deluge/core/torrentmanager.py"", line 534, in add File ""/usr/lib/python2.7/site-packages/deluge/core/torrentmanager.py"", line 744, in save_state UnboundLocalError: local variable 'ex' referenced before assignment [ERROR ] 19:43:33 torrentmanager:833 Unable to save /home/maycne/.config/deluge/state/torrents.fastresume: [Errno 24] Trop de fichiers ouverts: '/home/maycne/.config/deluge/state/torrents.fastresume.tmp' [ERROR ] 19:43:46 torrentmanager:734 Unable to backup /home/maycne/.config/deluge/state/torrents.state to /home/maycne/.config/deluge/state/torrents.state.bak: [Errno 2] Aucun fichier ou dossier de ce type }}} For those who don't read French, ""Trop de fichiers ouverts"" means ""too many files open"". I saw some posts about this error here, either with no solution, or with a solution of ""don't use so many torrents"" or ""increase the limit of files your system can open"". Those were also the solutions suggested on Manjaro's forum at first. But after digging a bit, i found that Deluge opens a lot more files than any other programs, including other torrent clients. Long story short, i found and used the following command in order to look how many files were open. {{{ lsof | awk '{ print $2 "" "" $1; }' | sort -rn | uniq -c | sort -rn | head -20 }}} Using this with Deluge and Qbittorrent open, both with the exact same list of 83 torrents (all completed), i saw that after around 45min of activity, Deluge had 7 times more open files than Qbittorrent (14880 and 2037 respectively), which might not be normal. I found this issue with: - Deluge 1.3.13-1 (commit 226346311412c164cfb5e467d04b1ee8627bc015 : https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/deluge) - libtorrent-rasterbar 1:1.0.9-1 and 1:1.1-3 I might have had this issue for longer, but i only found it after losing the torrent list. You can find more details on Manjaro's forum (https://forum.manjaro.org/t/deluge-repeatedly-crashes-over-too-many-files-open/7566) and i'll gladly provide more intel if needed. Maycne.",bug,closed,major,1.3.14,Core,1.3.13,Fixed,,