This sounds like it might be a file descriptor leak. Your tests might
be opening sockets and not closing them, which would cause problems
once you hit the file descriptor limit, which is relatively low by
default on many platforms. Try increasing the limit by running "uname
-n 10000" before running your tests (if you're on linux and the OS
won't let you, try increasing the settings in
/etc/security/limits.conf). If that works, then you're running out of
file descriptors. Once you've confirmed the problem, a better
long-term solution is to ensure that you're closing all the file
descriptors you're opening. This includes sockets and regular files,
as well as other file descriptors created by IOLoop and
AsyncHTTPClient (could you be forgetting to call super.tearDown() in
your tests?).
-Ben
On Thu, Oct 4, 2012 at 5:50 PM, Daniel Kador <
d...@keen.io> wrote:
> Hi!
>
> I'm running into (what I perceive to be) a strange problem with my tests.
> I've got an application written on top of Tornado that communicates with
> Mongo through the Motor library. It's humming away nicely in production
> (daemonized using supervisord). The only problems (that I can detect) are
> with my tests. I'm very happy to acknowledge that this could be a problem
> in my application layer, or in the Motor layer, or maybe even in MongoDB
> itself - mostly I'm looking for some guidance as I'm not really sure where
> to start digging in.
>
> But let me step back and describe what I've noticed in more detail.
>
> I have approximately ~150 tests that extend the
> tornado.testing.AsyncHTTPTestCase class, spread across a number of my own
> classes. I have ~50 that are simple unit tests. They both communicate to
> Mongo through Motor. The unit tests are fast and never fail (I mention this
> only as a data point that may show Motor by itself may not be the culprit).
> The AsyncHTTPTestCase tests all pass when their various test classes are run
> individually.
>
> But when I run them all together, after about ~65 tests running and passing,
> I start getting timeouts in various spots. Sometimes it's when interacting
> directly with Motor. Sometimes it's when making an async HTTP request to
> one of the APIs I've created (which, under the covers, is talking to Mongo
> through Motor). But it's always when calling (from a test) self.wait().
>
> It's getting to be a serious problem, as now I can't actually run all my
> tests locally (at one time). Obviously not a recipe for test-driven
> development success.
>
> I'm relatively sure I've done something stupid, but I haven't figured out
> where yet. Would really appreciate some help here.
>
> Thanks!
>
> -Dan