Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Crash when trying to perform write action with read-only keys #444

Open
glasserc opened this issue Mar 21, 2022 · 6 comments
Open

Crash when trying to perform write action with read-only keys #444

glasserc opened this issue Mar 21, 2022 · 6 comments
Labels
bug Something isn't working info required This doesn't seem right or more details are required

Comments

@glasserc
Copy link

Describe the bug
Trying to "heart" or retweet any tweet causes Cawbird to crash immediately.

To Reproduce
Steps to reproduce the behavior:

  1. Start Cawbird
  2. Right click on the first tweet in your timeline, or if you prefer, scroll to find one that looks more "viral" in case you accidentally like it and don't want to distract anyone and right click that one
  3. Click the heart icon or the chasing arrows for retweet
  4. Cawbird crashes

Expected behavior
A retweet or like request is issued and Cawbird continues running normally.

System details:

  • OS: Pop!_OS
  • Version: latest master (d384358)
  • Package type: custom build

Additional context
The tail end of my log when I run with G_MESSAGES_DEBUG=cawbird shows:

(cawbird:1295730): cawbird-DEBUG: 09:18:33.118: Message with type 32 on stream [username]: null
(cawbird:1295730): cawbird-DEBUG: 09:18:35.147: Removing avatar with id 308762876 from cache
(cawbird:1295730): cawbird-DEBUG: 09:20:27.718: MainWindow.vala:60: Focus widget now: TweetListEntry 0x5619eb373800
(cawbird:1295730): cawbird-DEBUG: 09:20:27.726: MainWindow.vala:60: Focus widget now: DoubleTapButton 0x5619eb456d40
(cawbird:1295730): cawbird-DEBUG: 09:20:28.684: MainWindow.vala:60: Focus widget now: GtkToggleButton 0x5619eb459b60
(cawbird:1295730): cawbird-DEBUG: 09:20:28.775: MainWindow.vala:60: Focus widget now: (null) (nil)

(cawbird:1295730): Json-CRITICAL **: 09:20:28.907: json_object_get_array_member: assertion 'node != NULL' failed

(cawbird:1295730): Json-CRITICAL **: 09:20:28.907: json_array_get_element: assertion 'array != NULL' failed

(cawbird:1295730): Json-CRITICAL **: 09:20:28.907: json_node_get_object: assertion 'JSON_NODE_IS_VALID (node)' failed

(cawbird:1295730): Json-CRITICAL **: 09:20:28.907: json_object_get_int_member: assertion 'object != NULL' failed

(cawbird:1295730): Json-CRITICAL **: 09:20:28.907: json_object_get_string_member: assertion 'object != NULL' failed

(cawbird:1295730): GLib-CRITICAL **: 09:20:28.907: g_error_new_literal: assertion 'message != NULL' failed
fish: Job 2, “env G_MESSAGES_DEBUG=cawbird GS…” terminated by signal SIGSEGV (Address boundary error)
@IBBoard IBBoard added bug Something isn't working info required This doesn't seem right or more details are required labels Mar 21, 2022
@IBBoard
Copy link
Owner

IBBoard commented Mar 21, 2022

Is this happening with all tweets, or just some?

Message with type 32 on stream [username]: null isn't a promising start! We could probably do better handling it.

If you're running a custom build, can you make sure that you've passed --buildtype=debug to meson and run it again. You should get all of the JSON for each tweet dumped (so it might get a bit long!). There should also be some lines about POST requests so we know where it was in the process of sending the message to the Twitter API.

@glasserc
Copy link
Author

I tried rerunning meson build with --buildtype=debug before --reconfigure and it printed some output, and then I reran ninja -C build and it printed some output ending ninja: no work to do. Is that correct?

I haven't been exhaustive but I haven't been able to successfully "heart" a tweet, whether a real tweet posted by a friend or a retweet that made its way into my timeline. I have a bunch of output, as before, but as it includes stuff from my Twitter account I'm hesitant to post it here. (I could send it to you privately if you like.) However, I note that when I right-click on the tweet to bring up the four tweet actions, the log ends at Focus widget now: DoubleTapButton 0x561ca4446d40. When I choose the action to take, that's when the rest of the output happens and triggers the crash. I suspect no POST request is happening because when I log in to Twitter's web interface and check "Likes", no tweets newer than Mar 4th are visible.

I can also reproduce the crash by clicking on the tweet to bring it up by itself (TweetListEntry?) and clicking the heart in the lower right corner. In this case, the last line in the log before I click the heart is MainWindow.vala:60: Focus widget now: GtkMenuButton 0x55a5de05e410, and once I click on the heart, the same GtkToggleButton lines happen.

I was concerned about the lines saying Focus widget now: (null) (nil) but I can produce those just by right clicking on a tweet to bring up its menu and then right clicking on it again to bring the contents of the tweet back. In that case I get logs like:

(cawbird:1345142): cawbird-DEBUG: 16:33:24.068: MainWindow.vala:60: Focus widget now: DoubleTapButton 0x564b5c7c0d60
(cawbird:1345142): cawbird-DEBUG: 16:33:25.037: MainWindow.vala:60: Focus widget now: (null) (nil)
(cawbird:1345142): cawbird-DEBUG: 16:33:25.038: MainWindow.vala:60: Focus widget now: TweetListEntry 0x564b5c709300

@IBBoard
Copy link
Owner

IBBoard commented Mar 22, 2022

ninja: no work to do means that it hasn't recompiled anything. So it either didn't enable debug builds, or it did and you're not getting the output. What does meson configure <build-dir> show? I've got a buildtype debug line.

I've just checked and it seems like we don't do debug for Like/RT. Which is annoying. There must be something bad in the JSON, though. I'll make a quick branch with some extra logging in.

@IBBoard
Copy link
Owner

IBBoard commented Mar 22, 2022

There, I've added some debugging. If you can build that branch then it might give a bit more info.

The other thing that you can try is running it in gdb:

  • gdb path/to/cawbird
  • run
  • Recreate crash and segfault
  • bt and info locals
    That should tell us exactly where it crashed and what the local variables were.

@glasserc
Copy link
Author

Thanks! The failure seems to have to do with the application credentials I created. From the log:

(cawbird:1454731): cawbird-DEBUG: 16:39:05.364: TweetUtils.vala:356: Liking 1506369197311512583
(cawbird:1454731): cawbird-DEBUG: 16:39:05.475: TweetUtils.vala:371: invoke_async returned
(cawbird:1454731): cawbird-DEBUG: 16:39:05.475: TweetUtils.vala:33: Failed request code: 401
(cawbird:1454731): cawbird-DEBUG: 16:39:05.475: TweetUtils.vala:42: Failed request payload: {"request":"\/1.1\/favorites\/create.json","error":"Read-only application cannot POST."}

Indeed, the token I've been using was generated for a Twitter app that I created some ten years ago and only has read permissions. I guess Twitter must have added authorization at some point, or maybe I was inadvertently using a different Twitter app. Either way this also answers why I can't successfully post from Cawbird any more. Thanks for once again helping me debug an idiosyncratic self-inflicted bug!

@IBBoard
Copy link
Owner

IBBoard commented Mar 22, 2022

I'll keep this open because we shouldn't crash on that. But yeah, if you're using bespoke keys that are read-only (which they might be for a while until Twitter activate them) then you will be able to retrieve tweets but not like/RT/post 😁

@IBBoard IBBoard reopened this Mar 22, 2022
@IBBoard IBBoard changed the title Crash when trying to like / retweet Crash when trying to perform write action with read-only keys Mar 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working info required This doesn't seem right or more details are required
Projects
None yet
Development

No branches or pull requests

2 participants