Search This Blog

Loading...

Saturday, April 14, 2012

Bug #283105

Bug #283105 is the famous "networkmanagement's kded module crashes when opening kwallet". Today I finally reproduced it but there is no solution yet. I will need to refactor Plasma NM's secret agent to avoid the crash and other potential problems I have also found. I do not know yet when the problem will be fixed, the secret agent is a delicate part of Plasma NM, so any precaution is worth when changing something in there.

Explaining the problem further: NetworkManager uses the concept of secrets, which are the passwords and encryption keys used to establish one connection, of course, there can be connections without secrets. When NetworkManager does not have the required secrets cached it contacts any secret agent registered to it to provide those secrets. NetworkManager sorts the secret agents before trying to contact them, it tries first  the agents in the current console kit session, so now you know why console kit is a requirement for NetworkManager to work :-). As you probably figured out by now both Plasma NM and nm-applet implement secret agents.

The crash happens because of two things: 1. Plasma NM does not timeout a request for secrets, so the request is stays queued until it can be processed and it can only be processed after the kwallet is opened. 2. NetworkManager timeous requests, which is something logical to do (the timeout is about 2 minutes). Besides timing out requests NetworkManager also re-issues the request after some time (about 10 minutes) and that is our problem. When NetworkManager re-issues the request we queue it too, but did not remove the old one (now a stale request). When kwallet is finally opened Plasma NM's secret agent tries to process the stale request and the crash happens. The simple solution is removing the stale request after a timeout or when a request for the same connection comes in. I tested the latter yesterday and it works. However, the secret agent code, which was already difficult to understand, is now even more difficult to understand. I need to re-factor it to make things simpler.

In resume, to reproduce the bug you need to wait about 12-15 minutes after the kwallet's password popup appears and only then supply the password. You can see NetworkManager issuing the second secret request in its log, so you can just wait for that instead. If you supply the password within the first two minutes there will be no problem and that is probably the common case.

Although this bug is an obvious design flaw I will not put the blame on who wrote the code (it was not me, by the way). I will thank who wrote it because by the time it was pushed to Plasma NM's repo I was in a rush to fix other problems during the transition to NetworkManager 0.9. That code allowed Plasma NM to finally work with NetworkManager 0.9 and was one less problem for me to solve.

7 comments:

Anonymous said...

you useless shit

Anonymous said...

can you elaborate on what causes the problem? I am among those who do not have this problem.

Why some experience the problem and others dont?

Dave said...

@anonymous1

I don't see you fixing anything in NM...so don't say things like that.

emilsedgh said...

Lamarque, please ignore such stupid trolls. Your work is very very appreciated.

ianjo said...

As always, thanks for your work.

Connectivity in KDE has never worked so well!

Anonymous said...

Have definitively to agree with ianjo - before your remarkable effort kde connectivity was always broken for me and had to rely on wicd instead of native kde solution.

Kudos to you!

TheBlackCat said...

Boring troll is boring. This person appears to be posting this same comment on various KDE-related blogs if memory serves me.

Whatever the case, thanks again for all the work. NM works great for me.