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

bitlbee crashes when logging into a Telegram account #561

Open
Sesivany opened this issue Nov 27, 2020 · 3 comments
Open

bitlbee crashes when logging into a Telegram account #561

Sesivany opened this issue Nov 27, 2020 · 3 comments

Comments

@Sesivany
Copy link
Contributor

I'm resubmitting an issue that was reported in the downstream Fedora bugzilla:

Description of problem:
bitlbee crashes (SIGSEGV) when logging into a Telegram account.

Version-Release number of selected component (if applicable):
bitlbee-3.6-3.fc33.x86_64

How reproducible:
Always

Steps to Reproduce:
0. setenforce 0 (due to bug 1901888)

  1. systemctl enable --now bitlbee.socket (or bitlbee.service)
  2. connect with an IRC client to localhost:6667
  3. configure a telegram account:
    account add telegram +CCXXXXXXXXXX
    (optionally) account telegram set password-two-factor foobar
    account telegram on
  4. provide the login code to purple_request_0 user and, if not specified in advance, provide the password to purple_request_1 user

Actual results:
bitlbee crashes with SIGSEGV

Expected results:
Telegram account is connected.

More details including backtrace are here: https://bugzilla.redhat.com/show_bug.cgi?id=1901892

@BenWiederhake
Copy link
Collaborator

(I can't respond directly on the redhat BugZilla, sorry.)

Thank you for the extensive bugreport. You've struck right at the weak spot of libtgl, the underlying library of telegram-purple, and one of the many reasons why I recommend tdlib-purple instead: libtgl was never meant to be used by other people. vysheng wrote it to "work well enough" for his usecase, and apparently it served its purpose. The tree code was written with that in mind: The calls to "random" everywhere serve the purpose of "balancing" the tree well enough so that the data structure becomes a bit more efficient than just a linear scan. It also means libtgl crashes and burns if it ever, for some reason, draws two identical random numbers for things that are in the tree at the same time.

At least that's my understanding of the situation.

Possible workarounds:

  • Use tdlib-purple instead. It has some additional features, is being actively developed and maintained, and has nearly all the features that telegram-purple has.
  • Or, if you can't do that: Try to prune your telegram account. Fewer entries in the tree means significantly less chance of failure. (I know, this is terrible, that's why this is only my secondary recommendation.)
  • If you really really have to use telegram-purple and you really really want to keep using it with huge chats or gigantic friend lists, you probably have to fix libtgl. I'd welcome any PR, but if you're okay with writing code, then you might as well work on tdlib-purple.

I won't be able to fix the problem. Again, any kind of pull request that fixes the problem is very welcome.

@Sesivany
Copy link
Contributor Author

Sesivany commented Jan 5, 2021

What would be the be course of action for me as a maintainer of telegram-purple in Fedora? Should I deprecate telegram-purple in favour of tdlib-purple or keep them side-by-side and let the users decide? If tdlib-purple has a complete feature parity is actively maintained, maybe replacing telegram-purple with it is the way to go.

@BenWiederhake
Copy link
Collaborator

BenWiederhake commented Jan 5, 2021

If […]

It doesn't have feature parity yet, so please don't deprecate telegram-purple yet.

Also, for context: Telegram-purple crashes maybe once a year on my machine, so the usage pattern really seems to make a difference. Again, being in chats with thousands of people drastically increases the likelihood of this crash.

How about this:

  • telegram-purple remains in Fedora
  • Mention that tdlib-purple is on it's way to become a successor; feel free to be inspired by the text in README.md. Maybe it's a good idea to mention that the following features are missing in tdlib-purple:
    • Retrieving history on first login
    • Ignoring muted groups
    • Not sending read receipts
  • Mention that in the case of telegram-purple, "many contacts = more crashes". So if it keeps crashing, try leaving huge groups (>1000 users), and prevent tgp from fetching history.

The goal should be that users can make an informed choice and know that they have a choice. Currently, both plugins have disadvantages.

Fun fact: This issue is actually a problem with tree.h, and probably could be fixed by replacing it by an implementation that actually works. Hmmm, let's see if and when I have enough time for that. (PRs highly welcome!)

And finally: Hi, nice to meet you! :)

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

No branches or pull requests

2 participants