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

telega has a hard time starting, freezes #316

Open
WorldsEndless opened this issue Sep 22, 2021 · 17 comments
Open

telega has a hard time starting, freezes #316

WorldsEndless opened this issue Sep 22, 2021 · 17 comments

Comments

@WorldsEndless
Copy link

I use exwm. When I start telega on my primary process it starts to max out one of my threads and soon the whole process is frozen. However, when I start telega in an emacs sub-process, it starts after about 30 seconds.

Telega Setup

OS: openSUSE Tumbleweed
Emacs: GNU Emacs 28.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.29, cairo version 1.16.0)
Telega: telega v0.7.70 (TDLib v1.7.7) (telega-server v0.7.13)

Current Behavior

When I start telega in my main exwm process, it freezes.

Steps to Reproduce

  1. M-x telega
  2. System binds up and freezes until I kill emacs.
  3. M-& (async command) emacs
  4. M-x telega
  5. wait 30 seconds and telega starts
@zevlg
Copy link
Owner

zevlg commented Sep 22, 2021

Please run: $ ~/.telega/telega-server -h |head -1 from console to check whether telega-server is compiled with "appindicator" support.

Try compiling telega-server without "appindicator" support, by editing server/Makefile by hand.

@WorldsEndless
Copy link
Author

ah, shucks. After the debugging and happiness I eventually had when I got the appindicator to work...

okay. Done, so your command no longer shows that it was built with appindicator support. I rebuilt the server. However, the results are the same -- tried it on my prrimary process and it still hung on me.

As a possibly relevant point of interest: when I try telega-server-build on my primary frame now without attempting to start Telega, I receive telega-test-env: Symbol’s function definition is void: telega-x-frame . I was able to rebuild on the subprocess.

@zevlg
Copy link
Owner

zevlg commented Sep 22, 2021

As a possibly relevant point of interest: when I try telega-server-build on my primary frame now without attempting to start Telega, I receive telega-test-env: Symbol’s function definition is void: telega-x-frame . I was able to rebuild on the subprocess.

Not related, but good to know, to avoid this problem do (require 'telega) before running M-x telega-server-build RET

@zevlg
Copy link
Owner

zevlg commented Sep 22, 2021

Anyway, this is hard problem to approach, because many components are involved. I don't think anybody cat debug it, except yourself

@WorldsEndless
Copy link
Author

okay. I'll keep up work on this. I mostly wondered if there were recent changes that might have relation to xwindows.

@WorldsEndless
Copy link
Author

I attempted to start it while it was actually running correctly in the subprocess, hoping that maybe it would be jogged awake. As usual, it pops up asking me which account I want to use, but when I choose one, everything freezes -- even the account selection mini-buffer doesn't go away.

I see that my telega-server.log ends with a number of these entries, perhaps indicating some kind of loop:

telega-server.log

@zevlg
Copy link
Owner

zevlg commented Sep 22, 2021

Make sure you don’t run multiple telega instances on same database directory

@WorldsEndless
Copy link
Author

I never did solve this, but the problem went away eventually when I used different networks. It almost seemed like it was timing out until I got on a fast network and then it fixed, never to break since.

@j0ni
Copy link

j0ni commented Dec 28, 2021

This ticket resembles a problem I continue to have with GUI emacs (29 built today, but also for the last couple weeks). It clears a buffer, puts the header text in just before the chat listing, but the listing remains blank, and the buffer resizing message remains in the minibuffer/message area due to the UI being frozen. After thatit doesn't repaint so if I flip between desktops it just keeps whatever was on the last desktop in that location visible (but obv not interactive).

Seems to start up ok when I use a non-GUI emacs, not even a pause. I even tried starting it in a server, which worked, but everything froze as soon as I connected with a GUI emacsclient.

I also tried with a freshly started emacs -Q, eval'd my straight.el boot config, then eval's the (straight-use-package 'telega) line and require'd it, and then started telega - same problem.

I cannot see anything of interest in the telega-server.log, If I start up my telega-server by hand, it gives the following output:

tynan 0 % ./telega-server                                                                                                                     ~/.telega
[ 3][t 0][1640695034.490180015][Client.cpp:278][&td_requests]   Begin to wait for updates with timeout 10.000000
[ 3][t 3][1640695034.491006374][Td.cpp:2668][#1][!MultiTd]      Create Td with layer 135, database version 13 and version 35 on 4 threads
[ 3][t 3][1640695034.491100788][Td.cpp:4062][#1][!Td][&td_requests]     Sending update: updateOption {
  name = "version"
  value = optionValueString {
    value = "1.7.12"
  }
}
[ 3][t 3][1640695034.491171360][Td.cpp:4062][#1][!Td][&td_requests]     Sending update: updateAuthorizationState {
  authorization_state = authorizationStateWaitTdlibParameters {
  }
}
[ 3][t 0][1640695034.491189956][Client.cpp:291][&td_requests]   End to wait for updates, returning object 0 0x7f5128001aa0
[telega-server] OUTPUT event: {"@type":"updateOption","name":"version","value":{"@type":"optionValueString","value":"1.7.12"}}
event 91
(:@type "updateOption" :name "version" :value (:@type "optionValueString" :value "1.7.12"))
[ 3][t 0][1640695034.491368770][Client.cpp:278][&td_requests]   Begin to wait for updates with timeout 10.000000
[ 3][t 0][1640695034.491391420][Client.cpp:291][&td_requests]   End to wait for updates, returning object 0 0x7f5128001c10
[telega-server] OUTPUT event: {"@type":"updateAuthorizationState","authorization_state":{"@type":"authorizationStateWaitTdlibParameters"}}
event 105
(:@type "updateAuthorizationState" :authorization_state (:@type "authorizationStateWaitTdlibParameters"))
[ 3][t 0][1640695034.491454124][Client.cpp:278][&td_requests]   Begin to wait for updates with timeout 10.000000
[ 3][t 0][1640695044.501590967][Client.cpp:291][&td_requests]   End to wait for updates, returning object 0 (nil)
[ 3][t 0][1640695044.501630306][Client.cpp:278][&td_requests]   Begin to wait for updates with timeout 10.000000
[ 3][t 0][1640695054.511816501][Client.cpp:291][&td_requests]   End to wait for updates, returning object 0 (nil)

with the last 2 messages repeated until I kill it. No idea whether that's useful, but at least you can see I'm running a freshly built tdlib.

Earlier, I destroyed my ~/.telega directry and started over - no joy.

I'm using a bleeding edge pgtk emacs, but this problem occurred when I built with lucid or without picking a kit (defaults to gtk3).

If you like I can open a new ticket, but it does seem very much like the same symptoms as this one.

@zevlg
Copy link
Owner

zevlg commented Dec 28, 2021

I don’t think I can help you debug/fix this, sorry. I can’t reproduce this

@WorldsEndless
Copy link
Author

I am going to nudge this because I have further questions. The problem remains (exwm + guix).I have a working solution, but things I would think would be equivalent do not work.

Failing: just start Telega in my regular exwm process. The system freezes and Telega never starts.
Working: Start an emacs sub-process (with async-shell-process M-&) and run Telega there; after some startup time, this succeeds.

Question: The process still fails (freezes) if I try to streamline it with some form of emacs -eval "(call-interactively #'telega). Why is this any different from the succeeding process above?

@WorldsEndless WorldsEndless reopened this Sep 28, 2022
@zevlg
Copy link
Owner

zevlg commented Sep 28, 2022

Set debug-on-quit to non-nil, then start telega, press C-g when it freezes, this should let you get the backtrace to get a clue what is going on.

@WorldsEndless
Copy link
Author

I can't get C-g to work -- it is too frozen. I am next trying to see if the problem is with having multiple accounts.

But I did pick this out of the logs:

[ 3][t 4][1664382985.404559612][Td.cpp:3030][#1][!Td][&td_requests] Receive request 1: close {
}
[ 3][t 4][1664382985.404590368][Td.cpp:4077][#1][!Td][&td_requests] Sending result for request 1: ok {
}
[ 2][t 4][1664382985.404599428][Td.cpp:3550][#1][!Td] Close Td in state 0
[ 3][t 4][1664382985.404603481][Td.cpp:4062][#1][!Td][&td_requests] Sending update: updateAuthorizationState {
authorization_state = authorizationStateClosing {
}
}
[ 3][t 0][1664382985.404605150][Client.cpp:291][&td_requests] End to wait for updates, returning object 1 0x7f1ad0001e80
[ 3][t 4][1664382985.404614686][Td.cpp:3396][#1][!Td] Have no request actors
[ 3][t 4][1664382985.404617547][Td.cpp:4062][#1][!Td][&td_requests] Sending update: updateAuthorizationState {
authorization_state = authorizationStateClosed {
}
}
[ 3][t 4][1664382985.404675960][Td.cpp:3274][#1][!Td] Receive Td::hangup
[ 3][t 4][1664382985.404682874][Td.cpp:3382][#1][!Td] Stop Td
[ 3][t 0][1664382985.404673814][Client.cpp:278][&td_requests] Begin to wait for updates with timeout 0.100000
[ 3][t 0][1664382985.404693126][Client.cpp:291][&td_requests] End to wait for updates, returning object 0 0x7f1ad0001600
[ 3][t 0][1664382985.404696226][Client.cpp:278][&td_requests] Begin to wait for updates with timeout 0.100000
[ 3][t 0][1664382985.404700040][Client.cpp:291][&td_requests] End to wait for updates, returning object 0 0x7f1ad0001fc0
[ 3][t 0][1664382985.404701948][Client.cpp:278][&td_requests] Begin to wait for updates with timeout 0.100000
[ 3][t 0][1664382985.404704570][Client.cpp:291][&td_requests] End to wait for updates, returning object 0 (nil)

@WorldsEndless
Copy link
Author

Empyting the DB folders so they start over did not produce a real difference in the behavior, though my primary sqlite DB went from 21 MB to just 4MB. Likewise setting telega-accounts to nil did not solve anything. My next effort will be to figure out how to update the Telega that Guix is giving me, which is currently

telega v0.8.03 (TDLib v1.8.0) (telega-server v0.7.13)

@zevlg
Copy link
Owner

zevlg commented Sep 28, 2022

This log shows telega exit.

Anyway, I don't think the problem is with your TDLib or telega. Try running telega with emacs -q

@WorldsEndless
Copy link
Author

Returning to this (never resolved) I have some further weirdness.

When I run

emacs -e telega

The whole process freezes, and I see looping in the debug.log with an endless:

[t 0][1707928554.744876146][Client.cpp:280][&td_requests]	Begin to wait for updates with timeout 10.000000
[ 3][t 0][1707928564.754924535][Client.cpp:293][&td_requests]	End to wait for updates, returning object 0 (nil)

This has been happening for years. When I start with two steps, it freezes for maybe 30-seconds (I can watch the thread running that thing maxing out) and then it works:

  1. emacs

  2. (after emacs has loaded) telega

    Any idea why it works in two steps but freezes when I try it in one? How I can stop telega from freezing up?

@zevlg
Copy link
Owner

zevlg commented Feb 14, 2024

To stop telega from freezing up you need to find the reason of that freezes and make it go away. Unfortunately, I can't reproduce emacs -e telega freeze neither any startup freezes after Emacs is already running. At start time telega might take some time to parse input from telega-server, but anyway, Emacs must not get freeze by any elisp code.

NOTE: There was a bug in Emacs display code (bug#39133) that might affect you.

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

3 participants