ErikReider / SwayNotificationCenter

A simple GTK based notification daemon for SwayWM
GNU General Public License v3.0
1.41k stars 63 forks source link

[Bug] leaking opened pipes when some scripts are defined (ex by default) #388

Closed sereinity closed 9 months ago

sereinity commented 9 months ago

Describe the bug After ~300 notifications, swaync will display errors on Too many open files notification every time a notification is send.

To Reproduce Steps to reproduce the behavior:

  1. Use the default swaync config file which declare some example-script and example-action-script
  2. Look for number of opened files: ls /dev/$(pgrep swaync)/fd | wc -l (13 files)
  3. Run notify-send hello world
  4. Look for number of opened files: 17 (it increase each time)
  5. Run until we reach the nofile limit (hint: reduce it to quickly reach the limit)
  6. See error

Expected behavior Running scripts shouldn't leak opend file descriptor.

Please provide logs if you're experiencing notification errors / bugs Logs once the limit is reached:

** (swaync:32015): DEBUG: 23:02:16.000: notiDaemon.vala:171: Notification:
category:                (null)
image_data:              false
expire_timeout:          -1
replaces_id:             0
desktop_entry:           (null)
body:                   world
app_icon:
action_icons:            false
time:                   1708380136
hints:
        sender-pid: int64 32801
        urgency: byte 0x01
applied_id:              13
image_path:              (null)
inline-reply:            (null)
app_name:                notify-send
summary:                 hello
icon_data:               false
resident:                false
default_action:          (null)
actions:
urgency:                 Normal

Run_Script Error: Too many open files
** (swaync:32015): DEBUG: 23:02:16.003: notiDaemon.vala:171: Notification:
category:                (null)
image_data:              false
expire_timeout:          -1
replaces_id:             0
desktop_entry:           (null)
body:                   <b>Output:</b> Too many open files
app_icon:                dialog-error
action_icons:            false
time:                   1708380136
hints:
        urgency: byte 0x02
        SWAYNC_NO_SCRIPT: true
applied_id:              14
image_path:              (null)
inline-reply:            (null)
app_name:                SwayNotificationCenter
summary:                 Failed to run script: example-script
icon_data:               false
resident:                false
default_action:          (null)
actions:
urgency:                 Critical

** (swaync:32015): DEBUG: 23:02:16.005: notiDaemon.vala:229: Skipped scripts for this notification

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Once we empty the scripts section in the config file, swaync will not increase the number of opened file descriptors.

StayPirate commented 9 months ago

Confirm, same problem here.

ErikReider commented 9 months ago

Thanks! Fixed in master :)

StayPirate commented 9 months ago

@ErikReider could you please consider to create a new release? That way downstream distros will easily bring this last fix to end-users that are not closely following master. TBH I find this bug is quite annoying and I'm looking forward to get the update in AUR. Thank you.

ErikReider commented 8 months ago

@ErikReider could you please consider to create a new release? That way downstream distros will easily bring this last fix to end-users that are not closely following master. TBH I find this bug is quite annoying and I'm looking forward to get the update in AUR. Thank you.

Thanks for reminding me! I'll get to it after work and my uni lectures :)