Infinite loop in email_reply_trimmer

this is a :bug:, but I think only developers will care about it. There’s an infinite loop in one of these replacements. I found it while running the nabble importer. I banged at it a bit before just commenting it out to solve my immediate problem.

It looks like @zogstrip understands this. It seems that sometimes 183 gets stuck. I was wondering why these 170K messages need an entire holiday weekend to import.

https://github.com/discourse/email_reply_trimmer/blob/master/lib/email_reply_trimmer.rb#L175

1 Like

Do you have an example that fails?

2 Likes

I just assumed that it’d be self evident, because those regexes are so simple.

Yes. I did get the script to spit out the errant one,but by the time I was sure this was the problem it was gone. I’ll try to run it again Real Soon Now.

1 Like

And now it seems that maybe an upgrade made that problem go away, but now Nabble seems not to import any messages that have been emailed in (as opposed to created in the Nabble web interface).

If there’s some easy way to decode a MIME-encoded email, I’d love to know about it.

Not sure about the “MIME-encoded email”, but at least I can reproduce the problem in EmailReplyTrimmer. I’ll fix it tomorrow. This is now fixed.

https://github.com/discourse/email_reply_trimmer/pull/12

4 Likes

This seems to improve things, though I still have messages that are taking >30 seconds to parse a message. They all look Really Long (> 500K bytes?).

Do you want them?

2 Likes

Sure, send me a few of those. I’ll take a look.

3 Likes

My solution was to truncate the posts at 50k. It turns out they didn’t want that list anyway (a bunch of cvs reports).

I wrote code that I think saves the bad messages to files, but really, who wants 500k posts?

2 Likes