Urbanecm added a comment.

  I was discussing this issue with @Dvorapa privately, and I've decided to try 
to run Pywikibot tests via a proxy which allows me to view the request and 
response in full (I've used mitmproxy). Those are raw data with necessary 
redactions.
  
  F31719962: image.png <https://phabricator.wikimedia.org/F31719962>
  F31719968: image.png <https://phabricator.wikimedia.org/F31719968>
  F31719972: image.png <https://phabricator.wikimedia.org/F31719972>
  F31719975: image.png <https://phabricator.wikimedia.org/F31719975>
  
  Note: Those screenshots are from the middle of the loop, TLDR it seems MW 
doesn't accept session cookie passed by PWB, sends a new one, and when PWB 
passes it with the clientlogin request, tokens don't match (MW derrives the 
token from session) and badtoken error is thrown.
  
  Question is: In which cases does MW force clients to change session?
  
  ----
  
  I've also tried to look to what happens before PWB starts to fail. This is 
mitmproxy's main screen when the cyclus started.
  
  F31719990: image.png <https://phabricator.wikimedia.org/F31719990>
  
  The POST from 13:25:43 is a logout request:
  
  F31720045: image.png <https://phabricator.wikimedia.org/F31720045>
  
  MediaWiki then send Set-Cookie header that delets all session cookies, which 
sounds about right:
  
  F31720049: image.png <https://phabricator.wikimedia.org/F31720049>
  
  However, this logout attempt becomes something like a sticky logout: 
MediaWiki starts to delete all received session cookies for some reason. For 
instance, the very next request after the logout request looks like this:
  
  F31720062: image.png <https://phabricator.wikimedia.org/F31720062>
  
  MediaWiki then responds with:
  
  F31720070: image.png <https://phabricator.wikimedia.org/F31720070>
  
  What makes me wonder is why does this request, which should come out after 
the logout succeeded, have centralauth_Session? It seems MediaWiki did delete 
this cookie after logout, but either MW should've deleted _both_ occurances of 
the cookie, or PWB (rather, requests library) should've deleted all matching 
cookies.
  
  My current hypothesis is MediaWiki tries to refresh all session cookies if it 
spots one (in this case, the CentralAuth one) which is invalid. This could 
explain the cycle.

TASK DETAIL
  https://phabricator.wikimedia.org/T224712

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Dvorapa, Urbanecm
Cc: Reedy, Urbanecm, Jdforrester-WMF, Pchelolo, Anomie, Dvorapa, Framawiki, 
Aklapper, pywikibot-bugs-list, Dalba, Xqt, Oblanco79, Alter-paule, Beast1978, 
Un1tY, Zkhalido, Hook696, Daryl-TTMG, RomaAmorRoma, E.S.A-Sheild, WDoranWMF, 
Kent7301, Meekrab2012, joker88john, Viztor, DannyS712, CucyNoiD, NebulousIris, 
Wenyi, Gaboe420, Versusxo, Majesticalreaper22, Amorymeltzer, Giuliamocci, 
Adrian1985, Cpaulf30, Af420, Darkminds3113, Bsandipan, Lordiis, Adik2382, 
Th3d3v1ls, Ramalepe, Liugev6, Tbscho, MayS, Sethakill, WSH1906, Lewizho99, 
Mdupont, JJMC89, Maathavan, dg711, Altostratus, Avicennasis, mys_721tx, jayvdb, 
Masti, Alchimista, Rxy, Legoktm
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to