[Twisted-Python] Maximum number of SSL connections to the server
Hi all, I am doing load testing on my twisted SSL server. I spawn threads(~2000) from the application and each thread will act as a SSL client and connect to the server. Client code is straight forward. It creates a socket, does SSL wrap and connects to the server. Once all threads connect to the server, every thread closes its socket. During my initial tests, I found that after 245 successful connections, all remaining threads started to fail with this error on the client side. *SSLError: [Errno 8] _ssl.c:503: EOF occurred in violation of protocol* Then I figured out that its an issue with number of open files which was by default - 256. I changed the limit for server and client to 1. It successfully completed the 500 connections test. Now it fails after 1010 successful connections. I checked the number of open files of the server process it remains at 1010 and there are no stale open files. Client shows the same error *SSLError: [Errno 8] _ssl.c:503: EOF occurred in violation of protocol* Twisted logs on the server shows that it connects first and then disconnects with this error. *127.0.0.1:5549 http://127.0.0.1:5549 connected* *127.0.0.1:55249 http://127.0.0.1:55249 lost connection: [('SSL routines', 'SSL23_READ', 'ssl handshake failure')]* How can I fix this ? How should I approach to debug ? Thanks -Sumanth ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Re: [Twisted-Python] Maximum number of SSL connections to the server
Am Montag, 13. Januar 2014, 18:58:01 schrieb Sumanth Puram: Now it fails after 1010 successful connections which limit did you raise? Per process or systemwide? 1010 sound like you have a limit of 1024 somewhere -- Wolfgang ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Re: [Twisted-Python] Maximum number of SSL connections to the server
Hi Sumanth, Still sounds like an open file problem. What platform? How did you set the number of files higher that 256? Take a look at /etc/security/limits.conf :-) cheers lvh ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Re: [Twisted-Python] Maximum number of SSL connections to the server
Yes, 1010 looks more like a 1024 limit. I am using a Mac OSX 10.8. I have set the limit with 'ulimit -n 1' for the current shell where I was running the server and the same for client. I have tried to increase the limit for number of files, but could not find any other way than this. sumanth$ ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited file size (blocks, -f) unlimited max locked memory (kbytes, -l) unlimited max memory size (kbytes, -m) unlimited open files (-n) 1 pipe size(512 bytes, -p) 1 stack size (kbytes, -s) 65532 cpu time (seconds, -t) unlimited max user processes (-u) 709 virtual memory (kbytes, -v) unlimited On Mon, Jan 13, 2014 at 7:18 PM, Laurens Van Houtven _...@lvh.io wrote: Hi Sumanth, Still sounds like an open file problem. What platform? How did you set the number of files higher that 256? Take a look at /etc/security/limits.conf :-) cheers lvh ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Re: [Twisted-Python] Maximum number of SSL connections to the server
Hi Sumanth, You probably want to look at the limits launchd is imposing. Consider: launchctl limit maxfiles 5000 5000 You can make this permanent by pumping that line (minus launchctl) into /etc/launchd.conf. hth lvh ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Re: [Twisted-Python] Maximum number of SSL connections to the server
On 01:28 pm, spu...@kiwiup.com wrote: Hi all, I am doing load testing on my twisted SSL server. I spawn threads(~2000) from the application and each thread will act as a SSL client and connect to the server. [snip] Now it fails after 1010 successful connections. I checked the number of open files of the server process it remains at 1010 and there are no stale open files. select() has a hard limit that is often 1024. Make sure you're not using the select()-based reactor (which I think is probably the default on OS X). Jean-Paul Client shows the same error *SSLError: [Errno 8] _ssl.c:503: EOF occurred in violation of protocol* Twisted logs on the server shows that it connects first and then disconnects with this error. *127.0.0.1:5549 http://127.0.0.1:5549 connected* *127.0.0.1:55249 http://127.0.0.1:55249 lost connection: [('SSL routines', 'SSL23_READ', 'ssl handshake failure')]* How can I fix this ? How should I approach to debug ? Thanks -Sumanth ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Re: [Twisted-Python] Maximum number of SSL connections to the server
On Mon, Jan 13, 2014 at 3:19 PM, exar...@twistedmatrix.com wrote: select() has a hard limit that is often 1024. Make sure you're not using the select()-based reactor (which I think is probably the default on OS X). Jean-Paul What is the A-grade reactor on OS X? I thought it was cfreactor, but the docs appear to brand it as a GUI reactor (that doesn't mean it can't be better than select, of course); perhaps it's kqueuereactor but I hear kqueue is kind of gimpy on OS X compared to FreeBSD (but I have no idea what that actually entails). cheers lvh ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Re: [Twisted-Python] Exit all threads upon KeyboardInterrupt
On Jan 12, 2014, at 4:42 PM, johnnadre johnna...@zoho.com wrote: On Sun, 12 Jan 2014 14:03:24 -0800 exar...@twistedmatrix.com wrote On 09:01 pm, johnna...@zoho.com wrote: Hi, I want to exit my application immediately when CTRL+C is pressed, however reactor hangs when there are running threads. Some of these threads have blocking I/O, so I can't simply set a variable or wait for them to terminate. An example application would be: Python threads (being plain old operating systems; for example, POSIX threads) aren't generally interruptable. You could try exiting the entire process using `os._exit`. Well, there's always pthread_kill, now exposed as os.pthread_kill on Python 3.3, but ... don't do that. Nothing good will come of it. This is the case whether you're using Twisted or not. Thanks! That's exactly what I was looking for. If you need to use os._exit, your application probably has a bug :-). (Not to say you should never use it, but any time you use it you should be simultaneously looking into why you need to.) -glyph smime.p7s Description: S/MIME cryptographic signature ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
Re: [Twisted-Python] Maximum number of SSL connections to the server
On Jan 13, 2014, at 6:22 AM, Laurens Van Houtven _...@lvh.io wrote: On Mon, Jan 13, 2014 at 3:19 PM, exar...@twistedmatrix.com wrote: select() has a hard limit that is often 1024. Make sure you're not using the select()-based reactor (which I think is probably the default on OS X). Jean-Paul What is the A-grade reactor on OS X? I thought it was cfreactor, but the docs appear to brand it as a GUI reactor (that doesn't mean it can't be better than select, of course); perhaps it's kqueuereactor but I hear kqueue is kind of gimpy on OS X compared to FreeBSD (but I have no idea what that actually entails). Actually, by default, cfreactor doesn't even support a GUI; you need to specifically install a different main loop (as the docs explain, install(runner=PyObjCTools.AppHelper.runEventLoop)) in order to integrate with a GUI. The reason the docs brand it as such is that you cannot have an OS X GUI cooperate with your Twisted main loop using a different reactor. KQueue's gimpiness is entirely to do with deficiencies in its behavior with regard to weird file descriptor types, mostly PTYs. (I've seen some people talking about difficulties with pipes, but I've never had an issue with them personally; I don't know what that's about.) If all you need to do is talk to a lot of sockets, KQueue is just fine. -glyph smime.p7s Description: S/MIME cryptographic signature ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python