Hello,
we see this problem when doveadm-server is under load.
We enabled doveadm http api with this config:
service doveadm {
inet_listener {
port = 50000
}
inet_listener http {
port = 50001
ssl = no
}
}
When doveadm server receives at lot of connects on port 50000 the http service
on
port 50001 is not responding until load on port 50000 drops to zero.
It seems like doveadm-server is prefering port 50000 over 50001.
Looking into Recv-Q when http hangs
Netid State Recv-Q Send-Q Local
Address:Port Peer Address:Port
tcp LISTEN 129 128
0.0.0.0:50000 0.0.0.0:*
tcp LISTEN 1 128
0.0.0.0:50001 0.0.0.0:*
I used this script to produce load on port 50000
#!/bin/bash
for i in {1..1000}
do
echo "124" | netcat localhost 50000 &
done
wait
When this script is started it takes several seconds until a connect on port
50001 succeeds.
We are using Dovecot version 2.3.20 (bdc808f24c).
I think the problem is in src/lib/ioloop-epoll.c function
io_loop_handler_run_internal.
This might fix the problem (look for new variable rr):
void io_loop_handler_run_internal(struct ioloop *ioloop)
{
struct ioloop_handler_context *ctx = ioloop->handler_context;
struct epoll_event *events;
const struct epoll_event *event;
struct io_list *list;
struct io_file *io;
struct timeval tv;
unsigned int events_count;
int msecs, ret, i, j, k, rr;
bool call;
i_assert(ctx != NULL);
/* get the time left for next timeout task */
msecs = io_loop_run_get_wait_time(ioloop, &tv);
events = array_get_modifiable(&ctx->events, &events_count);
if (ioloop->io_files != NULL && events_count > ctx->deleted_count) {
ret = epoll_wait(ctx->epfd, events, events_count, msecs);
if (ret < 0 && errno != EINTR)
i_fatal("epoll_wait(): %m");
} else {
/* no I/Os, but we should have some timeouts.
just wait for them. */
i_assert(msecs >= 0);
i_sleep_intr_msecs(msecs);
ret = 0;
}
/* execute timeout handlers */
io_loop_handle_timeouts(ioloop);
if (!ioloop->running)
return;
rr = ret>1 ? i_rand_limit(ret) : 0;
for (k = 0; k < 2; k++) {
for (i = (k==0 ? rr : 0); i < (k==0 ? ret : rr); i++) {
/* io_loop_handle_add() may cause events array reallocation,
so we have use array_idx() */
event = array_idx(&ctx->events, i);
list = event->data.ptr;
for (j = 0; j < IOLOOP_IOLIST_IOS_PER_FD; j++) {
io = list->ios[j];
if (io == NULL)
continue;
call = FALSE;
if ((event->events & (EPOLLHUP | EPOLLERR)) != 0)
call = TRUE;
else if ((io->io.condition & IO_READ) != 0)
call = (event->events & EPOLLIN) != 0;
else if ((io->io.condition & IO_WRITE) != 0)
call = (event->events & EPOLLOUT) != 0;
else if ((io->io.condition & IO_ERROR) != 0)
call = (event->events & IO_EPOLL_ERROR) != 0;
if (call) {
io_loop_call_io(&io->io);
if (!ioloop->running)
return;
}
}
}
}
}
Thanks a lot.
Achim
https://www.tallence.com
Folgt uns auf LinkedIn <https://www.linkedin.com/company/tallence-ag> // XING
<https://www.xing.com/pages/tallenceag> // Twitter
<https://twitter.com/tallence> // Instagram
<https://www.instagram.com/tallence_ag/> // facebook
<http://www.facebook.com/Tallence>
Tallence AG // Sitz der Gesellschaft: Hamburg // Neue Gröningerstraße 13, 20457
Hamburg // Amtsgericht Hamburg HRB 142900
Vorstand: Frank Moll (Vorsitzender), Bernd Scherf // Aufsichtsrat: Wolf Ingomar
Faecks (Vorsitzender)
Die Speicherung und Verarbeitung personenbezogener Daten erfolgt entsprechend
unserer Datenschutzhinweise. <https://www.tallence.com/datenschutzhinweise>
_______________________________________________
dovecot mailing list -- [email protected]
To unsubscribe send an email to [email protected]