[Bug]: network module's format-connected-prefix disappears when using ping-interval
Neurognostic opened this issue · comments
Checklist
- I have read the appropriate section in the contributing guidelines
- I believe this issue is a problem with polybar itself and not a misconfiguration on my part
- I have searched for other open and closed issues that may have already reported this problem
- I have checked the known issues page for this problem.
- I have followed the debugging guide to narrow down the problem to a minimal config.
Steps to reproduce
- Create minimal config. (see example)
- Set
ping-interval
of network module greater than0
Minimal config
[bar/test]
enable-ipc = true
modules-right = eth-test
[module/eth-test]
type = internal/network
interface-type = wired
label-connected = %upspeed:3% %downspeed:3%
format-connected-prefix = ">PREFIX< "
ping-interval = 2
Polybar log
Trace log
polybar|notice: Parsing config file: ./config.eth-test.ini
polybar|trace: config_parser: Parsing ./config.eth-test.ini
polybar|info: Created legacy ipc fifo at '/tmp/polybar_mqueue.46805'
polybar|info: Opening ipc socket at '/run/user/1000/polybar/ipc.46805.sock'
polybar|notice: Listening for IPC messages (PID: 46805)
polybar|warn: No monitor specified, using "DP-0"
polybar|info: Loaded monitor DP-0 (3440x1440+0+0)
polybar|info: Configured DPI = 96x96
polybar|info: Bar geometry: 3440x24+0+0; Borders: 0,0,0,0
polybar|trace: bar: Attach X event sink
polybar|trace: bar: Attach signal receiver
polybar|trace: controller: Setup user-defined modules
polybar|notice: Loading module 'eth-test' of type 'internal/network'
polybar|notice: module/eth-test: Discovered wired interface enp5s0
polybar|notice: Loaded 1 modules
polybar|info: Starting application
polybar|trace: controller: Main thread id = 1
polybar|info: Entering event loop (thread-id=1)
polybar|trace: bar: Create renderer
polybar|trace: renderer: Get TrueColor visual
polybar|info: renderer: Using 32-bit TrueColor visual: 0x23
polybar|trace: renderer: Allocate colormap
polybar|trace: renderer: Allocate output window
polybar|trace: renderer: Allocate window pixmaps
polybar|trace: renderer: Allocate graphic contexts
polybar|trace: renderer: Allocate alignment blocks
polybar|trace: renderer: Allocate cairo components
polybar|trace: renderer: Load fonts
polybar|warn: No fonts specified, using fallback font "fixed"
polybar|notice: Loaded font "fixed" (name=Noto Sans, offset=0, file=/usr/share/fonts/noto/NotoSans-Regular.ttf)
polybar|info: Bar window: 0x2800001
polybar|trace: bar: Reconfigure window
polybar|trace: bar: Set window WM_NAME
polybar|trace: bar: Set window _NET_WM_WINDOW_TYPE
polybar|trace: bar: Set window _NET_WM_STATE
polybar|trace: bar: Set window _NET_WM_DESKTOP
polybar|trace: bar: Set window _NET_WM_PID
polybar|trace: bar: Map window
polybar|trace: background_manager: update_geometry
polybar|trace: background_manager: deactivating because there are no slices to observe
polybar|trace: bar: Draw empty bar
polybar|trace: bar: Setup tray manager
polybar|info: Starting module/eth-test
polybar|info: module/eth-test: Rebuilding cache
polybar|trace: bar: Force update
polybar|info: Redrawing bar window
polybar|trace: module/eth-test: Thread id = 2
polybar|info: module/eth-test: Rebuilding cache
polybar|info: Redrawing bar window
polybar|trace: renderer: flush(3 geom=198x24+3242+0, falloff=0)
polybar|info: module/eth-test: Rebuilding cache
polybar|info: Redrawing bar window
polybar|trace: renderer: flush(3 geom=171x24+3269+0, falloff=0)
polybar|trace: bar: Received expose event
polybar|info: module/eth-test: Rebuilding cache
polybar|trace: bar: Ignoring update (unchanged)
polybar|info: module/eth-test: Rebuilding cache
polybar|trace: bar: Ignoring update (unchanged)
polybar|info: module/eth-test: Rebuilding cache
polybar|trace: bar: Ignoring update (unchanged)
polybar|info: module/eth-test: Rebuilding cache
polybar|trace: bar: Ignoring update (unchanged)
polybar|info: module/eth-test: Rebuilding cache
polybar|trace: bar: Ignoring update (unchanged)
polybar|info: module/eth-test: Rebuilding cache
polybar|trace: bar: Ignoring update (unchanged)
polybar|info: module/eth-test: Rebuilding cache
polybar|trace: bar: Ignoring update (unchanged)
polybar|notice: Watched config file changed config.eth-test.ini
polybar|info: Eventloop finished
polybar|notice: Termination signal received, shutting down...
polybar|trace: controller: Detach signal receiver
polybar|trace: controller: Stop modules
polybar|info: module/eth-test: Stopping
polybar|trace: module/eth-test: Release sleep lock
polybar|info: Deconstruction of module/eth-test took 0 ms.
polybar|trace: module/eth-test: Deconstructing
polybar|trace: ipc: Removing named pipe at: /tmp/polybar_mqueue.46805
polybar|info: Waiting for spawned processes to end
polybar|info: Re-launching application...
polybar|notice: Parsing config file: ./config.eth-test.ini
polybar|trace: config_parser: Parsing ./config.eth-test.ini
polybar|info: Created legacy ipc fifo at '/tmp/polybar_mqueue.46805'
polybar|info: Opening ipc socket at '/run/user/1000/polybar/ipc.46805.sock'
polybar|notice: Listening for IPC messages (PID: 46805)
polybar|warn: No monitor specified, using "DP-0"
polybar|info: Loaded monitor DP-0 (3440x1440+0+0)
polybar|info: Configured DPI = 96x96
polybar|info: Bar geometry: 3440x24+0+0; Borders: 0,0,0,0
polybar|trace: bar: Attach X event sink
polybar|trace: bar: Attach signal receiver
polybar|trace: controller: Setup user-defined modules
polybar|notice: Loading module 'eth-test' of type 'internal/network'
polybar|notice: module/eth-test: Discovered wired interface enp5s0
polybar|notice: Loaded 1 modules
polybar|info: Starting application
polybar|trace: controller: Main thread id = 1
polybar|info: Entering event loop (thread-id=1)
polybar|trace: bar: Create renderer
polybar|trace: renderer: Get TrueColor visual
polybar|info: renderer: Using 32-bit TrueColor visual: 0x23
polybar|trace: renderer: Allocate colormap
polybar|trace: renderer: Allocate output window
polybar|trace: renderer: Allocate window pixmaps
polybar|trace: renderer: Allocate graphic contexts
polybar|trace: renderer: Allocate alignment blocks
polybar|trace: renderer: Allocate cairo components
polybar|trace: renderer: Load fonts
polybar|warn: No fonts specified, using fallback font "fixed"
polybar|notice: Loaded font "fixed" (name=Noto Sans, offset=0, file=/usr/share/fonts/noto/NotoSans-Regular.ttf)
polybar|info: Bar window: 0x2800001
polybar|trace: bar: Reconfigure window
polybar|trace: bar: Set window WM_NAME
polybar|trace: bar: Set window _NET_WM_WINDOW_TYPE
polybar|trace: bar: Set window _NET_WM_STATE
polybar|trace: bar: Set window _NET_WM_DESKTOP
polybar|trace: bar: Set window _NET_WM_PID
polybar|trace: bar: Map window
polybar|trace: background_manager: update_geometry
polybar|trace: background_manager: deactivating because there are no slices to observe
polybar|trace: bar: Draw empty bar
polybar|trace: bar: Setup tray manager
polybar|info: Starting module/eth-test
polybar|info: module/eth-test: Rebuilding cache
polybar|trace: bar: Force update
polybar|info: Redrawing bar window
polybar|trace: module/eth-test: Thread id = 2
polybar|info: module/eth-test: Rebuilding cache
polybar|info: Redrawing bar window
polybar|trace: renderer: flush(3 geom=198x24+3242+0, falloff=0)
polybar|info: module/eth-test: Rebuilding cache
polybar|info: Redrawing bar window
polybar|trace: renderer: flush(3 geom=171x24+3269+0, falloff=0)
polybar|trace: bar: Received expose event
polybar|trace: command: Waiting for pid 46810 to finish...
polybar|trace: command: Exited with failed status 1
polybar|info: module/eth-test: Rebuilding cache
polybar|info: Redrawing bar window
polybar|trace: renderer: flush(3 geom=98x24+3342+0, falloff=0)
polybar|info: module/eth-test: Rebuilding cache
polybar|trace: bar: Ignoring update (unchanged)
polybar|trace: command: Waiting for pid 46811 to finish...
polybar|notice: Watched config file changed config.eth-test.ini
polybar|info: Eventloop finished
polybar|notice: Termination signal received, shutting down...
polybar|trace: controller: Detach signal receiver
polybar|trace: controller: Stop modules
polybar|info: module/eth-test: Stopping
polybar|trace: command: Exited with failed status 1
polybar|trace: module/eth-test: Release sleep lock
polybar|info: Deconstruction of module/eth-test took 1310 ms.
polybar|trace: module/eth-test: Deconstructing
polybar|trace: ipc: Removing named pipe at: /tmp/polybar_mqueue.46805
polybar|info: Waiting for spawned processes to end
polybar|info: Re-launching application...
polybar|notice: Parsing config file: ./config.eth-test.ini
polybar|trace: config_parser: Parsing ./config.eth-test.ini
polybar|info: Created legacy ipc fifo at '/tmp/polybar_mqueue.46805'
polybar|info: Opening ipc socket at '/run/user/1000/polybar/ipc.46805.sock'
polybar|notice: Listening for IPC messages (PID: 46805)
polybar|warn: No monitor specified, using "DP-0"
polybar|info: Loaded monitor DP-0 (3440x1440+0+0)
polybar|info: Configured DPI = 96x96
polybar|info: Bar geometry: 3440x24+0+0; Borders: 0,0,0,0
polybar|trace: bar: Attach X event sink
polybar|trace: bar: Attach signal receiver
polybar|trace: controller: Setup user-defined modules
polybar|notice: Loading module 'eth-test' of type 'internal/network'
polybar|notice: module/eth-test: Discovered wired interface enp5s0
polybar|notice: Loaded 1 modules
polybar|info: Starting application
polybar|trace: controller: Main thread id = 1
polybar|info: Entering event loop (thread-id=1)
polybar|trace: bar: Create renderer
polybar|trace: renderer: Get TrueColor visual
polybar|info: renderer: Using 32-bit TrueColor visual: 0x23
polybar|trace: renderer: Allocate colormap
polybar|trace: renderer: Allocate output window
polybar|trace: renderer: Allocate window pixmaps
polybar|trace: renderer: Allocate graphic contexts
polybar|trace: renderer: Allocate alignment blocks
polybar|trace: renderer: Allocate cairo components
polybar|trace: renderer: Load fonts
polybar|warn: No fonts specified, using fallback font "fixed"
polybar|notice: Loaded font "fixed" (name=Noto Sans, offset=0, file=/usr/share/fonts/noto/NotoSans-Regular.ttf)
polybar|info: Bar window: 0x2800001
polybar|trace: bar: Reconfigure window
polybar|trace: bar: Set window WM_NAME
polybar|trace: bar: Set window _NET_WM_WINDOW_TYPE
polybar|trace: bar: Set window _NET_WM_STATE
polybar|trace: bar: Set window _NET_WM_DESKTOP
polybar|trace: bar: Set window _NET_WM_PID
polybar|trace: bar: Map window
polybar|trace: background_manager: update_geometry
polybar|trace: background_manager: deactivating because there are no slices to observe
polybar|trace: bar: Draw empty bar
polybar|trace: bar: Setup tray manager
polybar|info: Starting module/eth-test
polybar|trace: module/eth-test: Thread id = 2
polybar|info: module/eth-test: Rebuilding cache
polybar|trace: bar: Force update
polybar|info: Redrawing bar window
polybar|info: module/eth-test: Rebuilding cache
polybar|info: Redrawing bar window
polybar|trace: renderer: flush(3 geom=198x24+3242+0, falloff=0)
polybar|info: module/eth-test: Rebuilding cache
polybar|info: Redrawing bar window
polybar|trace: renderer: flush(3 geom=171x24+3269+0, falloff=0)
polybar|trace: bar: Received expose event
polybar|info: module/eth-test: Rebuilding cache
polybar|trace: bar: Ignoring update (unchanged)
polybar|info: module/eth-test: Rebuilding cache
polybar|trace: bar: Ignoring update (unchanged)
polybar|info: module/eth-test: Rebuilding cache
polybar|trace: bar: Ignoring update (unchanged)
polybar|notice: Received signal(2): Interrupt
polybar|info: Eventloop finished
polybar|notice: Termination signal received, shutting down...
polybar|trace: controller: Detach signal receiver
polybar|trace: controller: Stop modules
polybar|info: module/eth-test: Stopping
polybar|trace: module/eth-test: Release sleep lock
polybar|info: Deconstruction of module/eth-test took 0 ms.
polybar|trace: module/eth-test: Deconstructing
polybar|trace: ipc: Removing named pipe at: /tmp/polybar_mqueue.46805
polybar|info: Waiting for spawned processes to end
polybar|info: Reached end of application...
Expected behavior
When using the ping-interval
option of the network module the format-connected-prefix
is expected to render and stay rendered.
Actual behavior
Setting ping-interval
to a value greater than 0
causes the format-connected-prefix
to de-render after one interval. (See video)
Window Manager and Version
bspwm -v
0.9.10-50-g8fc2269
Linux Distribution
Arch Linux
Polybar version
polybar 3.6.3-197-gf78ec80d
Features: +alsa +curl +i3 +mpd +network(libnl) +pulseaudio +xkeyboard
X extensions: +randr (+monitors) +composite +xkb +xrm +xcursor
Build type: Release
Compiler: /usr/bin/c++
Compiler flags: -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -O3 -DNDEBUG -Wall -Wextra -Wpedantic -Wdeprecated-copy-dtor -Wsuggest-override
Linker flags: -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -Wall -Wextra -Wpedantic -Wdeprecated-copy-dtor -Wsuggest-override -Wall -Wextra -Wpedantic -Wdeprecated-copy-dtor -Wsuggest-override
Additional Context / Screenshots
polybar-eth-module-troubleshooting.mp4
ping-interval
is used in connection with format-packetloss
(I have updated the docs to make it clearer).
What happens in your case is that after two updates, the modules tries to ping 8.8.8.8
and if it fails (which it does in your case), it switches over to format-packetloss
(and no longer uses format-connected
, including its prefix).
Thank you, format-packetloss
explains why the prefix disappears and resolves part of the problem. However, the ping-interval
should not be failing—8.8.8.8
is definitely reachable. Is there a known bug or limitation with ping-interval
?
ping-interval-failure.mp4
The command that is run is ping -I <INTERFACE> -c 2 -W 2 8.8.8.8
(in your case the interface seems to be enp5s0
) and polybar reports that it failed with exit code 1. Unfortunately, polybar does not collect the output of the command, so we don't know why it fails.
But just from the fact that the command takes some time to finish, I would assume this is not just a trivial invocation error but the ping actually fails and doesn't receive any/enough packets by the 2 second deadline (as described in the man page).
The main limitation with ping-interval
is that it was experimentally added 7 years ago and no one has done any work on it since. I am inclined to remove the option at some point and either completely drop this functionality or implement a more robust version (the current one is kind of hacky since it just stops the network module while it waits for ping to finish).
The -I <interface>
part is the culprit. Wireguard tunnel running on this interface is blocking packets going direct and I couldn't get the network module to work directly with the virtual tunnel interface.
That makes sense. And that's why this is an experimental feature 😉