1

Topic: Sieve Problem

Hi all,

Our customer reports, the roundcube filtering function reports error.  But after restart the service, it resume normal. 

But during we restart the service, we found many process cannot stop.  After we manually kill the service, the pysieved service can start up.  But according to this issue, will it related to the below configure?  Or it should have another way to solve this issue?  Please advice.  Thanks.


http://groups.google.com/group/iredmail … 1fceeca271

Regards,
James

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Sieve Problem

[root@2 spamassassin]# /etc/rhcs-init.d/pysieved restart
Stopping pysieved:                                         [  OK  ]
Starting pysieved:Traceback (most recent call last):
  File "/usr/sbin/pysieved", line 173, in ?
    main()
  File "/usr/sbin/pysieved", line 165, in main
    s = Server((addr, port), handler)
  File "/usr/lib64/python2.4/SocketServer.py", line 361, in __init__
    self.server_bind()
  File "/usr/lib64/python2.4/SocketServer.py", line 372, in server_bind
    self.socket.bind(self.server_address)
  File "<string>", line 1, in bind
socket.error: (98, 'Address already in use')
                                                           [FAILED]
[root@2 spamassassin]# ps -ef|grep sieve
vmail      468     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail     1158     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail     1313     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail     1784     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail     3516     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail     5982     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail     6413     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail     6908     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail     7152     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail     7281     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail     7333     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail     7420     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail    11503     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail    12091     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail    12152     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
root     13341 10166  0 01:02 pts/0    00:00:00 grep sieve
vmail    13730     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail    13961     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail    14899     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail    16456     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail    17513     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail    18087     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail    18324     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail    19588     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail    19867     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail    20129     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail    21364     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail    21864     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail    22021     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail    22805     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail    23204     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail    23437     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail    25205     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail    27662     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail    28414     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail    28459     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail    28998     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail    29296     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail    29395     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail    30592     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
vmail    31561     1  0 Oct07 ?        00:00:00 python /usr/sbin/pysieved -c /etc/pysieved.ini
[root@2 spamassassin]# ps -ef|grep pysieve |awk '{print $2}'
468
1158
1313
1784
3516
5982
6413
6908
7152
7281
7333
7420
11503
12091
12152
13730
13789
13961
14899
16456
17513
18087
18324
19588
19867
20129
21364
21864
22021
22805
23204
23437
25205
27662
28414
28459
28998
29296
29395
30592
31561
[root@2 spamassassin]# ps -ef|grep pysieve |awk '{print $2}' > /tmp/clean
[root@2 spamassassin]# vi /tmp/clean
[root@2 spamassassin]# /tmp/clean
/tmp/clean: line 17: kill: (13929) - No such process
[root@2 spamassassin]# /etc/rhcs-init.d/pysieved restart
pysieved is already stopped.                               [  OK  ]
Starting pysieved:                                         [  OK  ]
[root@2 spamassassin]#



Please find the problem capture in above.  Thanks.

3

Re: Sieve Problem

After I follow the xinetd way to create the sieve service.  It doesn't work.  When I telnet to the localhost 2000 port, it returns below error messages.

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Traceback (most recent call last):
  File "/usr/sbin/pysieved", line 173, in ?
    main()
  File "/usr/sbin/pysieved", line 109, in main
    store = storage.new(log, config)
  File "/usr/lib/python2.4/site-packages/pysieved/plugins/__init__.py", line 28, in __init__
    self.init(config)
  File "/usr/lib/python2.4/site-packages/pysieved/plugins/dovecot.py", line 191, in init
    self.uid = config.getint('Dovecot', 'uid', None)
  File "/usr/lib/python2.4/site-packages/pysieved/config.py", line 46, in getint
    raise KeyError("Must specify %s in section %s in config file" %
KeyError: 'Must specify uid in section Dovecot in config file'
Connection closed by foreign host.

4

Re: Sieve Problem

There's a section "[Dovecot]" in /etc/pysieved.ini, and you should set "uid" and "gid" in it:

[Dovecot]
...
uid = 500
gid = 500

Here, uid and gid are uid/gid of vmail user. You can get it with commands:

# id -u vmail
# id -g vmail

5

Re: Sieve Problem

I have checked the configure file and uid/gid.  It configured correctly but still getting the same problem.

# Community: http://www.iredmail.org/community.html
#

[main]
# Authentication back-end to use
auth    = Dovecot

# User DB back-end to use
userdb  = Virtual

# Storage back-end to use
storage = Dovecot

# Bind to what address?  (Ignored with --stdin)
#bindaddr = 127.0.0.1

# Listen on what port?  (Ignored with --stdin)
port    = 2000

# Write a pidfile here
pidfile = /var/run/pysieved/pysieved.pid

[Virtual]
# Append username to this for home directories
base = /var/vmail/sieve

# What UID and GID should own all files?  -1 to not bother
uid = 503
gid = 503

# Switch user@host.name to host.name/user?
hostdirs = True

[Dovecot]
# How do we identify ourself to Dovecot? Default is 'pysieved'.
service = managesieve

# Path to Dovecot's auth socket (do not set unless you're using
# Dovecot auth)
mux = /var/spool/postfix/dovecot-auth

# Path to Dovecot's master socket (if using Dovecot userdb lookup)
master = /var/run/dovecot/auth-master

# Path to sievec
sievec = /usr/libexec/dovecot/sievec

# Where in user directory to store scripts.
scripts = .

# Filename used for the active SIEVE filter (see README.Dovecot)
active = dovecot.sieve

# What user/group owns the mail storage (-1 to never setuid/setgid)
uid = 503
gid = 503


The id of vmail group and user are correct (503)

6

Re: Sieve Problem

I tested on local VM, and found the root cause.

What's the value of "user" and "group" in xinetd config file? is it "vmail"? If so, you should change file owner of /etc/pysieved.ini to vmail. This fixes your issue.

7

Re: Sieve Problem

service sieve
        {
                disable         = no
                socket_type     = stream
                wait            = no
                user            = vmail
                group           = vmail
                server          = /usr/sbin/pysieved
                server_args     = --inetd --config /etc/pysieved.ini
                umask           = 002
                log_on_failure  += USERID
        }

8

Re: Sieve Problem

Did you change file permission of /etc/pysieved.ini? does it work?

9

Re: Sieve Problem

yes, but once I stopped the pysieved, and try to start xinetd.   the webmail seems stopped.  So I need to test it tonite to prevent downtime.  I will update you after test

(previously, /etc/pysieved.ini's permission is mail:mail)

10

Re: Sieve Problem

The xinetd seems ok when using telnet to local port 2000.  But the webmail and the iredadmin doesn't work after pysieved stopped.

11

Re: Sieve Problem

What do you mean "webmail and iredadmin don't work after pysieved stopped"?

iRedAdmin doesn't require pysieved, and webmail just try to use port 2000, if you have pysieved running as inetd service, it should be ok too.

12

Re: Sieve Problem

Yes, suppose it is separated.  But on my system, once pysieved stopped, all web service not work.   But once I start the pysieved again, all webmail and iredadmin page resumed.

13

Re: Sieve Problem

Does xinetd start other services?

Pysieved just listen on port 2000 (and bind to 127.0.0.1 by default), so i don't think stopping pysieved will break other services.

14

Re: Sieve Problem

The problem is fixed after change of permission, the xinetd can start without affecting the web service.  But we found, after a period to run the xinetd instead of pysieve, it will occupied mysql connections and results webmail and admin page malfunction.  (It will return database error or in admin page, too many connection.)

15

Re: Sieve Problem

Are you sure that mysql issue is caused my xinetd/pysieved?
Which component(s) will need many mysql connection/queries?

16

Re: Sieve Problem

Yes, I fixed the problem via stop xinetd.  Then I start pysieve manually.

17

Re: Sieve Problem

bongdotcom wrote:

Yes, I fixed the problem via stop xinetd.  Then I start pysieve manually.

After I move to xinetd, I experienced mysql connection busy.  To prevent this happen, need to change the my.cnf the max connection then the problem can be fully fixed (so far no users complaint these days)