当Plone 3.3内容规则尝试发送电子邮件时,在Zope上留下线程

时间:2012-09-18 14:58:07

标签: python plone zope smtplib qmail

我正试图找到问题的根源,这导致我们的Zope实例以越来越规律的方式锁定。我已经安装了Products.signalstackLogger试图找到它的底部,当我们在Plone中定义的一个内容规则试图发送电子邮件时,它似乎正在发生。

例如:

Thread 46447504 (GET /VirtualHostBase/https/xxx.xxx.xxx:443/plone/VirtualHostRoot/news/portal_factory/News Item/news_item.2012-09-18.0763501726/edit):
  File "/home/zope/home/parts/zope2/lib/python/ZServer/PubCore/ZServerPublisher.py", line 31, in __init__
    response=b)
  File "/home/zope/home/parts/zope2/lib/python/ZPublisher/Publish.py", line 401, in publish_module
    environ, debug, request, response)
  File "/home/zope/home/parts/zope2/lib/python/ZPublisher/Publish.py", line 202, in publish_module_standard
    response = publish(request, module_name, after_list, debug=debug)
  File "/home/zope/home/parts/zope2/lib/python/ZPublisher/Publish.py", line 119, in publish
    request, bind=1)
  File "/home/zope/home/parts/zope2/lib/python/ZPublisher/mapply.py", line 88, in mapply
    if debug is not None: return debug(object,args,context)
  File "/home/zope/home/parts/zope2/lib/python/ZPublisher/Publish.py", line 42, in call_object
    result=apply(object,args) # Type s<cr> to step into published object.
  File "/home/zope/home/eggs/Plone-3.3.6-py2.4.egg/Products/CMFPlone/FactoryTool.py", line 375, in __call__
    temp_obj = tempFolder.__getitem__(id)
  File "/home/zope/home/eggs/Plone-3.3.6-py2.4.egg/Products/CMFPlone/FactoryTool.py", line 155, in __getitem__
    self.invokeFactory(id=id, type_name=type_name)
  File "/home/zope/home/eggs/Plone-3.3.6-py2.4.egg/Products/CMFPlone/PloneFolder.py", line 348, in invokeFactory
    new_id = pt.constructContent(*args, **kw)
  File "/home/zope/home/eggs/Products.CMFCore-2.1.3-py2.4.egg/Products/CMFCore/TypesTool.py", line 716, in constructContent
    ob = info.constructInstance(container, id, *args, **kw)
  File "/home/zope/home/eggs/Products.CMFCore-2.1.3-py2.4.egg/Products/CMFCore/TypesTool.py", line 276, in constructInstance
    ob = self._constructInstance(container, id, *args, **kw)
  File "/home/zope/home/eggs/Products.CMFCore-2.1.3-py2.4.egg/Products/CMFCore/TypesTool.py", line 450, in _constructInstance
    newid = m(id, *args, **kw)
  File "<string>", line 7, in addATNewsItem
  File "/home/zope/home/parts/zope2/lib/python/OFS/ObjectManager.py", line 349, in _setObject
    notifyContainerModified(self)
  File "/home/zope/home/parts/zope2/lib/python/zope/app/container/contained.py", line 365, in notifyContainerModified
    notify(ContainerModifiedEvent(object, *descriptions))
  File "/home/zope/home/parts/zope2/lib/python/zope/event/__init__.py", line 23, in notify
    subscriber(event)
  File "/home/zope/home/parts/zope2/lib/python/zope/component/event.py", line 26, in dispatch
    for ignored in zope.component.subscribers(event, None):
  File "/home/zope/home/parts/zope2/lib/python/zope/component/_api.py", line 130, in subscribers
    return sitemanager.subscribers(objects, interface)
  File "/home/zope/home/parts/zope2/lib/python/zope/component/registry.py", line 290, in subscribers
    return self.adapters.subscribers(objects, provided)
  File "/home/zope/home/parts/zope2/lib/python/zope/interface/adapter.py", line 535, in subscribers
    subscription(*objects)
  File "/home/zope/home/eggs/plone.app.contentrules-1.1.7-py2.4.egg/plone/app/contentrules/handlers.py", line 174, in modified
    execute(aq_parent(aq_inner(event.object)), event)
  File "/home/zope/home/eggs/plone.app.contentrules-1.1.7-py2.4.egg/plone/app/contentrules/handlers.py", line 97, in execute
    executor(event, bubbled=True, rule_filter=rule_filter)
  File "/home/zope/home/eggs/plone.contentrules-1.1.0-py2.4.egg/plone/contentrules/engine/executor.py", line 27, in __call__
    executable()
  File "/home/zope/home/eggs/plone.contentrules-1.1.0-py2.4.egg/plone/contentrules/rule/rule.py", line 48, in __call__
    if not executable():
  File "/home/zope/home/eggs/plone.app.contentrules-1.1.7-py2.4.egg/plone/app/contentrules/actions/mail.py", line 103, in __call__
    From=source)
  File "/home/zope/home/eggs/Products.SecureMailHost-1.1.2-py2.4.egg/Products/SecureMailHost/SecureMailHost.py", line 246, in secureSend
    return self._send(mfrom, all_recipients, msg, debug=debug)
  File "/home/zope/home/eggs/Products.SecureMailHost-1.1.2-py2.4.egg/Products/SecureMailHost/SecureMailHost.py", line 276, in _send
    mail.send()
  File "/home/zope/home/eggs/Products.SecureMailHost-1.1.2-py2.4.egg/Products/SecureMailHost/mail.py", line 102, in send
    smtpserver = smtplib.SMTP(self.host, self.port)
  File "/usr/local/lib/python2.4/smtplib.py", line 244, in __init__
    (code, msg) = self.connect(host, port)
  File "/usr/local/lib/python2.4/smtplib.py", line 311, in connect
    (code, msg) = self.getreply()
  File "/usr/local/lib/python2.4/smtplib.py", line 352, in getreply
    line = self.file.readline()
  File "/usr/local/lib/python2.4/socket.py", line 332, in readline
    data = self._sock.recv(self._rbufsize)

这些通知通常无问题(每天发送许多电子邮件),并且已配置好12个月以上,问题仅在过去2个月内出现。解决问题的唯一主要变化是从Apache负载均衡器切换到Haproxy

我们正在使用:

  • 的Linux
  • 本地qmail服务器(localhost:25)
  • Python 2.4.6
  • Plone 3.3.6

1 个答案:

答案 0 :(得分:1)

这似乎是我们的qmail服务器达到其外部连接限制的结果。我们已将此配置为30和一个IP(可能是一个spambot)占用了其中的20个。

我们的Zope实例通过qmail在同一个虚拟服务器上发送电子邮件,但这也是我们面向外部的邮件服务器。一旦达到连接限制,似乎来自smtplib的连接尝试将等待而没有超时。

目前我已经关闭了有问题的内容规则。从长远来看,我们可能patch ucspi-tcp通过IP限制连接,并切换到使用单独的邮件服务器进行本地和外部电子邮件。