Page MenuHomePhabricator

UploadWizard mwext-qunit job bogus failures: "mw.fileApi isPreviewableFile FAILED: afterEach failed on isPreviewableFile: Unfinished AJAX requests: 1"
Closed, ResolvedPublic

Description

UploadWizard mwext-qunit job fails often recently with failures such as:

18:07:57 WARN: 'Unfinished AJAX request #0', Object{url: '/jenkins-mwext-qunit-444/api.php', type: 'POST', isLocal: false, global: true, processData: true, async: true, contentType: 'application/x-www-form-urlencoded; charset=UTF-8', accepts: Object{*: '*/*', text: 'text/plain', html: 'text/html', xml: 'application/xml, text/xml', json: 'application/json, text/javascript', script: 'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript'}, contents: Object{xml: RegExp{}, html: RegExp{}, json: RegExp{}, script: RegExp{}}, responseFields: Object{xml: 'responseXML', text: 'responseText', json: 'responseJSON'}, converters: Object{* text: function String() { ... }, text html: true, text json: function (data){ ... }, text xml: function (data){ ... }, text script: function (text){ ... }}, flatOptions: Object{url: true, context: true}, xhr: function createStandardXHR(){ ... }, jsonp: 'callback', jsonpCallback: function (){ ... }, timeout: 30000, dataType: 'json', data: 'action=query&format=json&checkstatus=true', dataTypes: ['json'], crossDomain: false, hasContent: true}
18:07:59 Chromium 41.0.2272 (Ubuntu) mw.fileApi isPreviewableFile FAILED
18:07:59 	afterEach failed on isPreviewableFile: Unfinished AJAX requests: 1
18:07:59 	Error: Unfinished AJAX requests: 1

Example changesets:

Event Timeline

matmarex created this task.May 5 2015, 11:16 AM
matmarex raised the priority of this task from to Needs Triage.
matmarex updated the task description. (Show Details)
matmarex added subscribers: matmarex, Krinkle.
Restricted Application added a project: Multimedia. · View Herald TranscriptMay 5 2015, 11:16 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
matmarex added a comment.EditedMay 5 2015, 11:52 AM

I think the problem is actually with 'checkStatus' test in /tests/qunit/transports/mw.FormDataTransport.test.js:

		postd = $.Deferred();
		poststub.reset();
		poststub.returns( postd.promise() );
		tstub.reset();
		transport.checkStatus();
		postd.resolve( { upload: { result: 'Poll', stage: 'test' } } );
		assert.ok( !tstub.called );
		assert.ok( usstub.calledWith( 'test' ) );

This tests causes transport.checkStatus(); to call transport.retryWithMethod( 'checkStatus' ) internally, which fires another query… after 3 seconds timeout. If that query (which uses a mocked API, I think, and is thus synchronous) happens to start before unit tests finish, and doesn't finish before the end of whichever unit tests is then running, it will cause that test to fail mysteriously.

Change 208938 had a related patch set uploaded (by Bartosz Dziewoński):
mw.FormDataTransport: Make it possible to skip the 3000 ms timeout in tests

https://gerrit.wikimedia.org/r/208938

matmarex triaged this task as High priority.May 5 2015, 12:08 PM

I'm going to bump priority since this issue is making committing code to UploadWizard super annoying for me so far.

At this point this doesn't seem to be caused by the CI infrastructure. Let me know if the issue persists. Can you reproduce it locally via grunt qunit via MediaWiki core with UploadWizard installed? Or via Special:JavaSciptTest/qunit/plain directly?

Yeah, it's a mistake in UploadWizard tests. I couldn't reproduce locally, but I think the patch above should fix it.

Change 208938 merged by jenkins-bot:
mw.FormDataTransport: Make it possible to skip the 3000 ms timeout in tests

https://gerrit.wikimedia.org/r/208938

matmarex closed this task as Resolved.May 6 2015, 8:03 AM
matmarex claimed this task.

Hopefully fixed.