Skip to content

Too many open files Error while running multiple sendp() requests simultaneously.  #1912

@prabhaker75

Description

@prabhaker75

Brief description
I am trying to send many sendp() requests from multiple threads simultaneously, but it shows too many open files error after sending 144 requests simultaneously I have already tried ulimit to increase the file descriptors still I can't send more than 144 requests at a time after which it shows OSError: [Errno 24] Too many open files

Environment
Python 3.7.2
Scapy Version 2.4.2
Linux 5.0.0-arch1-1-ARCH #1 SMP PREEMPT Mon Mar 4 14:11:43 UTC 2019 x86_64 GNU/Linux

How to reproduce
i have written a script which i run in a multithreaded way to send packets using sendp() simultaneously but the code craches after sending for 144 client. any solutions what i can do to increase the number below is the code for one such thread:-

import fcntl, socket, struct

def getHwAddr(ifname):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
info = fcntl.ioctl(s.fileno(), 0x8927, struct.pack('256s', ifname[:15]))
return ''.join(['%02x:' % ord(char) for char in info[18:24]])[:-1]

hw = getHwAddr("enp0s8")
import binascii

p=Ether(src=hw, dst="ff:ff:ff:ff:ff:ff")/IP(src="0.0.0.0", dst="255.255.255.255")/UDP(sport=68, dport=67)/BOOTP(op=1, flags=32768, chaddr=binascii.unhexlify(hw.replace(":", "")))/DHCP(options=[("message-type", "discover"), "end"])

sendp(p,iface="enp0s8")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions