barryp / py-amqplib

Python client for the Advanced Message Queuing Procotol (AMQP)
GNU Lesser General Public License v2.1
24 stars 10 forks source link

Misleading error message on socket open when hitting ulimit #53

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Which version of amqplib are you using? 1.0.2

Have you checked to see if there is a newer version in the "Featured
Downloads" section of the front page of this project? Yup.

Which broker are you using (RabbitMQ?) which version? RabbitMQ, 2.8.4

Which version of Python? 2.7.1

What steps will reproduce the problem?
1. Hit your max open file descriptors limit
2. Try to initialize something base on _AbstractTransport

What is the expected output? What do you see instead?

I expect to see something like: 

Traceback (most recent call last):
  File "build/bdist.macosx-10.7-intel/egg/amqplib/client_0_8/connection.py", line 129, in __init__
  File "build/bdist.macosx-10.7-intel/egg/amqplib/client_0_8/transport.py", line 282, in create_transport
  File "build/bdist.macosx-10.7-intel/egg/amqplib/client_0_8/transport.py", line 86, in __init__
error: [Errno 24] Too many open files

But I actually see something like:

  File "build/bdist.macosx-10.7-intel/egg/amqplib/client_0_8/connection.py", line 129, in __init__
  File "build/bdist.macosx-10.7-intel/egg/amqplib/client_0_8/transport.py", line 282, in create_transport
  File "build/bdist.macosx-10.7-intel/egg/amqplib/client_0_8/transport.py", line 79, in __init__
AttributeError: 'NoneType' object has no attribute 'close'

which hides the real error. 

I've attached a patch that fixes this.

Original issue reported on code.google.com by p...@triplefox.com on 23 Aug 2012 at 9:23

Attachments: