Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIFO pipe files are left open after using LiveCapture.sniff() #694

Open
RonaldBos opened this issue May 7, 2024 · 0 comments
Open

FIFO pipe files are left open after using LiveCapture.sniff() #694

RonaldBos opened this issue May 7, 2024 · 0 comments
Labels

Comments

@RonaldBos
Copy link

RonaldBos commented May 7, 2024

Describe the bug
In Linux, after repeatedly calling LiveCapture.sniff() from the same Python process, the process started to throw exceptions 'too many open files'. Inspecting the open files for the Python process demonstrated that with each call to sniff(), the number of open FIFO pipes increased.

To Reproduce
Steps to reproduce the behavior:
Run the Python program below, and in another terminal use 'lsof -p ' to view the number of open files.

import time
import pyshark

capture = pyshark.LiveCapture(interface='eno1')

i = 1

while True:
    print("Capturing #%d" % i)
    capture.sniff(timeout=2)
    capture.close()

    print("Sleeping %d" % i)
    time.sleep(2)

    i += 1

Example output:

$ lsof -p 1928 | grep pipe
python3 1928  6r     FIFO               0,14      0t0    29322 pipe
python3 1928  7w     FIFO               0,14      0t0    29322 pipe
python3 1928  8r     FIFO               0,14      0t0    30146 pipe
python3 1928  9r     FIFO               0,14      0t0    30241 pipe
python3 1928 10w     FIFO               0,14      0t0    30146 pipe
python3 1928 11w     FIFO               0,14      0t0    30241 pipe
python3 1928 12r     FIFO               0,14      0t0    29515 pipe
python3 1928 13w     FIFO               0,14      0t0    29515 pipe
python3 1928 14r     FIFO               0,14      0t0    30319 pipe
python3 1928 15w     FIFO               0,14      0t0    30319 pipe
python3 1928 16r     FIFO               0,14      0t0    30409 pipe
python3 1928 17r     FIFO               0,14      0t0    29587 pipe
python3 1928 18w     FIFO               0,14      0t0    29587 pipe
python3 1928 19r     FIFO               0,14      0t0    30393 pipe
python3 1928 21w     FIFO               0,14      0t0    30393 pipe
python3 1928 22w     FIFO               0,14      0t0    30409 pipe

# wait a couple of seconds, then:
$ lsof -p 1928 | grep pipe
python3 1928  6r     FIFO               0,14      0t0    29322 pipe
python3 1928  7w     FIFO               0,14      0t0    29322 pipe
python3 1928  8r     FIFO               0,14      0t0    30146 pipe
python3 1928  9r     FIFO               0,14      0t0    30241 pipe
python3 1928 10w     FIFO               0,14      0t0    30146 pipe
python3 1928 11w     FIFO               0,14      0t0    30241 pipe
python3 1928 12r     FIFO               0,14      0t0    29515 pipe
python3 1928 13w     FIFO               0,14      0t0    29515 pipe
python3 1928 14r     FIFO               0,14      0t0    30319 pipe
python3 1928 15w     FIFO               0,14      0t0    30319 pipe
python3 1928 16r     FIFO               0,14      0t0    30409 pipe
python3 1928 17r     FIFO               0,14      0t0    29587 pipe
python3 1928 18w     FIFO               0,14      0t0    29587 pipe
python3 1928 19r     FIFO               0,14      0t0    30393 pipe
python3 1928 20r     FIFO               0,14      0t0    34832 pipe
python3 1928 21w     FIFO               0,14      0t0    30393 pipe
python3 1928 22w     FIFO               0,14      0t0    30409 pipe
python3 1928 23w     FIFO               0,14      0t0    34832 pipe
python3 1928 24r     FIFO               0,14      0t0    34868 pipe
python3 1928 25r     FIFO               0,14      0t0    30570 pipe
python3 1928 26w     FIFO               0,14      0t0    34868 pipe
python3 1928 27w     FIFO               0,14      0t0    30570 pipe
python3 1928 28r     FIFO               0,14      0t0    30634 pipe
python3 1928 29r     FIFO               0,14      0t0    30611 pipe
python3 1928 30w     FIFO               0,14      0t0    30611 pipe

Expected behavior
The desired behavior is that any files opened by LiveCapture.sniff() are also closed after the sniff is done.

Versions:

  • OS: Ubuntu 22.04.4 LTS
  • pyshark version: pyshark-0.5.3
  • tshark version: TShark (Wireshark) 4.1.0 (Git commit 08feb35af00a)
@RonaldBos RonaldBos added the bug label May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant