[kdepim-users] Stop Kontact (or KDE) caching network connections.

tim belina timbelina at gmail.com
Fri Jul 24 05:09:30 BST 2009

'afternoon all,

I have noticed that Kmail (or Kontact, or KDE) caches network
connections.  It might be part of the whole ksycoca thing, but I'm not
sure.  I would like to know how to turn this caching off, or how to at
least flush the networking/connections cache in some way.

The following scenario should illustrated my motivation:

1) I'm at work on an internal subnet ( talking to our IMAP
server which is on a different internal subnet (
Connections from Kmail to the mail server (both IMAP and SMTP) both
work fine and all is well. I use Kinternet to disconnect from my work
LAN, suspend/hibernate the laptop and go home.

2) I go home and connect to my home LAN, which has the same subnet as
I use at work (  I use Kinternet to connect to my home
WLAN.  I run a script to change things like DNS server and default
route. The script also changes the /etc/hosts file so that the address
of the mail server is now that of work's external mail gateway.   I
check by pinging the mail gateway, and sure enough, the WLAN and
Internet connectivity are working fine and I can ping the gateway

3) I go back to Kmail, and click on the "Check mail" button.  Pause...
pause... "Error: Kontact.  Could not connect to host
mail.gateway.mywork.com: Unknown error".

4) I can fix this problem in one of two ways. Firstly, I can wait for
around 5 to 15 minutes and eventually Kmail, (or Kontact or KDE)
re-reads /etc/hosts or whatever, and updates its cache with the new
address information, and Kmail usually connects successfully after
that.  Secondly, I can edit the Kmail configuration and change the
server name from mail.gateway.mywork.com to its external IP address,
and Kmail will connect successfully.

Please note that (4) does not always happen. In particular, if I
disconnect from the work LAN and then shutdown Kontact before I leave,
and then establish a new network connection and restart Kontact when I
get home, then Kmail generally connects successfully, but not always.

Please also note that the problem occurs even if reverse the order of
(1) and (2) above. i.e. If I boot the laptop and use it from home, and
then disconnect, make network/hosts changes, then try to use Kmail at

Things I've tried include:
- Restarting all network services; made no difference.
- Try to find if Kontact/Kmail leaves any processes lying about that
keep sockets open, even after I kill Kontact; couldn't find any.
- Trying kbuildsyscoca; this seems to fail as the script always
responds with "Reusing existing sycoca", so I'm not sure if that is
achieving anything.
- Trying to understand dcop; sorry, I'm too thick for that :-)

Maaaaaaan, I've been fighting with this for 18 months now, but I can't
solve it.  If someone on the list can lend a hand, I would be very

The details of my system:
- Lenovo X61 laptop.
- OpenSuSE 11.0 (all up to date).
- KDE 3.1 (This also happens on KDE 4.1, but I use KDE3.1 due to some
bugs that I encounter with the Lenovo graphics card when I use xrandr
in KDE4.1).
- Kmail V1.10.3 using KDE 4.1.3 release 76.16.

KDE PIM users mailing list
kdepim-users at kde.org

More information about the kdepim-users mailing list