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

Sending fails with error code 404 #182

Closed
Ennea opened this issue Nov 29, 2018 · 8 comments
Closed

Sending fails with error code 404 #182

Ennea opened this issue Nov 29, 2018 · 8 comments

Comments

@Ennea
Copy link

Ennea commented Nov 29, 2018

As of a few hours ago, sending messages often fails with error code 404, sometimes even with 200 (not throwing an error). After some investigation and talking about this issue in #bitlbee, it looks like bitlbee-discord's usage of the same nonce for every message is the culprit. Removing the nonce in discord-http.c, lines 530-531, allows all messages to go through without issue (but leads to other issues of course).

EionRobb on IRC mentioned that purple-discord uses random nonces (as they should be) and inserts them into a hash table for later checking for self messages, so I guess that's the go to approach to handle this issue.

@seitzbg
Copy link

seitzbg commented Nov 29, 2018

Happening to me too.

@Alcaro
Copy link
Contributor

Alcaro commented Nov 29, 2018

So Discord is finally fixing the duplicate messages?

Hashtable = memory allocation = annoying. Instead, I'd recommend keeping our current 16-byte random nonce, but append an increasing integer (sequence number, current time, whatever); messages starting with the nonce are from us.

More specifically,

discord.h:61, add int seq; somewhere in the struct
discord-http.c:530, "nonce":"%s" -> "nonce":"%s%d", append add ++dd->seq to argument list
discord-handlers.c:618, g_strcmp0(nonce, dd->nonce) -> g_str_has_prefix(nonce, dd->nonce)

(can't test myself, I no longer use this tool)

@KeepBotting
Copy link

This issue affects me as well.

sm00th added a commit that referenced this issue Nov 30, 2018
This is a temporary workaround for #182, which, unfortunately, brings #7
back. This will have to do until a proper fix is ready.
@sm00th
Copy link
Owner

sm00th commented Nov 30, 2018

Temporary disabled nonces until we have a proper solution.

@sm00th sm00th closed this as completed in dc4e7a3 Nov 30, 2018
@sm00th
Copy link
Owner

sm00th commented Nov 30, 2018

Should be properly fixed now, please reopen if there are still issues with sending messages.

@fish-face
Copy link

fish-face commented Dec 4, 2018

Unless I have failed to properly reload the plugin (I just compiled, installed, then restarted bitlbee with systemctl) I am still getting 404 errors. I am also getting other messages going missing without any error message. A common theme seems to be that the first message in a bunch I send goes through, but subsequent ones don't. E.g. I sent 3 between 21:26:17 and 21:26:37, but only the first appeared. I then sent another two at 21:31:21 and :24, but only the first appeared again.

These examples were not associated with 404 errors. An example involving them involved messages at 20:43:18, 20:47:43, 20:48:00 and 20:48:11. Same again (but note the wide gap.) A subsequent message at 21:09:58 was sent successfully.

@sm00th
Copy link
Owner

sm00th commented Dec 5, 2018

@fish-face did you also reconnect your irc client? If you did and still seeing this please get a debug log (see Debugging section in README).

@dgw
Copy link
Contributor

dgw commented Dec 5, 2018

Running into that issue (messages failing to send, without any error) is what prompted me to update my bitlbee-discord instance. Haven't seen any since, that I know of.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants