-
-
Notifications
You must be signed in to change notification settings - Fork 11.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
run-away script in TB? #289
Comments
I'm seeing this as well, I made a video. In the video I allude to a not seeing a I'm on 2.11.8, and don't have any of the add-ons listed by @r2evans. |
I think it may be related, but I'm able to get a "runaway script" now with a fresh email, no markdown, not a reply, but with an image pasted (not attached) into it. It's still the markdown script hanging, and stopping the script permits the process to complete and successfully send. In this latest case, there is not markdown (implied or otherwise) in the text; in fact, just my .sig that starts with "-- ", contains [-A-Za-z0-9:|.,], and has some text in a smaller gray font. That's it. win81_64, now TB 40.0, MDH 2.11.9.1-signed. |
As a short-term workaround, disable "Forgot-to-render check" in the MDH options. I believe that the problem is a regex in the HTML-to-plaintext code that is choking when processing large emails, particularly with a lot of markup. (Emails processed with MDH can get large fast, largely due to the CSS inlining. For example, the sample MD goes from about 900 bytes of raw MD to 10,000 bytes rendered.) The paste image angle is... weird. But if the image gets inlined in the HTML then it could cause the HTML to be very big all by itself. I hope to fix this in the next few days. |
That's a great suggestion, thanks Adam. On 8/10/2015 6:09 PM, Adam Pritchard wrote:
|
Any regex wizards out there? Can anyone give me insight on why this is so slow?
Here's some test code that shows the bad behaviour: var s = '<div><pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);border-radius:3px;display:inline;background-color:rgb(248,248,248);white-space:pre-wrap;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important;display:block;overflow-x:auto;padding:0.5em;color:rgb(51,51,51);background:rgb(248,248,248)"><span><span style="color:rgb(51,51,51);font-weight:bold">function</span> <span style="color:rgb(153,0,0);font-weight:bold">syntaxHighlighting</span><span>()</span> </span>{\n <span style="color:rgb(51,51,51);font-weight:bold">var</span> n = <span style="color:rgb(0,128,128)">33</span>;\n <span style="color:rgb(51,51,51);font-weight:bold">var</span> s = <span style="color:rgb(221,17,68)">"hello, こんにちは"</span>;\n <span style="color:rgb(0,134,179)">console</span>.log(s);\n}\n</code></pre>\n<ul style="margin:1.2em 0px;padding-lfet:2em">\n<li style="margin:0.5em 0px">plain</li>\n<li style="margin:0.5em 0px"><em>emphasis</em><ul style="margin:1.2em 0px;padding-left:2em;margin:0px;padding-left:1em">\n<li style="margin:0.5em 0px"><strong>strong emphasis</strong><ul style="margin:1.2em 0px;padding-left:2em;margin:0px;padding-left:1em">\n<li style="margin:0.5em 0px"><del>strikethrough</del></li>\n</ul>\n</li>\n</ul>\n</li>\n<li style="margin:0.5em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);border-radius:3px;display:inline;background-color:rgb(248,248,248)">inline code</code></li>\n</ul>\n<ol style="margin:1.2em 0px;padding-left:2em">\n<li style="margin:0.5em 0px">Numbered list<ol style="margin:1.2em 0px;padding-left:2em;margin:0px;padding-left:1em;list-style-type:lower-roman">\n<li style="margin:0.5em 0px">Numbered sub-list<ol style="margin:1.2em 0px;padding-left:2em;margin:0px;padding-left:1em;list-style-type:lower-roman;list-style-type:lower-alpha">\n<li style="margin:0.5em 0px">Numbered sub-sub-list</li>\n</ol>\n</li>\n</ol>\n</li>\n<li style="margin:0.5em 0px"><a href="https://www.google.com" target="_blank">Link</a></li>\n</ol>\n<p style="margin:0px 0px 1.2em!important">An image: <img src="https://ci6.googleusercontent.com/proxy/SnqZGOlvv1rmqrH0D3Hv3b_xgSYDF1X85eF5yiLlq7JA460-RO1EUXU3m6je9Clj3CIVzrbcfE0mNObMdllDlTyOUEWMXBY7pgk=s0-d-e1-ft#http://adam-p.github.io/markdown-here/img/icon24.png" alt="Markdown Here logo" class="CToWUd"> </p>\n<blockquote style="margin:1.2em 0px;border-left-width:4px;border-left-style:solid;border-left-color:rgb(221,221,221);padding:0px 1em;color:rgb(119,119,119);quotes:none">\n<p style="margin:0px 0px 1.2em!important">Block quote.<br><em>With</em> <strong>some</strong> <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);border-radius:3px;display:inline;background-color:rgb(248,248,248)">markdown</code>.</p>\n</blockquote>\n<p style="margin:0px 0px 1.2em!important">If <strong>TeX Math</strong> support is enabled, this is the quadratic equation:<br><img src="https://ci6.googleusercontent.com/proxy/Sp3KOkAUXBpjcStpC8T3Jdqb7b8SSr1BfD2cAfBIfujneu6qK8KOq5ul5JDzCWrvUGbkcbMErHPvZbekk91jruwtGojKwnXRMwbpWqaW9XNn9YUjdl64c4P9yBIPU2uc-YfaDe8MxJDAPqX-pQVv7ycg1CELz3RzsHN-Uw=s0-d-e1-ft#https://chart.googleapis.com/chart?cht=tx&chl=-b%20%5Cpm%20%5Csqrt%7Bb%5E2%20-%204ac%7D%20%5Cover%202a" alt="-b \pm \sqrt{b^2 - 4ac} \over 2a" class="CToWUd"></p>\n<h1 style="margin:1.3em 0px 1em;padding:0px;font-weight:bold;font-size:1.6em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(221,221,221)"><a href="#14f1a36fb61d8846_" name="14f1a36fb61d8846_header-1"></a>Header 1</h1>\n<h2 style="margin:1.3em 0px 1em;padding:0px;font-weight:bold;font-size:1.4em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238)"><a href="#14f1a36fb61d8846_" name="14f1a36fb61d8846_header-2"></a>Header 2</h2>\n<h3 style="margin:1.3em 0px 1em;padding:0px;font-weight:bold;font-size:1.3em"><a href="#14f1a36fb61d8846_" name="14f1a36fb61d8846_header-3"></a>Header 3</h3>\n<h4 style="margin:1.3em 0px 1em;padding:0px;font-weight:bold;font-size:1.2em"><a href="#14f1a36fb61d8846_" name="14f1a36fb61d8846_header-4"></a>Header 4</h4>\n<h5 style="margin:1.3em 0px 1em;padding:0px;font-weight:bold;font-size:1em"><a href="#14f1a36fb61d8846_" name="14f1a36fb61d8846_header-5"></a>Header 5</h5>\n<h6 style="margin:1.3em 0px 1em;padding:0px;font-weight:bold;font-size:1em;color:rgb(119,119,119)"><a href="#14f1a36fb61d8846_" name="14f1a36fb61d8846_header-6"></a>Header 6</h6>\n<table style="margin:1.2em 0px;padding:0px;border-collapse:collapse;border-spacing:0px;font-family:inherit;font-size:inherit;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;border:0px">\n<thead>\n<tr style="border-width:1px 0px 0px;border-top-style:solid;border-top-color:rgb(204,204,204);margin:0px;padding:0px;background-color:white">\n<th style="font-size:1em;border:1px solid rgb(204,204,204);margin:0px;padding:0.5em 1em;font-weight:bold;background-color:rgb(240,240,240)">Tables</th>\n<th style="text-align:center;font-size:1em;border:1px solid rgb(204,204,204);margin:0px;padding:0.5em 1em;font-weight:bold;background-color:rgb(240,240,240)">Are</th>\n<th style="text-align:right;font-size:1em;border:1px solid rgb(204,204,204);margin:0px;padding:0.5em 1em;font-weight:bold;background-color:rgb(240,240,240)">Cool</th>\n</tr>\n</thead>\n<tbody style="margin:0px;padding:0px;border:0px">\n<tr style="border-width:1px 0px 0px;border-top-style:solid;border-top-color:rgb(204,204,204);margin:0px;padding:0px;background-color:white">\n<td style="font-size:1em;border:1px solid rgb(204,204,204);margin:0px;padding:0.5em 1em">column 3 is</td>\n<td style="text-align:center;font-size:1em;border:1px solid rgb(204,204,204);margin:0px;padding:0.5em 1em">right-aligned</td>\n<td style="text-align:right;font-size:1em;border:1px solid rgb(204,204,204);margin:0px;padding:0.5em 1em">$1600</td>\n</tr>\n<tr style="border-width:1px 0px 0px;border-top-style:solid;border-top-color:rgb(204,204,204);margin:0px;padding:0px;background-color:white;background-color:rgb(248,248,248)">\n<td style="font-size:1em;border:1px solid rgb(204,204,204);margin:0px;padding:0.5em 1em">column 2 is</td>\n<td style="text-align:center;font-size:1em;border:1px solid rgb(204,204,204);margin:0px;padding:0.5em 1em">centered</td>\n<td style="text-align:right;font-size:1em;border:1px solid rgb(204,204,204);margin:0px;padding:0.5em 1em">$12</td>\n</tr>\n<tr style="border-width:1px 0px 0px;border-top-style:solid;border-top-color:rgb(204,204,204);margin:0px;padding:0px;background-color:white">\n<td style="font-size:1em;border:1px solid rgb(204,204,204);margin:0px;padding:0.5em 1em">zebra stripes</td>\n<td style="text-align:center;font-size:1em;border:1px solid rgb(204,204,204);margin:0px;padding:0.5em 1em">are neat</td>\n<td style="text-align:right;font-size:1em;border:1px solid rgb(204,204,204);margin:0px;padding:0.5em 1em">$1</td>\n</tr>\n</tbody>\n</table>\n<p style="margin:0px 0px 1.2em!important">Here’s a horizontal rule:</p>\n<hr>\n<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);border-radius:3px;display:inline;background-color:rgb(248,248,248);white-space:pre-wrap;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important">code block\nwith no highlighting\n</code></pre><div title="MDH:PGRpdj5gYGBqYXZhc2NyaXB0PC9kaXY+PGRpdj5mdW5jdGlvbiBzeW50YXhIaWdobGlnaHRpbmco\nKSB7PC9kaXY+PGRpdj4mbmJzcDsgdmFyIG4gPSAzMzs8L2Rpdj48ZGl2PiZuYnNwOyB2YXIgcyA9\nICJoZWxsbywg44GT44KT44Gr44Gh44GvIjs8L2Rpdj48ZGl2PiZuYnNwOyBjb25zb2xlLmxvZyhz\nKTs8L2Rpdj48ZGl2Pn08L2Rpdj48ZGl2PmBgY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kaXY+IyMg\nSGVhZGVyIDI8L2Rpdj48ZGl2PiMjIyBIZWFkZXIgMzwvZGl2PjxkaXY+IyMjIyBIZWFkZXIgNDwv\nZGl2PjxkaXY+IyMjIyMgSGVhZGVyIDU8L2Rpdj48ZGl2PiMjIyMjIyBIZWFkZXIgNjwvZGl2Pjxk\naXY+Jm5ic3A7Jm5ic3A7PC9kaXY+PGRpdj58IFRhYmxlcyB8IEFyZSB8IENvb2wgfDwvZGl2Pjxk\naXY+fCAtLS0tLS0tLS0tLS0tIHw6LS0tLS0tLS0tLS0tLTp8IC0tLS0tOnw8L2Rpdj48ZGl2Pnwg\nY29sdW1uIDMgaXMgfCByaWdodC1hbGlnbmVkIHwgJDE2MDAgfDwvZGl2PjxkaXY+fCBjb2x1bW4g\nMiBpcyB8IGNlbnRlcmVkIHwgJDEyIHw8L2Rpdj48ZGl2PnwgemVicmEgc3RyaXBlcyB8IGFyZSBu\nZWF0IHwgJDEgfDwvZGl2PjxkaXY+PGJyPjwvZGl2PjxkaXY+SGVyZSdzIGEgaG9yaXpvbnRhbCBy\ndWxlOjwvZGl2PjxkaXY+PGJyPjwvZGl2PjxkaXY+LS0tPC9kaXY+PGRpdj48YnI+PC9kaXY+PGRp\ndj5gYGA8L2Rpdj48ZGl2PmNvZGUgYmxvY2s8L2Rpdj48ZGl2PndpdGggbm8gaGlnaGxpZ2h0aW5n\nPC9kaXY+PGRpdj5gYGA8L2Rpdj48ZGl2Pjxicj48L2Rpdj4=" style="min-height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0"></div></div>';
// Target regex
var d1 = new Date();
s.repeat(100).match(/([^>]+)$/);
console.log(new Date().getTime() - d1.getTime());
// >>> 1760
// Another regex we use that's fast, for comparison
d1 = new Date();
s.repeat(100).match(/(<\/div>)<div\b[^>]*><\/div>(<div[^>]*>)/);
console.log(new Date().getTime() - d1.getTime());
// >>> 1
// Removing the capture group has no effect
// /[^>]+$/ --> 1722
// Removing the + has a huge effect
// /([^>])$/ --> 1
// Removing the negation from the character set has some effect
// /([>]+)$/ --> 42 If that sample string gets messed up, here it is: http://pastebin.com/ZGgVGVtq |
I just push a fix for this. Or at least a fix for the lots-of-HTML-in-email scenario I was able to reproduce, as well as the pasted-image scenario. I think that @dukedave's problem is actually something else. I'm going to continue to look at it and probably spin out a new issue. |
For several email _replies_, after I render the document into HTML (which works without any symptoms) and try to send, the window hangs and eventually reports:
Selecting continue will just hang it again until the TB process again interrupts the process to ask me. When I click "stop script", it pauses a few more seconds and then sends without further error. The sent email is formatted correctly (as far as I can tell without deep inspection).
After some testing, I'm getting closer to narrowing down triggers. For instance:
(I am a little surprised that a trigger is based at least in part to the presence of rendered MDH in an original email, since I believed that no quoted replies would be parsed.)
It's possible that a specific entity is causing the hang. For the emails that hang, all I tend to use are smart-quotes, bullets, inline code blocks, and rarely full code blocks.
Versions:
Other add-ons that are enabled. The list is a bit long, so in lieu of doing an exhaustive pairing to see which could be a problem, do you know if any of these are likely to have conflicts?
I hope I've provided enough to at least start troubleshooting and asking more questions.
The text was updated successfully, but these errors were encountered: