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

Adding torrent to personal channel fails #6498

Closed
xoriole opened this issue Oct 26, 2021 · 5 comments · Fixed by #6501
Closed

Adding torrent to personal channel fails #6498

xoriole opened this issue Oct 26, 2021 · 5 comments · Fixed by #6501
Assignees

Comments

@xoriole
Copy link
Contributor

xoriole commented Oct 26, 2021

Adding torrent to personal channel on the latest main fails with the following stacktrace:

[PID:13202] 2021-10-26 16:27:06,754 - INFO - SentryReporter(286) - Event from exception: Object of type QRectF is not JSON serializable
[PID:13202] 2021-10-26 16:27:06,753 - ERROR <error_handler:37> ErrorHandler.gui_error(): tribler_gui.utilities.CreationTraceback: 
  File "/home/<user>/tudelft/dev/tribler/src/run_tribler.py", line 127, in <module>
    window = TriblerWindow(settings)
  File "/home/<user>/tudelft/dev/tribler/src/tribler-gui/tribler_gui/tribler_window.py", line 302, in __init__
    self.add_to_channel_dialog = AddToChannelDialog(self.window())
  File "/home/<user>/tudelft/dev/tribler/src/tribler-gui/tribler_gui/dialogs/addtopersonalchanneldialog.py", line 27, in __init__
    connect(self.dialog_widget.btn_confirm.clicked, self.on_confirm_clicked)


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/<user>/tudelft/dev/tribler/src/tribler-gui/tribler_gui/utilities.py", line 372, in trackback_wrapper
    raise exc from CreationTraceback(traceback_str)
  File "/home/<user>/tudelft/dev/tribler/src/tribler-gui/tribler_gui/utilities.py", line 369, in trackback_wrapper
    callback(*args, **kwargs)
  File "/home/<user>/tudelft/dev/tribler/src/tribler-gui/tribler_gui/dialogs/addtopersonalchanneldialog.py", line 123, in on_confirm_clicked
    self.confirm_clicked_callback(channel_id)
  File "/home/<user>/tudelft/dev/tribler/src/tribler-gui/tribler_gui/widgets/triblertablecontrollers.py", line 292, in on_confirm_clicked
    raw_data=json.dumps(entries),
  File "/usr/lib/python3.8/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python3.8/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type QRectF is not JSON serializable

issue-add-torrent-to-channel

@xoriole xoriole added this to the 7.11.0 October milestone Oct 26, 2021
@ichorid ichorid self-assigned this Oct 26, 2021
@ichorid
Copy link
Contributor

ichorid commented Oct 26, 2021

This was introduced in #6453

@devos50
Copy link
Contributor

devos50 commented Oct 26, 2021

Oh, I was unaware that the entire dictionary is being sent over the REST API. Stripping out the offending dictionary key should fix the issue.

@ichorid any particular reason why the whole entry is sent back to the core? Why not simply send a list of infohashes?

@ichorid
Copy link
Contributor

ichorid commented Oct 26, 2021

@ichorid any particular reason why the whole entry is sent back to the core? Why not simply send a list of infohashes?

Because of the uniformity of Channels endpoints input and code reuse. This way it does not matter what kind of object you're trying to copy, be it a folder, a channel, a simple torrent entry or any kind of content we may add in the future. Also, channel entries are identified by pk+id pairs, not infohashes.

@ichorid
Copy link
Contributor

ichorid commented Oct 26, 2021

I did not realise you added some non-JSON-serializable data to the model's data_items list. This is asking for all kinds of trouble in the future since every procedure in channels GUI model-view expects data_items entries to be the JSON representation of some MetadataStore item.

@sentry-for-tribler
Copy link

Sentry issue: TRIBLER-9Q

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