mailman.client hangs accessing moderation queue

Bug #1036207 reported by Stephen Turnbull
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

Here's what I did as recorded in

steve@turnbull:~/src/Mailman3/mailman.client$ python
Python 2.7.3rc2 (default, Apr 22 2012, 22:30:17)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> import time
>>> import subprocess
>>> from mailman.client import Client
>>> c = Client('http://localhost:8001/3.0', 'restadmin', 'restpass')
>>> dump(c.system)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'dump' is not defined
>>> c.lists
[<List "<email address hidden>">]
[<Domain "">]
>>> print[0].url_host
>>> print[0].mail_host
>>> l = c.lists[0]
>>> l.fqdn_listname
<email address hidden>'
>>> c.get_list('<email address hidden>')
<List "<email address hidden>">
>>> c.get_list(<email address hidden>')
<List "<email address hidden>">
>>> c.members
[<Member "<email address hidden>" on "<email address hidden>">]
>>> print c.members[0].self_link
>>> print c.members[0].link
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: '_Member' object has no attribute 'link'
>>> print c.users[0]
<User "None" (323817100493882819169277267745120573853)>
>>> print c.users
[<User "None" (323817100493882819169277267745120573853)>]
>>> print c.users[0].addresses
<mailman.client._client._Addresses object at 0x7f6b849c7a10>
>>> print c.users[0].addresses[0]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: '_Addresses' object does not support indexing
>>> for a in print c.users[0].addresses:
  File "<stdin>", line 1
    for a in print c.users[0].addresses:
SyntaxError: invalid syntax
>>> for a in c.users[0].addresses:
... print a
<email address hidden>
>>> for a in sorted(l.settings):
... print a + ': ' + string(l.settings[a])
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
NameError: name 'string' is not defined
>>> for a in sorted(l.settings):
... print a + ': ' + str(l.settings[a])
acceptable_aliases: []
admin_immed_notify: True
admin_notify_mchanges: False
administrivia: True
advertised: True
allow_list_posts: True
anonymous_list: False
autorespond_owner: none
autorespond_postings: none
autorespond_requests: none
autoresponse_grace_period: 90d
bounces_address: <email address hidden>
collapse_alternatives: True
convert_html_to_plaintext: False
created_at: 2012-08-09T03:16:21.186456
default_member_action: defer
default_nonmember_action: hold
digest_last_sent_at: None
digest_size_threshold: 30.0
display_name: Mm3-test
filter_content: False
fqdn_listname: <email address hidden>
generic_nonmember_action: 1
http_etag: "b8b4e1df6bc8d8ee33f363927022d0bcc86569bb"
include_rfc2369_headers: True
join_address: <email address hidden>
last_post_at: None
leave_address: <email address hidden>
list_name: mm3-test
next_digest_number: 1
no_reply_address: <email address hidden>
owner_address: <email address hidden>
post_id: 1
posting_address: <email address hidden>
posting_pipeline: default-posting-pipeline
reply_goes_to_list: no_munging
request_address: <email address hidden>
scheme: http
send_welcome_message: True
volume: 1
welcome_message_uri: mailman:///welcome.txt
>>> dir()
['Client', '__builtins__', '__doc__', '__name__', '__package__', 'a', 'c', 'l', 'os', 'subprocess', 'time']
>>> dir(Client)
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'create_domain', 'delete_domain', 'delete_list', 'domains', 'get_domain', 'get_list', 'get_user', 'lists', 'members', 'preferences', 'system', 'users']
>>> dir(Client.system)
['__class__', '__delattr__', '__delete__', '__doc__', '__format__', '__get__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__set__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'deleter', 'fdel', 'fget', 'fset', 'getter', 'setter']
>>> dir(l)
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_connection', '_get_info', '_info', '_url', 'accept_message', 'defer_message', 'delete', 'discard_message', 'display_name', 'fqdn_listname', 'get_member', 'held', 'list_name', 'mail_host', 'members', 'moderate_message', 'reject_message', 'settings', 'subscribe', 'unsubscribe']
>>> l._connection.__doc__
u'A connection to the REST client.'
>>> l.held.__doc__

^CTraceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "mailman/client/", line 350, in held
    'lists/{0}/held'.format(self.fqdn_listname), None, 'GET')
  File "mailman/client/", line 114, in call
    response, content = Http().request(url, method, data, headers)
  File "/usr/lib/python2.7/dist-packages/httplib2/", line 1543, in request
    (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
  File "/usr/lib/python2.7/dist-packages/httplib2/", line 1293, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, headers)
  File "/usr/lib/python2.7/dist-packages/httplib2/", line 1263, in _conn_request
    response = conn.getresponse()
  File "/usr/lib/python2.7/", line 1030, in getresponse
  File "/usr/lib/python2.7/", line 407, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python2.7/", line 365, in _read_status
    line = self.fp.readline()
  File "/usr/lib/python2.7/", line 430, in readline
    data = recv(1)
  File "/home/steve/src/Mailman3/mailman-trunk/src/mailman/email/", l\
ine 226, in _enqueue
    virginq.enqueue(self, **str_keywords)
  File "/home/steve/src/Mailman3/mailman-trunk/src/mailman/core/"\
, line 123, in enqueue
    msgsave = cPickle.dumps(_msg, protocol)

After the above I tried a couple of things, like printing l.held (with no further attribute). These also hung for a few seconds and I interrupted with ^C.

Eventually it failed with an error about not being connected to Mailman. I thought Mailman had crashed, but when I tried shutting down Mailman using bin/mailman, it seemed to shut down normally.

Tags: mailman3
Revision history for this message
Stephen Turnbull (stephen-xemacs) wrote :
tags: added: mailman3
Barry Warsaw (barry)
no longer affects: mailman
Revision history for this message
Florian Fuchs (flo-fuchs) wrote :

Difficult to say what the cause of this could be (I could not reproduce the problem on my local machine...).

Did you take a look at mailman.log? "list.held"-requests should appear like this:

GET /<email address hidden>/held HTTP/1.1" 200

If the status is 200 there is probably something wrong inside mailman.client or httplib2.

For debugging you could also try to make the http request to the api directly without using mailman.client. It's a bit complicated from the shell though, because you have to add the auth header to the request (I'd recommend using the "requests" library for this... Makes http calls pretty painless.).

Revision history for this message
Abhilash Raj (raj-abhilash1) wrote :

This bug has been moved to the new gitlab repo here:

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.