Reports failing with 'Could not find file 'C:\Windows\TEMP\'

Stimulsoft Reports.WPF discussion
Post Reply
sandynith
Posts: 64
Joined: Thu Dec 12, 2013 4:03 am

Reports failing with 'Could not find file 'C:\Windows\TEMP\'

Post by sandynith »

Hi,

Problem:
==========
Stimulsoft report failing with error 'System.IO.FileNotFoundException: Could not find file 'C:\Windows\TEMP\ll1afkkj.dll' where \ll1afkkj.dll name changes every time failure occurs.
Stack trace:
2013-12-13 09:35:00:784, CCNTSad[0934:0888], WARN, ReportLauncher.<startReport>b__d Report failed System.IO.FileNotFoundException: Could not find file 'C:\Windows\TEMP\ll1afkkj.dll'.
2013-12-13 09:35:00:784, CCNTSad[0934:0888], WARN, File name: 'C:\Windows\TEMP\ll1afkkj.dll'
2013-12-13 09:35:00:784, CCNTSad[0934:0888], WARN, at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
2013-12-13 09:35:00:784, CCNTSad[0934:0888], WARN, at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
2013-12-13 09:35:00:784, CCNTSad[0934:0888], WARN, at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
2013-12-13 09:35:00:784, CCNTSad[0934:0888], WARN, at System.IO.File.InternalReadAllBytes(String path, Boolean checkHost)
2013-12-13 09:35:00:784, CCNTSad[0934:0888], WARN, at System.IO.File.ReadAllBytes(String path)
2013-12-13 09:35:00:784, CCNTSad[0934:0888], WARN, at Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames)
2013-12-13 09:35:00:784, CCNTSad[0934:0888], WARN, at Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters options, String[] sources)
2013-12-13 09:35:00:784, CCNTSad[0934:0888], WARN, at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(CompilerParameters options, String[] sources)
2013-12-13 09:35:00:784, CCNTSad[0934:0888], WARN, at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromSource(CompilerParameters options, String[] sources)
2013-12-13 09:35:00:784, CCNTSad[0934:0888], WARN, at Stimulsoft.Base.StiCompiler.Compile(String textToCompile, String outputAssembly, LanguageType languageType, StiOutputType outputType, String[] referencedAssemblies, List`1 resources)
2013-12-13 09:35:00:784, CCNTSad[0934:0888], WARN, at Stimulsoft.Report.StiReport.Compile(String path, Stream stream, StiOutputType outputType, Boolean autoCreate, Object standaloneReportType)
2013-12-13 09:35:00:784, CCNTSad[0934:0888], WARN, at Stimulsoft.Report.StiReport.Compile()
2013-12-13 09:35:00:784, CCNTSad[0934:0888], WARN, at Cardax.FT.StiUtil.<>c__DisplayClass7.<ToStiReport>b__4(DataTable table)
2013-12-13 09:35:00:784, CCNTSad[0934:0888], WARN, at System.Reactive.Linq.Observable.SelectObservable`2.Observer.Next(TSource value)

Brief description of problem
===============================
Our system/software runs as a service under Local System account. Via our system user can run a report and save the report to a pdf file. The report is generated and exported via stimulsoft functions.
Our system also has a scheduling feature where a user can schedule a report which is saved to a pdf file (generated via stimulsoft). This works great without any problem
If we schedule a report to run frequently say every 2 minutes then all report runs fine for 2-3 days and generates pdf files, but after after 2-3 days suddenly reports start failing with above mentioned error.
Once the system is in this state then user cannot run a new report - report fails with above mentioned error.

+ Reports are pretty small max 2 to 5 pages, ~200kb
+ system generates approximately 2000 to 2400 reports (pdf files) in 2-3 days before entering into the problem state, after that all reports start failing. Only way to recover is to restart our system which is restarting our service. We don't know what triggers the problem.
+ We don't see any high memory usage or CPU spikes - system is absolutely fine. Rest of our software works good.

+ Stimulsoft.Report.Wpf.dll, Stimulsoft.Report.dll and Stimulsoft.Base.dll version 2013.2.1700.0
+ OS: Windows 7 x86 or x64, .net 4

+ We use the following functions to generate report and export it to pdf:
// Get STI template
StiLibrary.Initialise();
var report = new StiReport();
report.LoadReportFromResource(System.Reflection.Assembly.GetExecutingAssembly(), stiReportTemplate); //stiReportTemplate is our MRT file

// Initialise the report with the report data and render it
report.ReportName = metadata.ReportName;
report.ReportAlias = metadata.ReportName;
report.RegData(table.DataSet); //table is System.Data.DataTable
report.Dictionary.Synchronize();
report.Compile();
report.CompiledReport.Rendering += (s, e) => { //handle if report is cancelled or stopped externally }
report.RenderWithWpf(false);

//save report to PDF files
var stream = new FileStream(fileName, FileMode.Create, FileAccess.ReadWrite);
report.ExportDocument(StiExportFormat.Pdf, stream);
stream.Dispose();

//Cleanup
report.Dictionary.DataStore.Clear();
report.CompiledReport.DataStore.Clear();
report.Dispose();

+Attached a screenshot of procmon logs.


Please let me know if you need more information.
Any advice would be appreciated.

Thanks
Attachments
Procmon screenshot
Procmon screenshot
ReportFailure_procmon_screenshot.JPG (446.36 KiB) Viewed 10358 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Reports failing with 'Could not find file 'C:\Windows\TE

Post by Alex K. »

Hello,

By default the compiled file saving in:
C:\Users\<UserName>\AppData\Local\Temp\<temp_assembly>.dll
Please try to change this path:
...
report.Dictionary.Synchronize();
report.Compile(<your path>);
report.CompiledReport.Rendering += (s, e) => { //handle if report is cancelled or stopped externally }
...

Thank you.
sandynith
Posts: 64
Joined: Thu Dec 12, 2013 4:03 am

Re: Reports failing with 'Could not find file 'C:\Windows\TE

Post by sandynith »

Hi Aleksey,
Thanks for your reply. As per your suggestion I will try the following and see how it goes:
report.Compile(@"C:\TestDir\MyStiReportTempAssembly.dll");

However, do you think it can be an issue with the file location of 'temp_assembly.dll' or the access problem? Please consider that our system which runs as a Windows Service (under Local System account) is able to generate ~2000 reports before entering into the problem state? Its only after entering into the bad state that all reports start failing with 'Could not find file 'C:\Windows\TEMP\<temp_assembly>.dll'. I am not sure what triggers the bad state.
I have checked that 'C:\Windows\TEMP' is NOT out of space.
If you notice the C# compiler CSC.exe has ProcessExit with exit code as -1073741502 (0xC0000142) which means 'The application was unable to start correctly' - However I am not sure why.

Thanks
sandynith
Posts: 64
Joined: Thu Dec 12, 2013 4:03 am

Re: Reports failing with 'Could not find file 'C:\Windows\TE

Post by sandynith »

Hi Aleksey,

I tried with report.Compile(@"C:\TestDir\MyStiReportTempAssembly.dll"); but still no luck.
Our system (running as service) was able to generate ~2000 reports (output to pdf), but after that report started failing with the following exceptions:

A first chance exception of type 'System.IO.FileNotFoundException' occurred in Stimulsoft.Report.dll
An exception of type 'System.IO.FileNotFoundException' occurred in Stimulsoft.Report.dll but was not handled in user code
Additional information: Could not find file 'C:\TestDir\MyStiReportTempAssembly.dll'.

The thread 0x2108 has exited with code 0 (0x0).
A first chance exception of type 'System.NullReferenceException' occurred in Stimulsoft.Report.dll
Additional information: Object reference not set to an instance of an object.

An exception of type 'System.NullReferenceException' occurred in Stimulsoft.Report.dll but was not handled in user code
Additional information: Object reference not set to an instance of an object.

The thread 0x26c4 has exited with code 0 (0x0).
The thread 0x284c has exited with code 0 (0x0).
Cardax.FT.Server.ReportLauncher : 9> 17:35:15 WARN ReportLauncher.<startReport>b__d Report failed System.NullReferenceException: Object reference not set to an instance of an object.
at Stimulsoft.Report.StiReport.GetReportFromAssembly(String assemblyFile, Boolean lockFile)
at Stimulsoft.Report.StiReport.Compile(String path, Stream stream, StiOutputType outputType, Boolean autoCreate, Object standaloneReportType)
at Stimulsoft.Report.StiReport.Compile(String path)
at Cardax.FT.StiUtil.<>c__DisplayClass7.<ToStiReport>b__4(DataTable table) in c:\Dev\FTMain\Elmo\WPFClient\Common\ReportCommon\StiReportHelper.cs:line 991
at System.Reactive.Linq.Observable.SelectObservable`2.Observer.Next(TSource value)


The C:\TestDir\MyStiReportTempAssembly.dll is not there.
The procmon logs says the same the same along with following:
CSC.exe ProcessExit exit status -1073741502

Bit of more brief:
===================
Our exe called CCNTSad.exe is the one who generates these reports (output to pdf).
When this exe is run as a Windows Service (under Local system) then after generating ~2000 reports they start failing.
However if I run CCNTSad.exe as a normal EXE (not as a service) then this problem doesn't happen. I am not sure why but it might be a clue for you.
I don't have access to code after doing report.Compile() - as this is the one who throws exception.

Please let me know if something triggers to you.

Thank you.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Reports failing with 'Could not find file 'C:\Windows\TE

Post by HighAley »

Hello.

If you use the one or several report templates, it's better to load reports from assembly of use interpretation mode.
You could get more info in this forum topic.
Also, please, read next section of our Programming manual.

Thank you.
sandynith
Posts: 64
Joined: Thu Dec 12, 2013 4:03 am

Re: Reports failing with 'Could not find file 'C:\Windows\TE

Post by sandynith »

Hi Aleksey,

I know I am quite late in replying to this post, but I must say your advice about using GetReportFromAssembly worked very well, and now we can run our reports endlessly without causing any failure/memory hikes..

Thanks a lot for the references and advice.

Cheers,
Sandeep
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Reports failing with 'Could not find file 'C:\Windows\TE

Post by Alex K. »

Hello,

We are always glad to help you!
Let us know if you need any additional help.

Thank you.
Post Reply