I have narrowed it down to the select_and_accept function in serverchild.c
I can get the daemon to work just fine when I comment out the setting
and the unsetting of the O_NONBLOCK flags on the connection.
I'll see If I can figure out what the problem is. man 2 accept show that
the O_NONBLOCK flag will be inheirited so perhaps its already set and we
are unsetting it and resetting it (backwards). 2.1.6 did not even have
this function - it just accept()'ed the connection and moved on.
If I am reading this right - the reason we are playing with the flag is
to avoid having a child getting stuck on an accept block when someone
connects and then disconnects the tcp connection before a child has
accpeted the conn. So this is to prevent DOS for the most part.
-Jon
Jonathan Feally wrote:
Hello,
I have a FreeBSD box that is already running dbmail 2.1.x against a
mysql db - client and server is 5.0.21.
I am trying to get it up to 2.2.0 rc2 with libSieve - and I can
compile it just fine.
The daemon starts. And all looks good in the logs.
When I try to connect to the imap server it goes boom.
Launching daemon
Nov 11 14:16:53 hammer01 dbmail/imap4d[52325]: Debug:[serverparent]
serverparent.c,LoadServerConfig(+236): server will create [1] children
Nov 11 14:16:53 hammer01 dbmail/imap4d[52325]: Debug:[serverparent]
serverparent.c,LoadServerConfig(+249): children will make max. [10000]
connections
Nov 11 14:16:53 hammer01 dbmail/imap4d[52325]: Debug:[serverparent]
serverparent.c,LoadServerConfig(+262): timeout [4500] seconds
Nov 11 14:16:53 hammer01 dbmail/imap4d[52325]: Debug:[serverparent]
serverparent.c,LoadServerConfig(+267): no value for SOCKET in config file
Nov 11 14:16:53 hammer01 dbmail/imap4d[52325]: Debug:[serverparent]
serverparent.c,LoadServerConfig(+270): socket []
Nov 11 14:16:53 hammer01 dbmail/imap4d[52325]: Debug:[serverparent]
serverparent.c,LoadServerConfig(+282): binding to PORT [143]
Nov 11 14:16:53 hammer01 dbmail/imap4d[52325]: Debug:[serverparent]
serverparent.c,LoadServerConfig(+298): binding to IP [x.x.x.x]
Nov 11 14:16:53 hammer01 dbmail/imap4d[52325]: Debug:[serverparent]
serverparent.c,LoadServerConfig(+305): no value for BACKLOG in config
file. Using default value [16]
Nov 11 14:16:53 hammer01 dbmail/imap4d[52325]: Debug:[serverparent]
serverparent.c,LoadServerConfig(+319): resolving client IP
Nov 11 14:16:53 hammer01 dbmail/imap4d[52325]: Debug:[serverparent]
serverparent.c,LoadServerConfig(+333): Disabling IMAP-before-SMTP
Nov 11 14:16:53 hammer01 dbmail/imap4d[52325]: Debug:[serverparent]
serverparent.c,LoadServerConfig(+345): effective user shall be [nobody]
Nov 11 14:16:53 hammer01 dbmail/imap4d[52325]: Debug:[serverparent]
serverparent.c,LoadServerConfig(+357): effective group shall be [nogroup]
Nov 11 14:16:53 hammer01 dbmail/imap4d[52325]: Debug:[serverparent]
serverparent.c,LoadServerConfig(+369): will maintain minimum of [1]
spare children in reserve
Nov 11 14:16:53 hammer01 dbmail/imap4d[52325]: Debug:[serverparent]
serverparent.c,LoadServerConfig(+381): will maintain maximum of [1]
spare children in reserve
Nov 11 14:16:53 hammer01 dbmail/imap4d[52325]: Debug:[serverparent]
serverparent.c,LoadServerConfig(+393): will allow maximum of [1] children
Nov 11 14:16:53 hammer01 dbmail/imap4d[52327]: Debug:[server]
server.c,server_daemonize(+198): sid: [52326]
Nov 11 14:16:53 hammer01 dbmail/imap4d[52327]: Debug:[server]
pool.c,statefile_create(+589): Creating scoreboard at
[/var/run/dbmail-imapd.state].
Nov 11 14:16:53 hammer01 dbmail/imap4d[52327]: Debug:[server]
server.c,dm_socket(+334): done
Nov 11 14:16:53 hammer01 dbmail/imap4d[52327]: Debug:[server]
server.c,create_inet_socket(+404): creating socket on [x.x.x.x:143]
with backlog [16]
Nov 11 14:16:53 hammer01 dbmail/imap4d[52327]: Debug:[server]
server.c,dm_bind_and_listen(+354): done
Nov 11 14:16:53 hammer01 dbmail/imap4d[52328]: Debug:[db]
dbmodule.c,db_load_driver(+67): looking for mysql as
modules/.libs/libmysql.so
Nov 11 14:16:53 hammer01 dbmail/imap4d[52328]: Info:[db]
dbmodule.c,db_load_driver(+71): cannot load Cannot open
"modules/.libs/libmysql.so"
Nov 11 14:16:54 hammer01 dbmail/imap4d[52328]: Debug:[db]
dbmodule.c,db_load_driver(+67): looking for mysql as
/usr/local/lib/dbmail/libmysql.so
Nov 11 14:16:54 hammer01 dbmail/imap4d[52328]: Debug:[sql]
dbmysql.c,db_query(+286): query [SHOW VARIABLES LIKE 'collation_%']
Nov 11 14:16:54 hammer01 dbmail/imap4d[52328]: Debug:[sql]
dbmysql.c,db_mysql_check_collations(+116): does
[collation_database:latin1_swedish_ci] match
[collation_connection:latin1_swedish_ci]?
Nov 11 14:16:54 hammer01 dbmail/imap4d[52328]: Debug:[sql]
dbmysql.c,db_query(+286): query [SELECT 1=1 FROM dbmail_physmessage
LIMIT 1 OFFSET 0]
Nov 11 14:16:54 hammer01 dbmail/imap4d[52328]: Debug:[sql]
dbmysql.c,db_query(+286): query [SELECT 1=1 FROM dbmail_headervalue
LIMIT 1 OFFSET 0]
Nov 11 14:16:54 hammer01 dbmail/imap4d[52328]: Debug:[sql]
dbmysql.c,db_query(+286): query [SELECT 1=1 FROM dbmail_envelope LIMIT
1 OFFSET 0]
Nov 11 14:16:54 hammer01 dbmail/imap4d[52329]: Message:[server]
pool.c,child_register(+294): register child [52329]
Nov 11 14:16:54 hammer01 dbmail/imap4d[52329]: Info:[server]
pool.c,child_register(+319): initializing child_state [52329] using
slot [0]
Nov 11 14:16:54 hammer01 dbmail/imap4d[52329]: Info:[serverchild]
serverchild.c,CreateChild(+194): signal handler placed, going to
perform task now
Nov 11 14:16:54 hammer01 dbmail/imap4d[52329]: Debug:[db]
dbmodule.c,db_load_driver(+67): looking for mysql as
modules/.libs/libmysql.so
Nov 11 14:16:54 hammer01 dbmail/imap4d[52329]: Info:[db]
dbmodule.c,db_load_driver(+71): cannot load Cannot open
"modules/.libs/libmysql.so"
Nov 11 14:16:54 hammer01 dbmail/imap4d[52329]: Debug:[db]
dbmodule.c,db_load_driver(+67): looking for mysql as
/usr/local/lib/dbmail/libmysql.so
Nov 11 14:16:54 hammer01 dbmail/imap4d[52329]: Debug:[sql]
dbmysql.c,db_query(+286): query [SHOW VARIABLES LIKE 'collation_%']
Nov 11 14:16:54 hammer01 dbmail/imap4d[52329]: Debug:[sql]
dbmysql.c,db_mysql_check_collations(+116): does
[collation_database:latin1_swedish_ci] match
[collation_connection:latin1_swedish_ci]?
Nov 11 14:16:54 hammer01 dbmail/imap4d[52329]: Debug:[auth]
authmodule.c,auth_load_driver(+63): looking for auth_sql as
modules/.libs/libauth_sql.so
Nov 11 14:16:54 hammer01 dbmail/imap4d[52329]: Info:[auth]
authmodule.c,auth_load_driver(+67): cannot load Cannot open
"modules/.libs/libauth_sql.so"
Nov 11 14:16:54 hammer01 dbmail/imap4d[52329]: Debug:[auth]
authmodule.c,auth_load_driver(+63): looking for auth_sql as
/usr/local/lib/dbmail/libauth_sql.so
Nov 11 14:16:54 hammer01 dbmail/imap4d[52329]: Info:[serverchild]
serverchild.c,select_and_accept(+223): waiting for connection
Nov 11 14:16:54 hammer01 dbmail/imap4d[52328]: Message:[server]
pool.c,scoreboard_state(+527): Scoreboard state: children [1/1],
spares [1 (1 - 1)]
Nov 11 14:16:54 hammer01 dbmail/imap4d[52328]: Debug:[server]
server.c,StartServer(+131): starting main service loop
When trying to connect to the imap server dbmail.err shows:
Info:[serverchild] serverchild.c,select_and_accept(+255): received
connection
Info:[serverchild] serverchild.c,select_and_accept(+282): connection
accepted
Message:[serverchild] serverchild.c,PerformChildTask(+346): incoming
connection from [y.y.y.y (host.domain.com)] by pid [52329]
Debug:[serverchild] serverchild.c,PerformChildTask(+372): client info
init complete, calling client handler
Debug:[imapsession]
dbmail-imapsession.c,dbmail_imap_session_printf(+1301): RESPONSE: [*
OK dbmail imap (protocol version 4r1) server 2.2 ready to run
]
Debug:[imapsession]
dbmail-imapsession.c,dbmail_imap_session_printf(+1301): RESPONSE: [*
BYE error reading command
]
Debug:[serverchild] serverchild.c,PerformChildTask(+377): client
handling complete, closing streams
Info:[serverchild] serverchild.c,PerformChildTask(+379): connection
closed
Info:[serverchild] serverchild.c,select_and_accept(+223): waiting for
connection
While the telnet session shows
* OK dbmail imap (protocol version 4r1) server 2.2 ready to run
* BYE error reading command
Connection to host lost.
POP3 does similar thing with showing banner and closing connection.
Anybody have a clue on this?
I have tried it with out libsieve as well. But made no difference.
-Jon
_______________________________________________
DBmail mailing list
[email protected]
https://mailman.fastxs.nl/mailman/listinfo/dbmail