Exemplo n.º 1
0
    def test_huge_file_descriptor(self):
        from kazoo.handlers.threading import _HAS_EPOLL

        if not _HAS_EPOLL:
            self.skipTest('only run on systems with epoll()')
        import resource
        import socket
        from kazoo.handlers.utils import create_tcp_socket

        try:
            resource.setrlimit(resource.RLIMIT_NOFILE, (4096, 4096))
        except (ValueError, resource.error):
            self.skipTest('couldnt raise fd limit high enough')
        fd = 0
        socks = []
        while fd < 4000:
            sock = create_tcp_socket(socket)
            fd = sock.fileno()
            socks.append(sock)
        h = self._makeOne()
        h.start()
        h.select(socks, [], [])
        with pytest.raises(ValueError):
            h._select(socks, [], [])
        h._epoll_select(socks, [], [])
        h.stop()
Exemplo n.º 2
0
    def test_huge_file_descriptor(self):
        import resource
        from eventlet.green import socket
        from kazoo.handlers.utils import create_tcp_socket

        try:
            resource.setrlimit(resource.RLIMIT_NOFILE, (4096, 4096))
        except (ValueError, resource.error):
            self.skipTest('couldnt raise fd limit high enough')
        fd = 0
        socks = []
        while fd < 4000:
            sock = create_tcp_socket(socket)
            fd = sock.fileno()
            socks.append(sock)
        with start_stop_one() as h:
            h.start()
            h.select(socks, [], [], 0)
            h.stop()
        for sock in socks:
            sock.close()
Exemplo n.º 3
0
 def test_huge_file_descriptor(self):
     import resource
     from gevent import socket
     from kazoo.handlers.utils import create_tcp_socket
     try:
         resource.setrlimit(resource.RLIMIT_NOFILE, (4096, 4096))
     except (ValueError, resource.error):
         self.skipTest('couldnt raise fd limit high enough')
     fd = 0
     socks = []
     while fd < 2000:
         sock = create_tcp_socket(socket)
         fd = sock.fileno()
         socks.append(sock)
     h = self._makeOne()
     h.start()
     h.select(socks, [], [])
     with self.assertRaises(ValueError):
       h._select(socks, [], [])
     h._poll_select(socks, [], [])
     h.stop()
Exemplo n.º 4
0
 def test_huge_file_descriptor(self):
     from kazoo.handlers.threading import _HAS_EPOLL
     if not _HAS_EPOLL:
         self.skipTest('only run on systems with epoll()')
     import resource
     import socket
     from kazoo.handlers.utils import create_tcp_socket
     try:
         resource.setrlimit(resource.RLIMIT_NOFILE, (4096, 4096))
     except (ValueError, resource.error):
         self.skipTest('couldnt raise fd limit high enough')
     fd = 0
     socks = []
     while fd < 4000:
         sock = create_tcp_socket(socket)
         fd = sock.fileno()
         socks.append(sock)
     h = self._makeOne()
     h.start()
     h.select(socks, [], [])
     with self.assertRaises(ValueError):
         h._select(socks, [], [])
     h._epoll_select(socks, [], [])
     h.stop()
Exemplo n.º 5
0
 def socket(self, *args, **kwargs):
     return utils.create_tcp_socket(socket)
Exemplo n.º 6
0
 def socket(self):
     return utils.create_tcp_socket(socket)
Exemplo n.º 7
0
 def socket(self):
     return create_tcp_socket(socket)
Exemplo n.º 8
0
 def socket(self, *args, **kwargs):
     return utils.create_tcp_socket(socket)
Exemplo n.º 9
0
 def socket(self):
     return utils.create_tcp_socket(socket)
 def socket(self):
     return create_tcp_socket(socket)