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

[Packetbeat] pcap sniffer hangs on exit #6535

Closed
andrewkroh opened this issue Mar 12, 2018 · 3 comments
Closed

[Packetbeat] pcap sniffer hangs on exit #6535

andrewkroh opened this issue Mar 12, 2018 · 3 comments
Assignees

Comments

@andrewkroh
Copy link
Member

andrewkroh commented Mar 12, 2018

Packetbeat is not exiting cleanly on Linux with the pcap sniffer. There is no timeout signal for the pcap reader so if no packets are received to unblock the read loop it will hang forever.

Perhaps we need to update gopacket (like for google/gopacket#256).

This was detected by beats-tester when we noticed that the logs from Packetbeat were incomplete (missing "packetbeat stopped.").

For confirmed bugs, please report:

  • Version: 6.2.2
  • Operating System: Linux (observed on ubuntu1604, awslinux, opensuse)
  • Steps to Reproduce:
    • Configure Packetbeat with the pcap sniffer on Linux.
    • Use a config where no Packets are being received.
    • Send Ctrl+C
packetbeat.interfaces.device: any

packetbeat.protocols:
- type: http
  ports: [11180] # Some port where there's no traffic.

output.file:
  path: '${path.logs}'
  filename: output.json

logging:
  level: info
  json: true
  files:
    name: packetbeat.json
@andrewkroh
Copy link
Member Author

I'm also seeing the same behavior with af_packet.

@andrewkroh
Copy link
Member Author

andrewkroh commented Mar 13, 2018

This is currently causing beats-tester to fail because it verifies that the beat shuts down properly by checking the log file.

@adriansr
Copy link
Contributor

adriansr commented Mar 15, 2018

I've found out those to be two separate issues.

For af_packet, timeout wasn't being handled correctly at all.
For pcap, it is a well-known problem with libpcap 1.8.0+ which supports TPACKET_V3 to capture packets.

adriansr added a commit to adriansr/beats that referenced this issue Mar 19, 2018
andrewkroh pushed a commit that referenced this issue Mar 19, 2018
Fixes packetbeat termination problems with both af_packet and pcap
captures.

Fixes #6535
adriansr added a commit to adriansr/beats that referenced this issue Apr 5, 2018
Fixes packetbeat termination problems with both af_packet and pcap
captures.

Fixes elastic#6535
andrewkroh pushed a commit that referenced this issue Apr 6, 2018
Fixes packetbeat termination problems with both af_packet and pcap
captures.

Fixes #6535
leweafan pushed a commit to leweafan/beats that referenced this issue Apr 28, 2023
Fixes packetbeat termination problems with both af_packet and pcap
captures.

Fixes elastic#6535
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants