Registered Member
|
'morning all,
I would like to understand how network information is cached in KDE. I am running OpenSUSE 11.0, with KDE 4.1, on a Lenovo X61 tablet. I notice that some caching seems to take place as I move my laptop between networks, something which I probably do at least 3 or 4 times most days. The caching becomes more apparent as I move the laptop between different kinds of networks; for example, if I move from my home 802.11g WLAN, to work's physical ethernet LAN, to my local carrier's 3G wireless Internet network. The symptoms which lead me to think that network information is being cached in some way include the following: 1) When moving to and from my WLAN, attempted connections will sometimes fail when I use knetworkmanager. When I select the WLAN and attempt to connect, I see a swag of information which seems to indicate that knetworkmanager is looking up some kind of cache/hash table, in an attempt to reuse the old 802.11g session. I'm at work at the moment, but when I get home tonight I'll collect the actual output and add it to this thread, in case that helps. The only way to get knetworkmanager to connect successfully to the WLAN is to log out, then log back in again. I guess logging in and out clears some cache info somewhere, but I have no idea where. I have tried lots of things to try to get knetworkmanager to forget the old LAN (wireless and physical) settings and start afresh, but without success. Restarting knetworkmanager, /etc/init.d/network restart, set knetworkmanager to work offline-then-online or disable-then-re-enable an interface.... all fail. Only log-out then log-in will work. Interestingly, kinternet does not suffer from this problem, and I have taken to using it in preference to knetworkmanager as a result. With kinternet, I can easily hang-up one interface then connect to another, many times a day, without hassle. Still though, I'd like to understand why I don't get the same success with knetworkmanager. - I use kmail to connect to our corporate mail server. When at work, the mail server is on an internal IP address, but from home, I use an Internet-routable address. The kmail config remains the same (connecting to 'mail.mywork.com'), but I have a script that updates /etc/hosts depending on which LAN I am connected to. The script works fine and I can test connections to the mail server from the command line, from either LAN. However, kmail seems to get the hostname-address mapping stuck in its head somewhere, and the only way to get it to re-read /etc/hosts is to shut it down and restart it. I've tried setting kmail to work off-line, then on-line again, done the network resets as described above... all fail. Only restarting kmail will work. Please let me know if I can do any other testing, or provide any other info. My lappy and I travel everywhere together and I think KDE4.1 is excellent; if I could sort out this wee caching hassle, it would remove one of the very few headaches that remain. Thanks, Tim. |
Administrator
|
KNetworkManager is very faulty unfortunately, and is going to be replaced in KDE 4 by a new Plasmoid. In the mean time, I can recommend Wicd to you, which is quite a good network manager ( KNetworkManager didn't work for me )
KMail will have a DNS cache inbuilt as part of KIO. Unfortunately this does not offer any refresh mechanism I am aware of.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered Member
|
'evening!
Thanks for your reply. I'll check out Wicd and see if its any better than kinternet (which I actually don't mind too much; it handles the 3G wireless inet modem quite well). Re your mention of KIO, that also rings a bell with the problems I was having with Knetworkmanager and the 802.11g connection. I have read that KIO is responsible for input-output in KDE, but it seems like a bit of a black-box to me. Is it intended to be manageable, or does it just "know" what's best? Thanks again, Tim. |
Administrator
|
KIO has some configuration available in System Settings, relating to proxies and timeouts. Other than that it will find the best way to do the task you ask of it.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered Member
|
Sorry to be a dope, but I don't understand what you mean by 'System Settings'. I checked YaST and searched the "gecko" menu, but I couldn't see any KIO settings. Clue please? Anyhow, I think I've done this thread to death. I'll ditch knetworkmanager and go for wicd as you suggest. Just BTW, did you build wicd from source? I could not find an RPM in my repos. Thanks for your assistance. Tim.
Last edited by timbelina on Fri Mar 06, 2009 11:55 pm, edited 1 time in total.
|
Administrator
|
OpenSUSE does not ship Wicd unfortunately, I use the packages from this build service repository:
http://download.opensuse.org/repositori ... SUSE_11.1/ Afterwards, switch to manual (ifup) networking in YaST > Network Devices, then start the Wicd service in YaST > Runlevel Manager, then run "wicd-client" using Alt + F2. I assumed you were using KDE 4, in KDE 3 you will find KIO settings in KControl ( "Personal Settings" )
Last edited by bcooksley on Sat Mar 07, 2009 3:17 am, edited 1 time in total.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered Member
|
Yep, KDE 4.0 it is. I should be able to take it from here, so I'll mark this thread as solved. Thanks again for your help. Tim.
|
Registered Member
|
'afternoon all,
I thought I had this sorted, but alas, only partially so. 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 (10.0.0.0/28) talking to our IMAP server which is on a different internal subnet (10.1.0.0/28). 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 (10.0.0.0/28). 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 (3) 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 work. 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 grateful. 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. Thanks, Tim. |
Administrator
|
The issue is likely because the IMAP KIO slave remains running, since KMail is still using it to access your mail. By closing KMail then the KIO slave is also closed.
The solution is to simply "killall kio_imap4" when you change networks, it will likely complain of problems, but trying again should succeed after that. However there shouldn't really be a problem, since the address of the IMAP server remains the same, so no new DNS lookup should be needed. The problem is therefore likely that the KIO slave has had its connection with the server "broken" and it is trying to re-establish it. Problem is, the IMAP server will reject it since the servers attempts to reconnect during the travel time will have failed and the connection would have been discarded.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered Member
|
'afternoon Ben,
Thanks for helping with the [Solved] tag. Re the kio_imap4 slave, you noted that... > However there shouldn't really be a problem, since the > address of the IMAP server remains the same, so no > new DNS lookup should be needed. I prolly wasn't clear in my description, but the address does change. For reasons that have been lost in the mists of time, the address that I use for the IMAP server when at work is an internal address (10.1.whatever) while the address I use when at home is an Internet-routable address. Having noted that, what you have written makes great sense, since how you describe the KIO slave matches the behaviour that I see when changing networks. That is further backed up by your other observation: > Problem is, the IMAP server will reject it since > the servers attempts to reconnect This does in fact happen if the WLAN drops out at home for an extended period, say 5 to 10 minutes. In that scenario, Kmail will also fail to re-establish a connection to the IMAP server, unless I repeat the steps that I use when I move from the work to the home LAN. So, once again, it sounds like you have identified the culprit! I'll give the "killall kio_imap4" a shot next time, and let you know how it goes. As an aside, you mentioned last time we discussed this that I might find KIO settings in KControl ( "Personal Settings" ). I went looking there ( 3.5.10 "release 54") but couldn't find anything related to KIO or the cache-timeout. If you have a tick, could you please double-check where the settings for the cache-timeouts can be changed or best still, turned off (if indeed that is possible). Thanks again, Tim. |
Registered Member
|
Hey Ben,
I just (can't believe that; I've been searching for months, but anyhow) found this: https://bugs.kde.org/show_bug.cgi?id=77862 Looks like I'm not alone, and you were on the money! Sadly, it looks like its a bug that might never get fixed Ah well, like I said, I'll give the "killall kio_imap4" a shot next time, and let you know how it goes. Thanks, Tim. |
Registered Member
|
Hello again!
Sadness, so much sadness Running "killall kio_imap4" does not make any difference to the caching problem; there must be a cache of DNS info somewhere else. On the latest occasion (this morning) I fixed the problem by editing the accounts in kmail, and replacing the host name with the IP address of the mail server. Interestingly, after I had read email, I then went back and re-edited the accounts, replacing the IP address with the host name again. Bzzt! Failure! The DNS info is obviously still cached somewhere in KDE's tiny little mind. Any other ideas would be most welcome. Thanks, Tim. |
Registered Member
|
Hello again,
More interesting (I hope ) information. Its now 7 hours since I swapped networks, however, KMail does not seem to have updated its DNS cache (assuming there is a cache, of course). Even now, 7 hours later, if I go back in and edit the Sending and Receiving accounts, replacing the server IP address with its host name, KMail still fails to connect. If I re-replace the host name with the IP address for both the accounts, it works. So, it seems that the problem is two-fold: - The caching mechanism is broken and automatic timeouts/updates no longer happen. Since this only happens after I suspend/resume, perhaps the problem could be somewhere deep under the hood, and perhaps not directly with KMail itself. I think this might be the case because other parts of the OS, like the iwl4965 module, sometimes break and need to be rmmod'd and modprobe'd after a suspend/resume. - I do not know of a way to manually force the cache to update, and I don't know where the cached info is stored. The only way to sort this problem out when things get bork'd like this is to log out and log back in again, so clearly the logout/login process clears/resets something, but I'll be stuffed I can figure where or what that is. Note that its not necessary to reboot the computer; just logout and log back in again. OK, so now I think about those two points more, it seems that the first point is less likely: If the problem did lie with a bork'd mod, then logging out and in again would not fix it; I'd need to manually modprobe or reboot the computer or something. So my suspicions now swing back to some local cache, or something similar, associated with my current KDE/KMail session. I think I'm happy to keep adding to this thread if my testing/bug-reporting is going to do any good, but alas, I'm not clued enough to provide a fix. Thanks, Tim. |
Administrator
|
It is possible it is not KDE, but the underlying Linux distribution, which has a dns cache. You will need to restart the "nscd" service.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered Member
|
In-ter-es-ting...
Restarting the nscd did not sort the problem. But restarting KMail *after* restarting nscd did fix it. So, first up, thanks again for the suggestion Ben. Secondly, any ideas why a KMail restart was also required? Thanks, Tim. |
Registered users: abc72656, Bing [Bot], daret, Google [Bot], lockheed, Sogou [Bot], Yahoo [Bot]