emacs-slack icon indicating copy to clipboard operation
emacs-slack copied to clipboard

Creating pipe: Too many open files

Open FrostyX opened this issue 2 years ago • 2 comments

Describe the bug My slack-start command fails with:

[2023-06-20 15:43:22] [info] [redacted instance name] Slack Websocket Is Ready!
[2023-06-20 15:43:22] [info] [redacted instance name] Slack Command List Updated
error in process sentinel: make-process--with-editor-process-filter: Creating pipe: Too many open files
error in process sentinel: Creating pipe: Too many open files
Download Failed. STATUS: exit, EVENT: exited abnormally with code 125
, URL: https://emoji.slack-edge.com/T030G10V24F/schwa/2499b21b1d512990.png, NAME: /tmp/b80773febba540a063511f6ac2b16320.png, OUTPUT: 

To Reproduce

  1. M-x slack-start
  2. Wait ~20 seconds
  3. Error

Backtrace

See above

Expected behavior

I want the command to finish successfully and connect me to Slack

Screenshots

Not applicable

Environment:

  • OS: Fedora 37
  • Emacs Version: 28.2
  • emacs-slack Version: 20211129.310

Additional context

I want to connect to a company instance, so I cannot share the hostname

FrostyX avatar Jun 20 '23 13:06 FrostyX

You need to use ulimit to increase the number of files you can open. This isn't an emacs-slack bug.

gravieure avatar Oct 19 '23 17:10 gravieure

Well, I can hit this issue regardless how high the limit I set. Maybe it could be done in a way where the amount of opened files at the same time is not that huge?

sleep-walker avatar May 31 '24 09:05 sleep-walker

mmm is this still happening? I think it is an easy fix here, we could batch the obtained emojis in groups of N and process over an idle-timer. Anybody who is still interested in testing this if I patch it? I don't have so many emojis in my slack channels, strangely (I thought clojurians had a lot, but I didn't see the error)

ag91 avatar Nov 18 '24 23:11 ag91

If you can prepare branch, I can test it.

sleep-walker avatar Nov 19 '24 00:11 sleep-walker

cool, thanks. I will try in the week (I tried on the fly, but there is a little state paths which may requrie a bit of macro magic I think to make that code run after the last async computation)

ag91 avatar Nov 19 '24 00:11 ag91

@sleep-walker could you give a try to https://github.com/emacs-slack/emacs-slack/commit/64f37e307d10f9bd7229077253ae0c710f8775cf on this branch?

You can set slack-emoji-job-batch-size and slack-emoji-job-interval to toggle how many emojis get downloaded at a time and every how many seconds respectively.

ag91 avatar Nov 20 '24 21:11 ag91

mmm never mind I managed to reproduce while working on https://github.com/emacs-slack/emacs-slack/issues/520, there is still something wrong in my code

ag91 avatar Nov 20 '24 22:11 ag91

okay, if you could test now it would be cool: I have fixed the issue and things seem to work well. I increased the batch size so that it takes less: I added the default images so if you have many custom emojis this will take a while

ag91 avatar Nov 20 '24 23:11 ag91

TL;DR it didn't work for me my configuration:

;;; Slack
(use-package tracking)
(use-package websocket)
(use-package alert)
(use-package circe)
(use-package slack
  :straight (slack :type git :host github :repo "emacs-slack/emacs-slack" :branch "bugfix/583-reduce-file-descriptors-consumptions-due-to-emoji")
  :init
  (add-hook 'slack-mode-hook #'emojify-mode)
  (slack-register-team
   :name "redacted"
   :token (password-store-get "slack/token")
   :cookie (password-store-get "slack/token2")
   :subscribed-channels '(("redacted" "redacted")))
  (with-eval-after-load 'tracking
    (define-key tracking-mode-map [f11]
                #'tracking-next-buffer))
  ;; Ensure the buffer exists when a message arrives on a
  ;; channel that wasn't open.
  (setq slack-buffer-create-on-notify t))

Warnings:

⛔ Warning (native-compiler): alert.el:559:10: Warning: the function ‘alert--log-enable-logging’ is not known to be defined.
⛔ Warning (eglot): Wrong type argument: processp, nil
⛔ Warning (native-compiler): slack-pinned-item.el:43:22: Warning: the function ‘slack-message-create’ is not known to be defined.
⛔ Warning (native-compiler): slack-thread-message-buffer.el:246:8: Warning: the function ‘slack-room-display’ is not known to be defined.
⛔ Warning (native-compiler): slack-room-buffer.el:383:8: Warning: the function ‘slack-open-message’ is not known to be defined.
⛔ Warning (native-compiler): slack-message-attachment-preview-buffer.el:169:115: Warning: the function ‘slack-message-remove-file’ is not known to be defined.
⛔ Warning (native-compiler): slack-message-reaction.el:65:26: Warning: the function ‘slack-buffer-team’ is not known to be defined.
⛔ Warning (native-compiler): slack-message-editor.el:96:8: Warning: the function ‘slack-buffer-send-message’ is not known to be defined.
⛔ Warning (native-compiler): slack-message-editor.el:86:18: Warning: the function ‘slack-buffer-buffer’ is not known to be defined.
⛔ Warning (native-compiler): slack-message-editor.el:53:4: Warning: the function ‘slack-buffer-enable-emojify’ is not known to be defined.
⛔ Warning (native-compiler): slack-message-sender.el:589:10: Warning: the function ‘slack-upload-file’ is not known to be defined.
⛔ Warning (native-compiler): slack-message-sender.el:124:26: Warning: the function ‘slack-buffer-team’ is not known to be defined.
⛔ Warning (native-compiler): slack-message-notification.el:138:59: Warning: the function ‘ts-now’ is not known to be defined.
⛔ Warning (native-compiler): slack-message-notification.el:138:38: Warning: the function ‘ts-format’ is not known to be defined.
⛔ Warning (native-compiler): slack-file.el:467:20: Warning: the function ‘slack-file-deleted-p’ is not known to be defined.
⛔ Warning (native-compiler): slack-file.el:45:35: Warning: the function ‘slack-file-display’ is not known to be defined.
⛔ Warning (native-compiler): slack-block.el:1378:21: Warning: the function ‘language-detection-string’ is not known to be defined.
⛔ Warning (native-compiler): slack-mrkdwn.el:106:12: Warning: the function ‘slack-wysiwyg-enabled-p’ is not known to be defined.
⛔ Warning (native-compiler): slack-room.el:216:4: Warning: the function ‘slack-conversations-mark’ is not known to be defined.
⛔ Warning (native-compiler): slack-counts.el:225:4: Warning: the function ‘slack-update-modeline’ is not known to be defined.
⛔ Warning (native-compiler): slack-dnd-status.el:69:42: Warning: the function ‘slack-room-open-p’ is not known to be defined.
⛔ Warning (native-compiler): slack-emoji.el:206:26: Warning: the function ‘slack-buffer-team’ is not known to be defined.
⛔ Warning (native-compiler): slack-team.el:154:49: Warning: the function ‘slack-buffer-buffer’ is not known to be defined.
⛔ Warning (native-compiler): slack-util.el:300:7: Warning: the function ‘s-replace’ is not known to be defined.
⛔ Warning (native-compiler): slack-util.el:275:22: Warning: the function ‘s-split’ is not known to be defined.

Messages after slack-start:

s-split: Wrong type argument: stringp, nil

Emacs version:

GNU Emacs 30.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41,
cairo version 1.18.0)

sleep-walker avatar Nov 21 '24 16:11 sleep-walker

this seems unrelated: is your cookie set properly, could you check by running slack-refresh-token?

ag91 avatar Nov 21 '24 18:11 ag91

merged in the change that fixed this for me, please reopen if this is not fixed for some reason. @sleep-walker please open an issue if you struggle getting started after following the instructions in the readme (they changed from the original version because Slack changed the way client need to authenticate)

ag91 avatar Nov 22 '24 00:11 ag91

You are right, it's probably unrelated. Unfortunatelly, my api_token starts with xoxc and there is no enterprise_api_token in TS.boot_data. So I can't login anymore and thus can't verify the fix.

sleep-walker avatar Nov 22 '24 12:11 sleep-walker

@sleep-walker is it possible that you didn't follow the instructions after running M-x slack-refresh-token? I have a xoxc token too and I am using emacs-slack. Anyway, no need to test: I checked the fix and it works :sunny:

ag91 avatar Nov 23 '24 12:11 ag91