#989122 exim4: takes 10 seconds to accept connections after waking up on another network

#989122#5
Date:
2021-05-26 09:31:25 UTC
From:
To:
Package: exim4
Version: 4.94.2-5
Severity: normal

Dear Maintainer,

when I put my laptop to sleep, then wake it up on another network
(which is what happens 95% of the times that I put it to sleep),
exim takes 10 seconds to accept any connection until I restart it.

Demonstration:

hobbes@sphax:~$ date && swaks --output /dev/null --to remi@lybrafox.be --server localho>
mer 26 mai 2021 11:14:09 CEST
mer 26 mai 2021 11:14:19 CEST
hobbes@sphax:~$ sudo service exim4 restart
[sudo] Mot de passe de hobbes :
hobbes@sphax:~$ date && swaks --output /dev/null --to remi@lybrafox.be --server localho>
mer 26 mai 2021 11:14:32 CEST
mer 26 mai 2021 11:14:32 CEST

I waited a bit before doing those tests, to be sure that the laptop
was fully awake.

If I don't redirect the output to /dev/null, I can see that the delay
happens in the very early stages of the connection, before any smpt
happens.

Thanks,

#989122#10
Date:
2021-05-26 11:49:55 UTC
From:
To:
Does it send out any DNS queries in this time? Can you put an strace on
the exim process before putting the system to sleep so that we can check
where the delay originates from?

Greetings
Marc

#989122#15
Date:
2021-05-26 21:52:10 UTC
From:
To:
here comes the strace:
------------ hobbes@sphax:~$ sudo strace -p 671890 strace: Process 671890 attached select(6, [3 4 5], NULL, NULL, NULL waits here before I send the mail ) = 1 (in [5]) wait4(-1, 0x7ffd5fdf4034, WNOHANG, NULL) = -1 ECHILD (Aucun processus enfant) accept(5, {sa_family=AF_INET6, sin6_port=htons(50964), sin6_flowinfo=htonl(0), inet_pton(AF_INET6, "::1", &sin6_addr), sin6_scope_id=0}, [28]) = 6 fcntl(6, F_GETFL) = 0x2 (flags O_RDWR) dup(6) = 7 fcntl(7, F_GETFL) = 0x2 (flags O_RDWR) getsockname(6, {sa_family=AF_INET6, sin6_port=htons(25), sin6_flowinfo=htonl(0), inet_pton(AF_INET6, "::1", &sin6_addr), sin6_scope_id=0}, [28]) = 0 clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7faf36b64c50) = 706004 close(6) = 0 close(7) = 0 select(6, [3 4 5], NULL, NULL, NULL waits 10 seconds here ) = ? ERESTARTNOHAND (To be restarted if no handler) --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=706004, si_uid=104, si_status=0, si_utime=0, si_stime=1} --- rt_sigaction(SIGCHLD, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7faf372abd60}, NULL, 8) = 0 rt_sigreturn({mask=[]}) = -1 EINTR (Appel système interrompu) wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG, NULL) = 706004 wait4(-1, 0x7ffd5fdf4034, WNOHANG, NULL) = -1 ECHILD (Aucun processus enfant) rt_sigaction(SIGCHLD, {sa_handler=0x558211694c60, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7faf372abd60}, NULL, 8) = 0 select(6, [3 4 5], NULL, NULL, NULL^Cstrace: Process 671890 detached <detached ...> ---------- Tell-me if you need more info. Thanks, -- Rémi
#989122#20
Date:
2021-05-30 17:58:25 UTC
From:
To:
Is your IPv6 setup ok? Do you have ::1 on lo? Are the IPv6 specific
entries for localhost present in /etc/hosts? Is your local resolver
configured to use /etc/hosts?

Greetings
Marc

#989122#25
Date:
2021-06-01 19:55:01 UTC
From:
To:
Marc Haber <mh+debian-packages@zugschlus.de> writes:

I think so, but I'm no specialist, so see for yourself :-)

yep:

hobbes@sphax:~$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever

seems so:

hobbes@sphax:~$ grep localhost /etc/hosts
127.0.0.1	localhost
::1     localhost ip6-localhost ip6-loopback

I guess so because I do have some hosts configured in /etc/hosts and dns
resolution (for those or others) is instantaneous.

Thanks,
--
Rémi