Miranda NG Official Community Forum

Forum for English speaking Miranda NG users => Bug reports => Topic started by: Testertime on 05 09 2015, 12:54:29

Title: False "away" status when server connection is lost
Post by: Testertime on 05 09 2015, 12:54:29
Hello! I have reported over a month ago a bug which is easily reproducible. Here is the link: http://trac.miranda-ng.org/ticket/984

It has probably to do with the plugin "KeepStatus". This is the bug: If I'm away, and one Jabber server goes down (or the connection is lost) in the meantime while my status is set to away by 5 minutes of idle time, there is a small glitch. If I'm coming back, and the connection is still lost, my status is at first "online" as it should be. But after a few seconds the status is changing back to "away" again. And I have to change it manually by hand back to "online". It becomes quite annoying after a while if there are even small connection problems.

I haven't tested if all other account types like ICQ, MSN, etc are effected by this little bug too. I hope somebody can please look into this. Thanks a lot! :)
Title: Re: False "away" status when server connection is lost
Post by: Wishmaster on 05 09 2015, 18:31:44
Can you make a Netzwerklog (http://wiki.miranda-ng.org/index.php?title=Netzwerklog)?
Maybe it logs something useful
Title: Re: False "away" status when server connection is lost
Post by: Testertime on 05 09 2015, 19:29:44
Thanks for your answer, here is the log. Hopefully it's really useful for you :) The important part where the bug occurs is probably more at the end of the log.

Originally I wrote in my bug report that it happens with two (Jabber) accounts, but I saw that it's also happening with a single (Jabber) account - it's only a little less obvious at the user interface.
Title: Re: False "away" status when server connection is lost
Post by: Wishmaster on 05 09 2015, 20:11:27
Yes, the most important parts are those "SetAwayMsg called", where wParam 40072 is online and 40073 is away. KeepStatus sets the status to away because it was away before the connection loss, and it doesn't know if away is set because of idle or not.
Title: Re: False "away" status when server connection is lost
Post by: Testertime on 05 09 2015, 21:38:22
Great to see that you found it! If you have some spare time, I hope you (or someone else) can please fix this bug somewhere in the next weeks, if possible. Thank you so much in advance! :THUMBS UP: If I had the skills, I would seriously do it by myself.
Title: Re: False "away" status when server connection is lost
Post by: Wishmaster on 05 09 2015, 21:44:13
Not sure if it is a bug. What if you are really away and you are online because of a connection loss?
people would assume that you returned and start to write you. It doesn't make sense.
Title: Re: False "away" status when server connection is lost
Post by: Testertime on 05 09 2015, 21:53:50
Not sure if it is a bug. What if you are really away and you are online because of a connection loss?

I agree with this, but it isn't the case here (and I guess I have explained it badly - sorry for the confusion). If I'm really back on my computer, Miranda would change the status back to online. But while the server is down, it will still keep my status as "away" if the server is back online, even though I'm not away anymore. It can't be intended, because this doesn't make sense. At my bug report I had linked a video, can you please take a look?

https://vimeo.com/135305217 - the important part starts at 01:05. Thanks :)
Title: Re: False "away" status when server connection is lost
Post by: Wishmaster on 05 09 2015, 22:19:36
Well, you talked about " there are even small connection problems.", and you just came back in that time?  That's a coincidence. :)
Do we have a different understanding of the word "small" here?


So what you mean is that your status has been changed in that time?
Title: Re: False "away" status when server connection is lost
Post by: Testertime on 05 09 2015, 22:43:32
Well, you talked about " there are even small connection problems.", and you just came back in that time?  That's a coincidence. :)

If for example the server (or my internet connection) is down for 10 minutes, and I was idle before and I'm coming back while the connection is down, this small time frame is still enough to trigger this bug (that it doesn't change my status back to online like it should). 10 minutes is small for me, and I already had a situation where I was away for this short amount of time, and in the meantime the connection to a Jabber server was lost. The jit.si Jabber server is sometimes down quite often, so in the long run this coincidence has a high chance.

So what you mean is that your status has been changed in that time?

No. And that is the problem. If I'm not idle anymore, it should properly change back my status to "online", but Miranda doesn't do it when even one Jabber server is unreachable. As you can see in the video, the second Jabber server is still online, and still both accounts have the false "away" status because just one was down.

In my video I have moved my mouse at 02:30 while one Jabber server is down. At first the account "tester33345" was properly changed back to "online", but then it's suddenly "away" again, because Miranda tries to reconnect to the Jabber server who is down.

Sorry again if my text sounds too confusing - I thought the video would show this already perfectly.
Title: Re: False "away" status when server connection is lost
Post by: Robyer on 06 09 2015, 18:18:28
Testertime, if I understand correctly:

1) protocol is auto-away because you are idle for x minutes (keepstatus remembers protocol is away)
2) network drops and protocol goes offline (keepstatus know that it should return it to away)
3) protocol is still down and you came back to computer and interact
4) auto away plugin react and change protocols to online
Now here is the question (and my guessing):
    a) does the auto away plugin TRY to switch status to online of these offline protocols?
       -> if so, perhaps issue of Keep status plugin, who didn't remember that you (= auto away plugin) wanted this protocol to be online now (maybe because protocol never went to this status and keep status remembers only status in which protocol was?)
    b) or does the auto away plugin IGNORE the change back to online, because protocol is offline.
       -> if it is this case, perhaps it is issue of auto away plugin

Do I understand it correctly?
Title: Re:False "away" status when server connection is lost
Post by: White-Tiger on 07 09 2015, 09:29:19
I'm for "b)"
"a)" doesn't make much sense here.. If you manually set the status to offline while keep status is trying to "reconnect", it'll accept the offline status and says "status set successfully" as a response. Job done...

So KeepStatus actually uses the last set, last tried status (at least it usually does and is a bug otherwise)

Also, Testertime mentioned that not only the protocol that went offline had a wrong status, but others do as well. This also sounds more like an auto-away issue.
Yet, if "b)" is really the case, how to fix it? Would require auto-away to know that the protocol was / is online... (KeepStatus tries to reconnect it) So KeepStatus might have to export a service for that and auto-away use it.
Otherwise it would be a quite expected behavior... as auto-away shouldn't switch manually set offline protocols to away/online
Title: Re: False "away" status when server connection is lost
Post by: AnrDaemon on 08 09 2015, 02:26:28
As far as I recall, KeepStatus remember the last status the protocol was set to, and is trying to set protocol to that status in order to reconnect to the network.
If your away plugin is trying to raise status upon your return ahead of the time KeepStatus did its job, and the status is not the one desirable, I would blame that away plugin.
Title: Re: False "away" status when server connection is lost
Post by: Testertime on 08 09 2015, 20:54:14
Thanks for your answers!

As far as I recall, KeepStatus remember the last status the protocol was set to, and is trying to set protocol to that status in order to reconnect to the network.
If your away plugin is trying to raise status upon your return ahead of the time KeepStatus did its job, and the status is not the one desirable, I would blame that away plugin.

That's the magic question, which plugin is doing this? Personally I still believe it's KeepStatus, because once I moved my mouse at 02:30 in my video, my status was properly "online" again, but a few seconds after that, it's "away" again. KeepStatus tries to reconnect while this happened, and this bug doesn't happen if the connection is not down. So my conclusion is that it's probably KeepStatus fault. But I'm not a developer, so I can't say that for sure.


Now here is the question (and my guessing):
    a) does the auto away plugin TRY to switch status to online of these offline protocols?
       -> if so, perhaps issue of Keep status plugin, who didn't remember that you (= auto away plugin) wanted this protocol to be online now (maybe because protocol never went to this status and keep status remembers only status in which protocol was?)

This is what I'm thinking. The AutoAway plugin properly restores my status to "online" as seen in my video at 02:30, but a few seconds after that, it's back to "away" again, and this happens while KeepStatus is reconnecting. By watching this behavior, I guess it's a)

    b) or does the auto away plugin IGNORE the change back to online, because protocol is offline.
       -> if it is this case, perhaps it is issue of auto away plugin

I'm a little bit confused about this one. Why should the AutoAway plugin ignore my change back to online, when it has changed my status to "online" as seen after 02:30 in my video? For me it looks like it's working as intended, and that KeepStatus doesn't respect the status change from AutoAway, while one account is offline because of a disconnect. It seems KeepStatus is using the status before one account went offline due to a disconnect, and doesn't care about status changes, which results in overwriting my "online" status to the "away" status. (I hope this text isn't confusing again, because personally I can understand it ::))

After all you do know more about the program and plugins than I do. Thanks in advance again! :)
Title: Re: False "away" status when server connection is lost
Post by: AnrDaemon on 09 09 2015, 04:36:45
That's an interesting question.
Does KeepStatus watch protocol status changes between reconnects?
Title: Re: False "away" status when server connection is lost
Post by: Robyer on 09 09 2015, 05:48:26
It's problem of Keep Status.
Internal StdAutoAway module is very simple. It just watch for idle event and if user is now idle, it remember old status and switch to wanted status; if user stop being idle, it load last status (must be either online or free for chat) and set it. Which means it could bring protocol even from offline (it doesn't care).

What to try:
1) Could you try to install AdvancedAutoAway (which is from same author as KeepStatus) and reproduce problem with it too?
2) Could you try SmartAutoAway plugin instead of KeepStatus? It provides own "auto reconnect" function. - hm, it's not adopted for NG yet. So, what about trying it in Miranda IM? Reproduce it with KeepStatus and then try SmartAutoAway (install both "Smart Auto Away" and "Smart Auto Away NI" plugins). Hm, Miranda IM addons are down and I didn't found a mirror... Ok, forget it for now.
3) Will enabling setting "Switch to offline before try new connection attempt" (I'm guessing name) of KeepStatus make any change to the behavior?
4) Could you also enable showing popups of KeepStatus behavior? (there should be some option for that) Maybe it would help understand what's going on with the first protocol that hasn't lost connection.
Title: Re: False "away" status when server connection is lost
Post by: AnrDaemon on 09 09 2015, 07:05:24
"Switch to offline" in KeepStatus prevent failed attempts to set a new status for protocols stuck in connection attempt. It will force "Offline" status for those protocols before attempting a new reconnect. If a protocol is already connected, the status will not be set to Offline.

Yes, there's popups for KeepStatus attempts and monitoring.
Check "PopUps -> KeepStatus", in the "Events" block.
I suggest checking at least "Show when reconnection has finished", then you will have a clear indication when it actually ginished reconnecting/restoring statuses.
Title: Re: False "away" status when server connection is lost
Post by: Testertime on 09 09 2015, 19:58:46
What to try:
1) Could you try to install AdvancedAutoAway (which is from same author as KeepStatus) and reproduce problem with it too?

I have tried it, and I couldn't reproduce the problem there. It's bug-free there. Cool! :)


3) Will enabling setting "Switch to offline before try new connection attempt" (I'm guessing name) of KeepStatus make any change to the behavior?

It changed the behavior, but it made it even more weird. After changing this option, it sets my other not-disconnected account to "offline" (so I had two offline accounts at this moment), and a few seconds later it's connecting with the status "away", ending up with the same result like before in my original post.


4) Could you also enable showing popups of KeepStatus behavior? (there should be some option for that) Maybe it would help understand what's going on with the first protocol that hasn't lost connection.

I have tried to do it, but somehow I don't see any popups, although the popup test in the settings is working. Sadly I haven't much time right now why it's happening even though I followed the steps of AnrDaemon. Luckily Friday isn't far away.


That's an interesting question.
Does KeepStatus watch protocol status changes between reconnects?

For me it looks like a no, but then it's weird why it doesn't happen with the "AdvancedAutoAway" plugin
Title: Re: False "away" status when server connection is lost
Post by: AnrDaemon on 09 09 2015, 20:30:17
For me it looks like a no, but then it's weird why it doesn't happen with the "AdvancedAutoAway" plugin
It doesn't? It may be the difference in how they set the next status.
Title: Re: False "away" status when server connection is lost
Post by: Testertime on 23 09 2015, 16:18:21
As a workaround I'm now using AdvancedAutoAway, even though that I don't need any additional features. If anyone else isn't amused with this little bug / glitch, you can "fix" it by using the AdvancedAutoAway plugin until it's patched by somebody. Don't forget to remove the tick at "Becoming idle if the following is left unattended:" in "Idle" and ticking the option from AdvancedAutoAway.
Title: Re: False "away" status when server connection is lost
Post by: Robyer on 28 09 2015, 16:15:50
Testertime, could you make a bug report on the tracker (with link to this topic) so we won't forget about this issue?
Title: Re: False "away" status when server connection is lost
Post by: Testertime on 28 09 2015, 18:38:10
I had already created this bug report a while ago http://trac.miranda-ng.org/ticket/984, should I edit it or create a new one? Better safe than sorry, because I wouldn't like to "spam" you there.
Title: Re: False "away" status when server connection is lost
Post by: Robyer on 28 09 2015, 18:41:19
Oh, in that case only mention this forum thread in it (e.g. edit the issue or use comment to add link).

But trac is for me in "maintenance" right now so I can't read your original ticket.
Title: Re: False "away" status when server connection is lost
Post by: Testertime on 28 09 2015, 18:49:17
Okay. I have seen the maintenance message too, so I have copied the link from my original post :P I'm going to edit the ticket when it's up again. Thanks for your time!
Title: Re: False "away" status when server connection is lost
Post by: Tragen on 01 11 2015, 19:21:02
I have a similar problem with KeepStatus.
I have 2 Accounts. ICQ/Jabber
When I go idle after 10 minutes, very often I have status offline and when I come back it goes back to online.
I disabled KeepStatus to use AutoAway. Now everything works.
When I disabled KeepStatus I had to disable internal Idle option.
Perhaps this is something which interfers with KeepStatus. AutoWay said it won't work until I
disable Idle.
Title: Re: False "away" status when server connection is lost
Post by: Robyer on 10 11 2015, 07:59:12
Tragen, I don't exactly understand the problem - why would ICQ went offline if you set it to go away...