[GH-ISSUE #396] barriers memory leak when clients with duplicate names attempt to connect #315

Closed
opened 2026-05-05 06:01:21 -06:00 by gitea-mirror · 3 comments
Owner

Originally created by @OddBloke on GitHub (Aug 16, 2019).
Original GitHub issue: https://github.com/debauchee/barrier/issues/396

Originally assigned to: @shymega on GitHub.

Operating Systems

Server: Ubuntu 19.10

Client: Ubuntu 19.04, Ubuntu 19.04

Barrier Version

2.3.1+dfsg-1

Steps to reproduce bug

  1. Launch barriers
  2. Connect to barriers with a client
  3. Observe for a few minutes that memory usage is not growing substantially
  4. Launch a second client attempting to connect to barriers with the same name
  5. Watch memory usage grow substantially (~2MB/minute)
  6. Disable the second client, and observe that memory usage growth stops

Other info

This is arguably a DOS attack vector from users on my network; if they know the names of my screens (which are just hostnames in my configuration, so not hard to work out), they can exhaust memory on the host running barriers.

Originally created by @OddBloke on GitHub (Aug 16, 2019). Original GitHub issue: https://github.com/debauchee/barrier/issues/396 Originally assigned to: @shymega on GitHub. ### Operating Systems ### Server: Ubuntu 19.10 Client: Ubuntu 19.04, Ubuntu 19.04 ### Barrier Version ### 2.3.1+dfsg-1 ### Steps to reproduce bug ### 1. Launch barriers 2. Connect to barriers with a client 3. Observe for a few minutes that memory usage is not growing substantially 4. Launch a second client attempting to connect to barriers with the same name 5. Watch memory usage grow substantially (~2MB/minute) 6. Disable the second client, and observe that memory usage growth stops ### Other info ### * Downstream Ubuntu bug report: https://bugs.launchpad.net/ubuntu/+source/barrier/+bug/1840483 * Is there a way to work around it? Yes, restart barriers * Does this bug prevent you from using Barrier entirely? No This is arguably a DOS attack vector from users on my network; if they know the names of my screens (which are just hostnames in my configuration, so not hard to work out), they can exhaust memory on the host running barriers.
gitea-mirror 2026-05-05 06:01:21 -06:00
Author
Owner

@OddBloke commented on GitHub (Aug 16, 2019):

Here's some data gathered using this shell one-liner:

while true; do echo $(date) $(ps aux | grep bin/barriers | grep -v grep); sleep 60; done | tee -a ~/barriers.ps
Fri Aug 16 12:18:38 EDT 2019 daniel 15785 0.1 0.0 111528 9228 ? Sl 12:17 0:00 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800
Fri Aug 16 12:19:38 EDT 2019 daniel 15785 0.1 0.0 111528 9228 ? Sl 12:17 0:00 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800
Fri Aug 16 12:20:38 EDT 2019 daniel 15785 0.1 0.0 111528 9228 ? Sl 12:17 0:00 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800
Fri Aug 16 12:21:38 EDT 2019 daniel 15785 0.1 0.0 111692 9228 ? Sl 12:17 0:00 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800
Fri Aug 16 12:22:38 EDT 2019 daniel 15785 0.2 0.0 111692 9228 ? Sl 12:17 0:00 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800
Fri Aug 16 12:23:38 EDT 2019 daniel 15785 0.2 0.0 111692 9228 ? Sl 12:17 0:00 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800
Fri Aug 16 12:24:38 EDT 2019 daniel 15785 0.2 0.0 111692 9228 ? Sl 12:17 0:00 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800
Fri Aug 16 12:25:38 EDT 2019 daniel 15785 0.2 0.0 111692 9228 ? Sl 12:17 0:01 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800
Fri Aug 16 12:26:38 EDT 2019 daniel 15785 0.2 0.0 111692 9228 ? Sl 12:17 0:01 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800
# Now starting the duplicate client
Fri Aug 16 12:27:38 EDT 2019 daniel 15785 0.2 0.0 112072 11432 ? Sl 12:17 0:01 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800
Fri Aug 16 12:28:38 EDT 2019 daniel 15785 0.3 0.0 112576 13516 ? Sl 12:17 0:02 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800
Fri Aug 16 12:29:38 EDT 2019 daniel 15785 0.3 0.0 113200 15728 ? Sl 12:17 0:02 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800
# And stopping it
Fri Aug 16 12:30:38 EDT 2019 daniel 15785 0.3 0.1 113572 17156 ? Sl 12:17 0:02 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800
Fri Aug 16 12:31:38 EDT 2019 daniel 15785 0.3 0.1 113572 17156 ? Sl 12:17 0:02 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800
Fri Aug 16 12:32:38 EDT 2019 daniel 15785 0.3 0.1 113572 17156 ? Sl 12:17 0:03 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800
Fri Aug 16 12:33:38 EDT 2019 daniel 15785 0.3 0.1 113572 17156 ? Sl 12:17 0:03 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800

<!-- gh-comment-id:522075214 --> @OddBloke commented on GitHub (Aug 16, 2019): Here's some data gathered using this shell one-liner: ```shell while true; do echo $(date) $(ps aux | grep bin/barriers | grep -v grep); sleep 60; done | tee -a ~/barriers.ps ``` ``` Fri Aug 16 12:18:38 EDT 2019 daniel 15785 0.1 0.0 111528 9228 ? Sl 12:17 0:00 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800 Fri Aug 16 12:19:38 EDT 2019 daniel 15785 0.1 0.0 111528 9228 ? Sl 12:17 0:00 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800 Fri Aug 16 12:20:38 EDT 2019 daniel 15785 0.1 0.0 111528 9228 ? Sl 12:17 0:00 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800 Fri Aug 16 12:21:38 EDT 2019 daniel 15785 0.1 0.0 111692 9228 ? Sl 12:17 0:00 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800 Fri Aug 16 12:22:38 EDT 2019 daniel 15785 0.2 0.0 111692 9228 ? Sl 12:17 0:00 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800 Fri Aug 16 12:23:38 EDT 2019 daniel 15785 0.2 0.0 111692 9228 ? Sl 12:17 0:00 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800 Fri Aug 16 12:24:38 EDT 2019 daniel 15785 0.2 0.0 111692 9228 ? Sl 12:17 0:00 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800 Fri Aug 16 12:25:38 EDT 2019 daniel 15785 0.2 0.0 111692 9228 ? Sl 12:17 0:01 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800 Fri Aug 16 12:26:38 EDT 2019 daniel 15785 0.2 0.0 111692 9228 ? Sl 12:17 0:01 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800 # Now starting the duplicate client Fri Aug 16 12:27:38 EDT 2019 daniel 15785 0.2 0.0 112072 11432 ? Sl 12:17 0:01 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800 Fri Aug 16 12:28:38 EDT 2019 daniel 15785 0.3 0.0 112576 13516 ? Sl 12:17 0:02 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800 Fri Aug 16 12:29:38 EDT 2019 daniel 15785 0.3 0.0 113200 15728 ? Sl 12:17 0:02 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800 # And stopping it Fri Aug 16 12:30:38 EDT 2019 daniel 15785 0.3 0.1 113572 17156 ? Sl 12:17 0:02 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800 Fri Aug 16 12:31:38 EDT 2019 daniel 15785 0.3 0.1 113572 17156 ? Sl 12:17 0:02 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800 Fri Aug 16 12:32:38 EDT 2019 daniel 15785 0.3 0.1 113572 17156 ? Sl 12:17 0:03 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800 Fri Aug 16 12:33:38 EDT 2019 daniel 15785 0.3 0.1 113572 17156 ? Sl 12:17 0:03 /usr/bin/barriers -f --no-tray --debug INFO --name surprise --enable-crypto -c /tmp/Barrier.lHYHCL --address :24800 ```
Author
Owner

@noisyshape commented on GitHub (Aug 21, 2019):

Valgrind shows three separate leaks for each connection but they're relatively small. It does not show this leak. What seems to be happening is that socket objects are supposed to be deleted when the client disconnects but they actually hang around until the server cleans them up on exit.

<!-- gh-comment-id:523626012 --> @noisyshape commented on GitHub (Aug 21, 2019): Valgrind shows three separate leaks for each connection but they're relatively small. It does not show this leak. What seems to be happening is that socket objects are supposed to be deleted when the client disconnects but they actually hang around until the server cleans them up on exit.
Author
Owner

@shymega commented on GitHub (Aug 21, 2019):

@noisyshape Could well be. I'll have a look.

<!-- gh-comment-id:523632650 --> @shymega commented on GitHub (Aug 21, 2019): @noisyshape Could well be. I'll have a look.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/barrier#315
No description provided.