Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Fri Nov 04, 2022 5:10 am

Hello,

In our production environment, the CPU of one of our nodes spiked to 100% almost 3 hours. The only way to stop the issue was rebooting the server. We analyzed the process dump we took during the problem. It pointed us to a regular expression called inside the Spire.Doc code. Here are the details:

Code: Select all
Thread 26 - System ID 11720
Entry point     clr!Thread::intermediateThreadProc
Create time     10/28/2022 12:52:50 PM
Time spent in user mode     0 Days 02:52:37.359
Time spent in kernel mode     0 Days 00:00:09.609

This thread is using regular expressions

RegEx Match String : regular sized html document

RegEx Pattern : (?:(?:[^{}]+)?)*\{\s*\}

.NET Call Stack
System.Text.RegularExpressions.RegexInterpreter.Go()+2e94
System.Text.RegularExpressions.RegexRunner.Scan(System.Text.RegularExpressions.Regex, System.String, Int32, Int32, Int32, Int32, Boolean, System.TimeSpan)+185
System.Text.RegularExpressions.Regex.Run(Boolean, Int32, System.String, Int32, Int32, Int32)+1cb
System.Text.RegularExpressions.Regex.Match(System.String, Int32)+30
System.Text.RegularExpressions.RegexReplacement.Replace(System.Text.RegularExpressions.Regex, System.String, Int32, Int32)+61
System.Text.RegularExpressions.Regex.Replace(System.String, System.String)+36
System.Text.RegularExpressions.Regex.Replace(System.String, System.String, System.String)+66
spr᧒.ᜄ(System.String)+167
spr≕.ᜀ(Spire.Doc.Interface.IBody, System.String, Int32, Int32)+ab0
Spire.Doc.Body.ᜀ(System.String, Int32, Int32, Int32)+69
Spire.Doc.Document.ᜀ(System.IO.TextReader, Spire.Doc.Documents.XHTMLValidationType, Int32)+ae
Spire.Doc.Document.ᜀ(System.IO.Stream, Spire.Doc.Documents.XHTMLValidationType)+8d
Spire.Doc.Document.LoadFromStream(System.IO.Stream, Spire.Doc.FileFormat, Spire.Doc.Documents.XHTMLValidationType)+4d


We tested the regular expression
Code: Select all
(?:(?:[^{}]+)?)*\{\s*\}
and the program provided this error message:
Catastrophic backtracking has been detected and the execution of your expression has been halted.


That expression is not coming from our code. Is that something generated from the document? At this point we are trying to understand what triggered the issue and how do we prevented it.

daniel.parraga
 
Posts: 4
Joined: Thu Nov 03, 2022 8:00 pm

Fri Nov 04, 2022 7:29 am

Hello,

Thanks for your inquiry.
In order for us to further investigate your problem, please send us the testing code about our product and your test documentation. You can attache them here or send them to us via email ([email protected]).

Sincerely,
Simple
E-iceblue support team
User avatar

Simple.Li
 
Posts: 248
Joined: Fri Jul 01, 2022 2:33 am

Sun Nov 06, 2022 3:41 am

HI,

Please find dump file which caused the issue.

Thanks

taha.hussain
 
Posts: 2
Joined: Sun Nov 06, 2022 3:39 am

Mon Nov 07, 2022 5:30 am

Hello,

Thanks for your patience.
I am sorry to tell that there is no significant progress so far. We have informed our development team to expedite your question, once there is any update, I will inform you asap. Sorry for the inconvenience caused.

Sincerely,
Simple
E-iceblue support team
User avatar

Simple.Li
 
Posts: 248
Joined: Fri Jul 01, 2022 2:33 am

Mon Nov 07, 2022 8:06 am

1
User avatar

Simple.Li
 
Posts: 248
Joined: Fri Jul 01, 2022 2:33 am

Fri Nov 11, 2022 2:06 am

Any update on this? This issue is causing lots of client escalation on our side & we need to provide solution on priority.

taha.hussain
 
Posts: 2
Joined: Sun Nov 06, 2022 3:39 am

Fri Nov 11, 2022 4:24 am

Hello,

Thank you for following up.
I found that your previous attachment is just the error log, right? Could you help to share your test code and test documentation with us for an accurate investigation? If they exceed the size limitation for attachment. You could upload them to the DropBox or OneDrive and then share the download link with us. Thanks in advance.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1510
Joined: Wed Apr 25, 2018 3:20 am

Sat Nov 12, 2022 12:39 am

Hello,

The attached sample project reproduces the issue. In summary, the resource string has the html document. The sample program reads from the resource into a stream; and then it uses LoadFromStream. At that point the program gets in a loop and starts consuming CPU.

I hope this helps you to reproduce the problem in your labs.

Thanks,

daniel.parraga
 
Posts: 4
Joined: Thu Nov 03, 2022 8:00 pm

Mon Nov 14, 2022 3:21 am

Dear Daniel,

Thank you for sharing.
Yes, when testing your code, I indeed found that the program hangs a long time. I have logged this issue into our bug tracking system with the ticket SPIREDOC-8781. Our Dev team is doing further investigations now. We will keep you posted if there is any updates. Thanks for your understanding.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1510
Joined: Wed Apr 25, 2018 3:20 am

Mon Nov 21, 2022 1:48 pm

Hello, Is there any response from the team? Do you have an estimated timeline?

daniel.parraga
 
Posts: 4
Joined: Thu Nov 03, 2022 8:00 pm

Tue Nov 22, 2022 10:24 am

Hello,

Sorry this issue is not resolved yet, there is no estimated time can be provided at this moment. I have urged our Dev team and they are making efforts to fix it now, please spare us more time, we will keep you informed once there is any significant progress. Thanks for your understanding.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1510
Joined: Wed Apr 25, 2018 3:20 am

Wed Dec 21, 2022 5:49 pm

Any luck? At this point I want to know the result of your research. If there is a solution, how long until we get that? Or, if the mistake is on our side, what do we need to correct?

Let us know. Thanks,

daniel.parraga
 
Posts: 4
Joined: Thu Nov 03, 2022 8:00 pm

Thu Dec 22, 2022 8:25 am

Hello,

Thank you for following up.
I got the news from our Dev team that your issue has been resolved, and it is in the testing phase, once the tests pass, we will prepare a hotfix for you ASAP. Thanks for your patience.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1510
Joined: Wed Apr 25, 2018 3:20 am

Fri Dec 30, 2022 2:03 am

Hello,

Thanks for your patience!
Glad to inform you that we just released Spire.Doc Pack(hot fix) Version:10.12.4 which fixed the issue of SPIREDOC-8781, please download it from the following links to test.
Website link: https://www.e-iceblue.com/Download/download-word-for-net-now.html
Nuget link: https://www.nuget.org/packages/Spire.Doc/10.12.4

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1510
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.Doc