BUG: XLSX > 0.18.1+ Causing STATUS_BREAKPOINT (Web worker) on Chromium Browsers #2616

Closed
opened 2022-03-16 15:12:56 +00:00 by vitorlans · 5 comments
vitorlans commented 2022-03-16 15:12:56 +00:00 (Migrated from github.com)

Hello,
A one month ago I started to face a bug STATUS_BREAKPOINT on chromium browsers like google chrome/microsoft edge
it happen when I load a 'large xlsx' using a Web Workers.

ps: it doesn't happen on Firefox browsers and without webworker seems work fine.

To Reproduce
you can go to https://oss.sheetjs.com/ and load a big xlsx that prompt webworker message, press ok, and wait you get a browser error
image

my current workaround to fix it. it is fix XLSX version on 0.18.0 that I don't have this problem.

Thanks

Hello, A one month ago I started to face a bug STATUS_BREAKPOINT on chromium browsers like google chrome/microsoft edge it happen when I load a 'large xlsx' using a Web Workers. ps: it doesn't happen on Firefox browsers and without webworker seems work fine. To Reproduce you can go to https://oss.sheetjs.com/ and load a big xlsx that prompt webworker message, press ok, and wait you get a browser error ![image](https://user-images.githubusercontent.com/5940943/158622784-0c367fa6-a9d7-48da-b575-3e138dd58226.png) my current workaround to fix it. it is **fix XLSX version on 0.18.0** that I don't have this problem. Thanks
SheetJSDev commented 2022-03-16 16:56:45 +00:00 (Migrated from github.com)

How big is "large"? can you share a file?

How big is "large"? can you share a file?
vitorlans commented 2022-03-16 17:01:41 +00:00 (Migrated from github.com)

How big is "large"? can you share a file?

Trendyol_output.xlsx

sample file

> How big is "large"? can you share a file? [Trendyol_output.xlsx](https://github.com/SheetJS/sheetjs/files/8266668/Trendyol_output.xlsx) sample file
SheetJSDev commented 2022-03-16 18:04:59 +00:00 (Migrated from github.com)

Quick patch (feel free to send PR):

diff --git a/bits/20_jsutils.js b/bits/20_jsutils.js
@@ -109,7 +109,22 @@ function cc2str(arr/*:Array<number>*/, debomit)/*:string*/ {
 		}
 		return arr.toString("binary");
 	}
-	/* TODO: investigate performance degradation of TextEncoder in Edge 13 */
+	if(typeof TextDecoder !== "undefined") try {
+		if(debomit) {
+			if(arr[0] == 0xFF && arr[1] == 0xFE) return new TextEncoder("utf-16le").decode(arr.slice(2));
+			if(arr[0] == 0xFE && arr[1] == 0xFF) return new TextEncoder("utf-16be").decode(arr.slice(2));
+			var rev = {
+				"\u20ac": "\x80", "\u201a": "\x82", "\u0192": "\x83", "\u201e": "\x84",
+				"\u2026": "\x85", "\u2020": "\x86", "\u2021": "\x87", "\u02c6": "\x88",
+				"\u2030": "\x89", "\u0160": "\x8a", "\u2039": "\x8b", "\u0152": "\x8c",
+				"\u017d": "\x8e", "\u2018": "\x91", "\u2019": "\x92", "\u201c": "\x93",
+				"\u201d": "\x94", "\u2022": "\x95", "\u2013": "\x96", "\u2014": "\x97",
+				"\u02dc": "\x98", "\u2122": "\x99", "\u0161": "\x9a", "\u203a": "\x9b",
+				"\u0153": "\x9c", "\u017e": "\x9e", "\u0178": "\x9f"
+			};
+			return new TextDecoder("latin1").decode(arr).replace(/[\x80\x9F]/g, function(c) { return rev[c] || c; }); 
+		}
+	} catch(e) {}
 	var o = [];
 	for(var i = 0; i != arr.length; ++i) o.push(String.fromCharCode(arr[i]));
 	return o.join("");
Quick patch (feel free to send PR): ```diff diff --git a/bits/20_jsutils.js b/bits/20_jsutils.js @@ -109,7 +109,22 @@ function cc2str(arr/*:Array<number>*/, debomit)/*:string*/ { } return arr.toString("binary"); } - /* TODO: investigate performance degradation of TextEncoder in Edge 13 */ + if(typeof TextDecoder !== "undefined") try { + if(debomit) { + if(arr[0] == 0xFF && arr[1] == 0xFE) return new TextEncoder("utf-16le").decode(arr.slice(2)); + if(arr[0] == 0xFE && arr[1] == 0xFF) return new TextEncoder("utf-16be").decode(arr.slice(2)); + var rev = { + "\u20ac": "\x80", "\u201a": "\x82", "\u0192": "\x83", "\u201e": "\x84", + "\u2026": "\x85", "\u2020": "\x86", "\u2021": "\x87", "\u02c6": "\x88", + "\u2030": "\x89", "\u0160": "\x8a", "\u2039": "\x8b", "\u0152": "\x8c", + "\u017d": "\x8e", "\u2018": "\x91", "\u2019": "\x92", "\u201c": "\x93", + "\u201d": "\x94", "\u2022": "\x95", "\u2013": "\x96", "\u2014": "\x97", + "\u02dc": "\x98", "\u2122": "\x99", "\u0161": "\x9a", "\u203a": "\x9b", + "\u0153": "\x9c", "\u017e": "\x9e", "\u0178": "\x9f" + }; + return new TextDecoder("latin1").decode(arr).replace(/[\x80\x9F]/g, function(c) { return rev[c] || c; }); + } + } catch(e) {} var o = []; for(var i = 0; i != arr.length; ++i) o.push(String.fromCharCode(arr[i])); return o.join(""); ```
vitorlans commented 2022-03-16 18:21:48 +00:00 (Migrated from github.com)

Quick patch (feel free to send PR):

Thanks @SheetJSDev, I will test that and send a PR.

> Quick patch (feel free to send PR): Thanks @SheetJSDev, I will test that and send a PR.
Mikecarbon commented 2022-03-18 08:13:43 +00:00 (Migrated from github.com)

Hello, A one month ago I started to face a bug STATUS_BREAKPOINT on chromium browsers like google chrome/microsoft edge it happen when I load a 'large xlsx' using a Web Workers.

ps: it doesn't happen on Firefox browsers and without webworker seems work fine.

To Reproduce you can go to https://oss.sheetjs.com/ and load a big xlsx that prompt webworker message, press ok, and wait you get a browser error image

my current workaround to fix it. it is fix XLSX version on 0.18.0 that I don't have this problem.

Thanks
25

> Hello, A one month ago I started to face a bug STATUS_BREAKPOINT on chromium browsers like google chrome/microsoft edge it happen when I load a 'large xlsx' using a Web Workers. > > ps: it doesn't happen on Firefox browsers and without webworker seems work fine. > > To Reproduce you can go to https://oss.sheetjs.com/ and load a big xlsx that prompt webworker message, press ok, and wait you get a browser error ![image](https://user-images.githubusercontent.com/5940943/158622784-0c367fa6-a9d7-48da-b575-3e138dd58226.png) > > my current workaround to fix it. it is **fix XLSX version on 0.18.0** that I don't have this problem. > > Thanks 25
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sheetjs/sheetjs#2616
No description provided.