zevlg / telega.el

GNU Emacs telegram client (unofficial)
https://zevlg.github.io/telega.el/
GNU General Public License v3.0
1.11k stars 86 forks source link

Configuration with non-defaut directories create continuous errors #307

Closed sylph1o closed 3 years ago

sylph1o commented 3 years ago

Telega Setup

OS: Arch Linux Emacs: GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, cairo version 1.17.4) Telega: telega v0.7.030 (TDLib v1.7.0) (telega-server v0.7.5) MELPA: 0.7.30

Current Behavior

First, let me say that Telega was initially running fine. My previous configuration worked. Actually, I had a great experience with it and I thank you for this polished and well-documented project!

In order to make it comply with the XDG base directory specification, I changed the configuration with

(setq telega-directory (expand-file-name "~/.local/share/telega")
    telega-database-dir (expand-file-name "~/.local/share/telega")
    telega-cache-dir (expand-file-name "~/.cache/telega")
    telega-temp-dir (expand-file-name "~/.cache/telega")
)

After reinstalling telega (see 'Steps to reproduce' for details), when the root buffer opens I get this message (multiple times):

Telega: !GARBAGE! in the telega-server buffer

I am able to connect to my Telegram account and telega starts fetching chats (and supposedly other data).

However, now and every time I launch telega (without doing anything else) I get these error messages

Telega: !GARBAGE! in the telega-server buffer [51 times]
error in process filter: cl--assertion-failed: Assertion failed: chat
error in process filter: Assertion failed: chat
Telega: !GARBAGE! in the telega-server buffer [19 times]
error in process filter: cl--assertion-failed: Assertion failed: chat
error in process filter: Assertion failed: chat
Error running timer ‘telega-server--idle-timer-function’: (wrong-type-argument arrayp nil)

This is a very small excerpt. These error messages keep happening almost continuously, to the point where it is difficult to do anything.

The other error messages below happen occasionally, still in root buffer and still without doing anything. When they happen, they happen many times.

error in process filter: telega-server--parse-commands: Invalid read syntax: "#"
error in process filter: Invalid read syntax: "#"

Chats are fetched but with many time-out error messages such as

error in process filter: apply: getChat timed out chat_id=973398834
error in process filter: getChat timed out chat_id=973398834

I am able to open chats once they are fetched. When I open a chat, I get these error messages continuously:

error in process filter: telega-server--parse-commands: Invalid read syntax: ") or . in a vector"
error in process filter: Invalid read syntax: ") or . in a vector"

Telega is hardly usable in that state. Do you have any idea how I could fix this? I do not want to clutter my home directory with ~/.telega.

Steps to Reproduce

  1. Close telega
  2. Edit the telega configuration to change the values of telega-directory, telega-database-dir, telega-cache-dir, telega-temp-dir as in the snippet shown above
  3. [Optional] Remove ~/.telega, reinstall telega package. The behaviour was reproduced without this step; it just seemed cleaner.
  4. Start telega (M-x telega)
  5. Install server without VoIP support. This was not tested with VoIP support.
  6. Observe errors as soon as root buffer is open. After authentication, more errors can be observed. Once a chat has been fetched, open it to see other errors.

I have reproduced this problem on another Linux computer with a similar environment. I can confirm that ~/.telega is not created, and files are created in ~/.local/share/telega and ~/.cache/telega.

Below is my full configuration of telega (account names changed). This configuration worked fine without the lines given above.

  (use-package telega
    :ensure t
    :commands telega
    ;; Use MELPA stable for compatibility with TDlib releases
    ;; (the package in the Arch User Repository follows only TDlib releases)
    :pin melpa-stable
    :defer t
    :hook
    (telega-load . telega-notifications-mode)
    (telega-load . telega-mode-line-mode)
    (telega-load . telega-appindicator-mode) ; For notifications. Requires libappindicator3
    (telega-load . (lambda ()
                     (define-key global-map (kbd "C-c t") telega-prefix-map)))
    (telega-chat-mode . my-telega-chat-mode)
    (telega-chat-mode . variable-pitch-mode) ;set default font as variable width
    :config
    ;; XDG base directory
    (setq telega-directory (expand-file-name "~/.local/share/telega")
          telega-database-dir (expand-file-name "~/.local/share/telega")
          telega-cache-dir (expand-file-name "~/.cache/telega")
          telega-temp-dir (expand-file-name "~/.cache/telega")
          )
    (setq telega-accounts
          (list
           (list "account1" 'telega-database-dir (expand-file-name "account1" telega-database-dir))
           (list "account2" 'telega-database-dir (expand-file-name "account2" telega-database-dir))
           )
          telega-chat-input-markups (list "markdown1" "org" nil "markdown2")
          telega-chat-ret-always-sends-message nil
          telega-emoji-company-backend 'telega-company-emoji
          )

    (defun my-telega-chat-mode ()
      ;; set monospaced font.
      (dolist (faces-mono '(telega-entity-type-pre
                            telega-entity-type-code))
        (set-face-attribute faces-mono nil :inherit 'fixed-pitch))
      ;; set company backends
      (set (make-local-variable 'company-backends)
           (append (list telega-emoji-company-backend
                         'telega-company-username
                         'telega-company-hashtag)
                   (when (telega-chat-bot-p telega-chatbuf--chat)
                     '(telega-company-botcmd))))
      (company-mode 1))
    )
zevlg commented 3 years ago

Thanks for the embracive report, I'll look at it in near future.

zevlg commented 3 years ago

Could you please try telega from master to trigger this,? Or compiling TDLib 1.7.6 is impossible on your side?

I can't reproduce this with telega from master

sylph1o commented 3 years ago

Thanks for checking. I will try this week-end and report here.

sylph1o commented 3 years ago

I am able to reproduce it with the master version.

From telega-report-bug:

*Telega*: telega v0.7.62 (TDLib v1.7.6) (telega-server v0.7.13)

I deleted the directories of telega (~/.cache/telega and ~/.local/share/telega) before changing version, so I re-started from scratch (as far as I can tell).

Upon launching telega, I am still greeted by multiple repetitions of

Telega: !GARBAGE! in the telega-server buffer

Authentication goes well, then I get an endless stream of error messages:

error in process filter: Invalid read syntax: ") or . in a vector"
error in process filter: telega-server--parse-commands: Invalid read syntax: ") or . in a vector"

I don't see any significant difference there, although this one may be new (unsure):

Error running timer ‘telega-status--animate’: (error "Telega status button is gone")

Full copy there. The first messages (e.g. about !GARBAGE!) seem missing, so I guess the history limit was reached.

The only noticeable difference are error messages appearing directly in the root buffer. The full messages are there. The [redacted] replacements are my only modification.

I don't know what other information to provide. I'll come back to it (try to perform a few actions) later today.

sylph1o commented 3 years ago

I had forgotten to report further.

It turns out that I was optimistic regarding the fetching of chats: it doesn't seem able to complete (endlessly "Loading chats"). This and the continuous errors prevent me from attempting anything. I have to kill then restart emacs to be able to use it.

Do you have any suggestion on how I could troubleshoot this issue?

P.S. I tried again with the latest version from the master branch (as of today) just in case: no difference.

zevlg commented 3 years ago

Set telega-debug to non-nil and start telega, after getting GARBAGE message kill telega. Then switch to *telega-debug* buffer, search for "GARBAGE" or send whole content of the *telega-debug* buffer here

sylph1o commented 3 years ago

Thanks for the explanation. I let telega run for about 30 seconds before killing it. The full content of the *telega-debug* buffer is available here.

Thanks for your time. Let me know if there is anything else I can provide.

zevlg commented 3 years ago

I see! You have no ~/.telega directory, but your telega-server-logfile points into it. You have few options: 1) move (setq telega-directory ...) sexp to :init section of use-package instead of :hook 2) set telega-server-verbosity to 0 3) set telega-server-logfile to existing directory