Page MenuHomePhabricator

Cannot read property 'type' of undefined in MCS
Closed, ResolvedPublic

Description

An error occurring in MCS https://logstash.wikimedia.org/goto/9e8cfbb8abc110869e05b385c7b8a040\

TypeError: Cannot read property 'type' of undefined
    at TokenStreamBase.LA (/srv/deployment/mobileapps/deploy-cache/revs/db795eca951a4377df87639fae4f86378fbd3a38/node_modules/domino/lib/cssparser.js:810:29)
    at TokenStreamBase.advance (/srv/deployment/mobileapps/deploy-cache/revs/db795eca951a4377df87639fae4f86378fbd3a38/node_modules/domino/lib/cssparser.js:683:20)
    at Parser._readDeclarations (/srv/deployment/mobileapps/deploy-cache/revs/db795eca951a4377df87639fae4f86378fbd3a38/node_modules/domino/lib/cssparser.js:3402:42)
    at Parser.parseStyleAttribute (/srv/deployment/mobileapps/deploy-cache/revs/db795eca951a4377df87639fae4f86378fbd3a38/node_modules/domino/lib/cssparser.js:3581:22)
    at parseStyles (/srv/deployment/mobileapps/deploy-cache/revs/db795eca951a4377df87639fae4f86378fbd3a38/node_modules/domino/lib/CSSStyleDeclaration.js:23:10)
    at Object.get (/srv/deployment/mobileapps/deploy-cache/revs/db795eca951a4377df87639fae4f86378fbd3a38/node_modules/domino/lib/CSSStyleDeclaration.js:38:28)
    at Object.value (/srv/deployment/mobileapps/deploy-cache/revs/db795eca951a4377df87639fae4f86378fbd3a38/node_modules/domino/lib/CSSStyleDeclaration.js:94:16)
    at Object.get (/srv/deployment/mobileapps/deploy-cache/revs/db795eca951a4377df87639fae4f86378fbd3a38/node_modules/domino/lib/CSSStyleDeclaration.js:562:19)
    at Object.closestInlineStyle (/srv/deployment/mobileapps/deploy-cache/revs/db795eca951a4377df87639fae4f86378fbd3a38/node_modules/wikimedia-page-library/build/wikimedia-page-library-transform.js:1:2235)
    at s (/srv/deployment/mobileapps/deploy-cache/revs/db795eca951a4377df87639fae4f86378fbd3a38/node_modules/wikimedia-page-library/build/wikimedia-page-library-transform.js:1:23977)
    at Array.filter (native)
    at Object.classifyElements (/srv/deployment/mobileapps/deploy-cache/revs/db795eca951a4377df87639fae4f86378fbd3a38/node_modules/wikimedia-page-library/build/wikimedia-page-library-transform.js:1:24277)
    at Object.module.exports [as prepForTheme] (/srv/deployment/mobileapps/deploy-cache/revs/db795eca951a4377df87639fae4f86378fbd3a38/src/lib/transformations/pcs/prepForTheme.js:11:20)
    at _processChunked (/srv/deployment/mobileapps/deploy-cache/revs/db795eca951a4377df87639fae4f86378fbd3a38/src/lib/processing.js:34:29)
    at chunk.forEach.i (/srv/deployment/mobileapps/deploy-cache/revs/db795eca951a4377df87639fae4f86378fbd3a38/src/lib/processing.js:28:58)
    at Array.forEach (native)
    at Immediate.setImmediate (/srv/deployment/mobileapps/deploy-cache/revs/db795eca951a4377df87639fae4f86378fbd3a38/src/lib/processing.js:28:45)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)

A big issue is that it goes unhandled and gets caught by service-runner unhandled exception handler.

Another variation:

TypeError: Cannot read property 'type' of undefined
   at TokenStreamBase.LA (/srv/deployment/mobileapps/deploy-cache/revs/5ebf93e22e40f78a778c1429a2d8b56eb756740e/node_modules/domino/lib/cssparser.js:810:29)
   at TokenStreamBase.advance (/srv/deployment/mobileapps/deploy-cache/revs/5ebf93e22e40f78a778c1429a2d8b56eb756740e/node_modules/domino/lib/cssparser.js:683:20)
   at Parser._readDeclarations (/srv/deployment/mobileapps/deploy-cache/revs/5ebf93e22e40f78a778c1429a2d8b56eb756740e/node_modules/domino/lib/cssparser.js:3402:42)
   at Parser.parseStyleAttribute (/srv/deployment/mobileapps/deploy-cache/revs/5ebf93e22e40f78a778c1429a2d8b56eb756740e/node_modules/domino/lib/cssparser.js:3581:22)
   at parseStyles (/srv/deployment/mobileapps/deploy-cache/revs/5ebf93e22e40f78a778c1429a2d8b56eb756740e/node_modules/domino/lib/CSSStyleDeclaration.js:23:10)
   at Object.get (/srv/deployment/mobileapps/deploy-cache/revs/5ebf93e22e40f78a778c1429a2d8b56eb756740e/node_modules/domino/lib/CSSStyleDeclaration.js:38:28)
   at Object.value (/srv/deployment/mobileapps/deploy-cache/revs/5ebf93e22e40f78a778c1429a2d8b56eb756740e/node_modules/domino/lib/CSSStyleDeclaration.js:94:16)
   at Object.get (/srv/deployment/mobileapps/deploy-cache/revs/5ebf93e22e40f78a778c1429a2d8b56eb756740e/node_modules/domino/lib/CSSStyleDeclaration.js:562:19)
   at E (/srv/deployment/mobileapps/deploy-cache/revs/5ebf93e22e40f78a778c1429a2d8b56eb756740e/node_modules/wikimedia-page-library/build/wikimedia-page-library-transform.js:1:5322)
   at Object.O [as prepareTables] (/srv/deployment/mobileapps/deploy-cache/revs/5ebf93e22e40f78a778c1429a2d8b56eb756740e/node_modules/wikimedia-page-library/build/wikimedia-page-library-transform.js:1:6445)
   at Object.module.exports [as prepForCollapseTable] (/srv/deployment/mobileapps/deploy-cache/revs/5ebf93e22e40f78a778c1429a2d8b56eb756740e/src/lib/transformations/pcs/prepForCollapseTable.js:16:28)
   at _processChunked (/srv/deployment/mobileapps/deploy-cache/revs/5ebf93e22e40f78a778c1429a2d8b56eb756740e/src/lib/processing.js:34:29)
   at chunk.forEach.i (/srv/deployment/mobileapps/deploy-cache/revs/5ebf93e22e40f78a778c1429a2d8b56eb756740e/src/lib/processing.js:28:58)
   at Array.forEach (native)
   at Immediate.setImmediate (/srv/deployment/mobileapps/deploy-cache/revs/5ebf93e22e40f78a778c1429a2d8b56eb756740e/src/lib/processing.js:28:45)
   at runCallback (timers.js:672:20)
   at tryOnImmediate (timers.js:645:5)
   at processImmediate [as _immediateCallback] (timers.js:617:5)

Event Timeline

Pchelolo created this task.Thu, Aug 1, 12:09 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptThu, Aug 1, 12:09 AM
Mholloway updated the task description. (Show Details)Thu, Aug 1, 12:50 AM

Looks like some pathological CSS style parsing case triggered by starting pregeneration of mobile-html. None of the code implicated is all that new.

I suspect that this is the line triggering the error:

https://github.com/wikimedia/wikimedia-page-library/blob/master/src/transform/ElementUtilities.js#L32

called from:

https://github.com/wikimedia/wikimedia-page-library/blob/master/src/transform/ThemeTransform.js#L61

Ping @cscott for advice from the domino side on whether there's something that wikimedia-page-library should be doing differently.

Unfortunately, it doesn't look like our logging is capturing the request URLs in this case, so I don't know how to reproduce this.

Unfortunately, it doesn't look like our logging is capturing the request URLs in this case, so I don't know how to reproduce this.

By cross-referencing timestamps with RESTBase I believe here's how to reproduce, but I'm not 100% sure.

curl https://fr.wikipedia.org/api/rest_v1/page/mobile-html/Discussion_Projet%3AChimie%2FArchives%2F2010%2F1

Looks like domino's CSS parser errors out when trying to parse style="#CCCCCC; padding-left:20px;padding-right:20px; background:transparent;", which is part of a value passed in to a template in the page wikitext. I'm pretty sure that isn't a valid style declaration without a property name to which to apply the #CCCCCC value.

Mholloway claimed this task.Fri, Aug 2, 3:03 AM
Mholloway triaged this task as High priority.
Mholloway updated the task description. (Show Details)Fri, Aug 2, 12:49 PM

Mentioned in SAL (#wikimedia-operations) [2019-08-02T15:47:56Z] <mholloway-shell@deploy1001> Started deploy [mobileapps/deploy@250f711]: Fix MCS production crashers (T229521, T229630)

Mentioned in SAL (#wikimedia-operations) [2019-08-02T15:52:37Z] <mholloway-shell@deploy1001> Finished deploy [mobileapps/deploy@250f711]: Fix MCS production crashers (T229521, T229630) (duration: 04m 41s)

Mholloway closed this task as Resolved.Fri, Aug 2, 4:02 PM