Last modified: 2014-04-11 14:36:21 UTC
Lately, I have been finding the need to have to restart my bots as the API seems to want to change up tokens. This causes some of my bots to receive a badtoken error. I'm aware of a loss of session data happening every now and then, but this issue seems to be happening frequently. I started up one of my bot scripts a little over 24 hours ago and reviewing the logs, no more than 24 hours passed before the tokens the bot received from the API became invalid. This is becoming a minor nuisance.
Note this bug doesn't really have anything to do with the API, since for token handling it just uses the functions provided in the rest of core. The ideal solution would be for your bot to detect this error and refresh its tokens, because no matter what this sort of thing will happen at some point.
(In reply to Brad Jorsch from comment #1) > Note this bug doesn't really have anything to do with the API, since for > token handling it just uses the functions provided in the rest of core. > > The ideal solution would be for your bot to detect this error and refresh > its tokens, because no matter what this sort of thing will happen at some > point. I've already worked on a patch to refresh the tokens. But the issue at hand is the token seem to expire way too quickly.
(In reply to Brad Jorsch from comment #1) > Note this bug doesn't really have anything to do with the API, since for > token handling it just uses the functions provided in the rest of core. > > The ideal solution would be for your bot to detect this error and refresh > its tokens, because no matter what this sort of thing will happen at some > point. Another one of my bot tasks got logged out. That never happens. The Requests for Unblock table stopped being updated as a result.
Well yesterday/day before, all users were logged out due to heartbleed situation [1]. [1] http://lists.wikimedia.org/pipermail/wikitech-ambassadors/2014-April/000666.html
(In reply to Bawolff (Brian Wolff) from comment #4) > Well yesterday/day before, all users were logged out due to heartbleed > situation [1]. > > [1] > http://lists.wikimedia.org/pipermail/wikitech-ambassadors/2014-April/000666. > html Well. It only happened to one task on my bot. The others are still functioning.
I'm just going to close this. There's nothing demonstrably wrong with the API here. Code that reuses tokens long-term should be ready to refresh those tokens when they expire, whether that is 24 hours, 24 days, or 24 minutes. Similarly, code that runs long-term should detect logged-out status (e.g. using assert=user) and should be prepared to log back in again.