Opened 8 months ago

Last modified 2 days ago

#3309 new bug

TypeError: '>' not supported between instances of 'NoneType' and 'str'

Reported by: kuraga Owned by:
Priority: blocker Milestone: 2.0.4
Component: GTK UI Version: 2.0.3
Keywords: Cc: kuraga333@…, scott@…

Description

At start:

TypeError: '>' not supported between instances of 'NoneType' and 'str'
Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/deluge/ui/gtk3/listview.py", line 233, in stabilized
    result = sort_func(model, iter1, iter2, data)
  File "/usr/lib64/python3.6/site-packages/deluge/ui/gtk3/torrentview.py", line 106, in progress_sort
    return cmp(state1, state2)
  File "/usr/lib64/python3.6/site-packages/deluge/ui/gtk3/common.py", line 45, in cmp
    return (x > y) - (x < y)

Seems like number of this messages correlates with number of torrents...

Change History (8)

comment:1 Changed 7 months ago by milto

  • Component changed from Unknown to GTK UI

I have the same error as kuraga, I report here the result of my investigation.

Problem

The list of torrents takes time to load at startup with the current version of Deluge 2.0.3 from the offical ppa deluge-stable installed for Ubuntu 18.04 Bionic.

The problem seems located in the GTK UI component of Deluge and it leads to too many open files error. It seems to be a problem of passing a null parameter to the cmp function in deluge/ui/gtk3/common.py.

I have around 60 torrents, seeded correctly with Deluge 1.3 or Transmission.

Reproduce error

After a successful fresh install of Deluge 2.0 and a first start in standalone mode without any error, I add torrents in seed manually via menu -> File -> Add Torrent everything seems right so far. Then I close and restart Deluge. It starts with an empty list of torrent and it takes several seconds to load them. It may sometimes crash at this point or just run slowly and starts to use more and more CPU ressources.

To track the problem you can watch in your system log file (personally I use journalctl) or just start Deluge in terminal and see the error.

This error is repeated houndreds of times

Original exception was:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/ui/gtk3/listview.py", line 233, in stabilized
  File "/usr/lib/python3/dist-packages/deluge/ui/gtk3/listview.py", line 250, in generic_sort_func
  File "/usr/lib/python3/dist-packages/deluge/ui/gtk3/common.py", line 45, in cmp
TypeError: '>' not supported between instances of 'str' and 'NoneType'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/ui/gtk3/listview.py", line 233, in stabilized
  File "/usr/lib/python3/dist-packages/deluge/ui/gtk3/listview.py", line 250, in generic_sort_func
  File "/usr/lib/python3/dist-packages/deluge/ui/gtk3/common.py", line 45, in cmp
TypeError: '>' not supported between instances of 'str' and 'NoneType'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 109, in apport_excepthook
  File "/usr/lib/python3/dist-packages/apport/report.py", line 537, in add_proc_info
OSError: [Errno 24] Too many open files: '/proc/15418'

And finally the last line of error is:

[ERROR ][deluge.core.torrentmanager :1132] Unable to save torrents.fastresume: [Errno 24] Too many open files: '/home/username/.config/deluge/state/torrents.fastresume.tmp'

Diagnostic

I have installed the package deluge 2.0.3-2~201906121747~ubuntu18.04.1 provided by the ppa:deluge-team/stable for Ubuntu 18.04 Bionic, Python 3.6 is used to run Deluge with libtorrent: 1.1.5.0

Prior to the installation of Deluge 2.0.3, I have purged all packages related to Deluge 1.3 from the universe repository of Ubuntu: deluge deluge-common deluge-gtk and moved my ~/.config/deluge

I run the command deluge -L=debug -l=deluge_debug --profile=deluge_profile &! to report information about the bug. The following are extracts from deluge_debug that might help to track the problem.

Around line 397 and repeated sometimes in the rest of log after:

09:37:31 [DEBUG ][deluge.core.core :651 ] Deprecated session status key num_peers, please use peer.num_peers_connected
09:37:31 [DEBUG ][deluge.core.core :651 ] Deprecated session status key dht_nodes, please use dht.dht_nodes
09:37:31 [DEBUG ][deluge.core.core :651 ] Deprecated session status key has_incoming_connections, please use net.has_incoming_connections
09:37:31 [DEBUG ][deluge.core.core :651 ] Deprecated session status key num_peers, please use peer.num_peers_connected
09:37:31 [DEBUG ][deluge.core.core :651 ] Deprecated session status key dht_nodes, please use dht.dht_nodes
09:37:31 [DEBUG ][deluge.core.core :651 ] Deprecated session status key has_incoming_connections, please use net.has_incoming_connections

Something weird happens, around line 516 everything seems fines:

09:37:32 [INFO ][deluge.core.torrentmanager :806 ] Loading torrent state: /home/username/.config/deluge/state/torrents.state
09:37:32 [INFO ][deluge.core.torrentmanager :819 ] Successfully loaded /home/username/.config/deluge/state/torrents.state
09:37:32 [INFO ][deluge.core.torrentmanager :1066] Opening torrents.fastresume for load: /home/username/.config/deluge/state/torrents.fastresume
09:37:32 [INFO ][deluge.core.torrentmanager :1077] Successfully loaded torrents.fastresume: /home/username/.config/deluge/state/torrents.fastresume

in between all torrent seems to be loaded correctly and latter:

09:37:48 [DEBUG ][deluge.core.torrentmanager :1126] Creating the temporary file: /home/username/.config/deluge/state/torrents.fastresume.tmp
09:37:48 [DEBUG ][deluge.core.torrentmanager :1136] Creating backup of torrents.fastresume at: /home/username/.config/deluge/state/torrents.fastresume.bak
09:37:48 [DEBUG ][deluge.core.torrentmanager :1146] Saving torrents.fastresume to: /home/username/.config/deluge/state/torrents.fastresume`

however it is a bit contradictory with the message received in standard error output:

[ERROR ][deluge.core.torrentmanager :1132] Unable to save torrents.fastresume: [Errno 24] Too many open files: '/home/username/.config/deluge/state/torrents.fastresume.tmp'

In the end the log is full of:

09:38:56 [DEBUG ][deluge.core.alertmanager :130 ] listen_failed_alert: listening on 0.0.0.0 : 0.0.0.0:50964 failed: [accept] [TCP] Too many open files
Last edited 7 months ago by milto (previous) (diff)

comment:2 Changed 7 months ago by milto

  • Milestone changed from needs verified to 2.x
  • Priority changed from minor to blocker

comment:3 Changed 6 months ago by Cas

  • Milestone changed from 2.x to 2.0.4

There is a related ticket #3330 which has a TypeError comparing None and None so the issue is due to string type checking by Python 3. So the cmp function needs to be able to handle either or both values being None by converting to appropriate type before comparison.

comment:4 Changed 3 months ago by DanBit

Is there any update on this?

comment:5 Changed 2 months ago by milto

I hoped there would be an update since this error makes Deluge 2 totally unusable however I lost hope and stick with Deluge 1.3 that it is stable and functional.

comment:6 Changed 2 months ago by jools772

https://portingguide.readthedocs.io/en/latest/comparisons.html

Here's a guide in how to port python 2 comparison operations to python 3.

comment:7 Changed 2 days ago by sremick

Another person bitten by this. I don't understand how I triggered it. Deluge had been working fine, I messed some things up w/ Python then fixed that, but now Deluge won't start. Mine is more like ticket 3330 where I'm getting "TypeError?: '>' not supported between instances of 'NoneType?' and 'NoneType?'" like that user.

Is there even a workaround or hack so I can become functional again in the meantime?

comment:8 Changed 2 days ago by sremick

  • Cc scott@… added
Note: See TracTickets for help on using tickets.