Exception on application exit calling SeriesCount

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
kent_myers
Newbie
Newbie
Posts: 23
Joined: Wed Feb 13, 2013 12:00 am

Re: Exception on application exit calling SeriesCount

Post by kent_myers » Wed Apr 24, 2013 5:40 pm

Hi Yeray,

I found some conditions that seem very reproducible:
- open the HRM130415.csv
- activate the query (7th icon from the left)
- position the mouse pointer over some of the chart bars to get feedback
- turn off the query (click 7th icon again)
- Open the MAI.csv... it will crash at the Assign(AFont) statement in TTeeCanvas.AssignFont() method.

This same crash will occur if switching back and forth between MAI and WetSide at least twice or by reading MAI twice or by reading MAI then HRM130415.

Another crash (no stack trace) occurs when doing the following:
- open HRM130415.csv twice

or

- open HRM130415.csv
- open WetSidexxx.csv
- open HRM130415.csv again (repeat back and forth between the two files at least once or until crash occurs)

Let me know if you can reproduce any of these conditions.

I cannot find a way to reproduce the marker related issue using this example application, but it happens all the time in my actual application.

Thanks,
Kent

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Exception on application exit calling SeriesCount

Post by Yeray » Thu Apr 25, 2013 2:07 pm

Hi,

We've made some more tests, now in two different machines.

I failed 4 times to open the "Browse" dialog. I experience the crash mentioned above very often with this application in my machine, with Delphi 2009.

However, in another machine (Narcís' machine) the same application seems to be more stable, still with Delphi 2009. And he even could reproduce the error in AssignFont.

I then tried with XE3 and I could reproduce the problem with it. But not in a stable way, very occasionally and this is still too big to be debugged. Please, I know it's complicate, but we can't do much more with an application of this dimension. So, could you please strip the project to the minimum code necessary to reproduce the issue here?

Note we had to add the line below to load the files. Otherwise we got no series loaded as mentioned here and here.

Code: Select all

DecimalSeparator:='.'; //FormatSettings.DecimalSeparator in XE3
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

kent_myers
Newbie
Newbie
Posts: 23
Joined: Wed Feb 13, 2013 12:00 am

Re: Exception on application exit calling SeriesCount

Post by kent_myers » Fri Apr 26, 2013 9:55 pm

Hi Yeray,

I spent the day trimming the application down. I uploaded TeeChartDemo3.zip. I am still able to reproduce the AssignFont error by first loading the HRM130415.csv, and the loading the MAI.csv. I have removed the functionality to load WetSide...csv, so don't try to load it. It is probably possible to cause many other kinds of crashes by trying to exercise UI functionality that is no longer supported in the code.

I hope this is minimal enough to aid in your investigation.

Thanks,
Kent

kent_myers
Newbie
Newbie
Posts: 23
Joined: Wed Feb 13, 2013 12:00 am

Re: Exception on application exit calling SeriesCount

Post by kent_myers » Fri Apr 26, 2013 10:17 pm

Yeray,

I forgot to mention in my previous posting that I did not understand where the code change was required that you mentioned at the end of your post. You will probably have to make that change again.

Kent

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Exception on application exit calling SeriesCount

Post by Yeray » Tue Apr 30, 2013 12:59 pm

Hi Kent,

Code: Select all

[DCC Fatal Error] FormChartTimeSeries.pas(17): F1026 File not found: 'FormChartDeviceInfo.dcu'
I've removed FormChartDeviceInfo from the uses clause in FormChartTimeSeries.pas, had to remove the ButtonNotepad declaration, 14 references to TFormDeviceInfo class, and FormChartNotepad from the uses clause in DemoMain.pas. Then it compiles, but all the classes are still being used.
When we ask for a simple example project, it's a form, a TChart on that form and a few lines of code. It uses to be the creation of a series, in your case maybe the import/read of the data in the csv file, and sometimes a few lines to modify some chart or series properties to create the environment where the dysfunction can be appreciated. The project you sent is hard for us to be debugged as it includes too many non-teechart related classes and code. Please try to arrange the minimal project necessary to reproduce the issue discusses here.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

kent_myers
Newbie
Newbie
Posts: 23
Joined: Wed Feb 13, 2013 12:00 am

Re: Exception on application exit calling SeriesCount

Post by kent_myers » Tue May 07, 2013 4:44 pm

Hi Yeray,

I don't think it will be possible to produce the demonstration code that you are asking for. I tried to reduce the code like you asked, but I just end up with a broken application that does nothing. Since I do not know what is causing the problem, I cannot just start from scratch and build a trivial application with a few lines of code that demonstrates the problem.

Here is what I did to simplify the code:

I cleaned up the problems you identified. I also commented out quite a lot of code. Although the file handling/parsing code is still there, it is no longer called. I have hard-coded the data filling in a new ReadChartData() method.

Each time you press the Browse button, it initializes a different chart from the hard-coded data and displays the chart. I am using the comboboxDateTime control to decide whether to advance to the next chart or repeat the same chart (MDY advances, anything else does not). Depending on what sequence the charts are generated, I get different errors.

The way it is set up right now, you will get a crash at AssignFont(AFont) at line 4437 of TeCanvas the second time you click the Browse button.

If you swap the lines in ButtonImportClick() where PIV and SSI are assigned to FDefaultPath, then the behavior will be very different and it will crash somewhere else after cycling through the charts several times. It will also crash when shutting down the application.

I also analyzed my code with Pascal Analyzer 6, but it did not find any problems.

I'm sorry I cannot find a simpler way to reproduce this problem, but perhaps this is now simple enough to investigate. I uploaded a new version in TeeChartDemo4.zip.

Thanks for your help,
Kent

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Exception on application exit calling SeriesCount

Post by Yeray » Fri May 10, 2013 10:55 am

Hi Kent,

I've spent about two hours removing unused methods and components in your project and the problem seems to be still reproducible as it was.
I've basically put breakpoints to all the methods in FormChartTimeSeries.pas. Then I've executed and followed the steps until reproduce the problem, removing the breakpoints where the application stopped. Then, I removed all the methods where there's still a breakpoint. With this, FormChartTimeSeries.pas reduced from 4932 lines to 1985.

Still too big to easily debug it.
Attachments
TeeChartDemo.zip
(901.14 KiB) Downloaded 675 times
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

kent_myers
Newbie
Newbie
Posts: 23
Joined: Wed Feb 13, 2013 12:00 am

Re: Exception on application exit calling SeriesCount

Post by kent_myers » Fri May 10, 2013 5:47 pm

Hi Yeray,

I have tried to eliminate a little more code, but now it crashes while constructing the first chart. My development environment removed the TChart object from the dfm file, so I had to add the TChart at runtime. I don't know if this is causing the crash or not. The crash I get has something to do with markers I think, so maybe it is helpful.

This effort to reduce the code seems to be a two edge sword. The code is smaller, but the application changes so much that it may no longer be possible to reproduce the original problem and we end up chasing something else entirely that may just be a result of removing something critical.

I will go back to the application you sent to me and try to remove different code without any impact on the resource file to see if I can get anywhere that way. In the meantime, you can take a look at this revision to see if this crash is telling you anything.

Thanks,
Kent
Attachments
TeeChartDemo.zip
revised app
(396.74 KiB) Downloaded 665 times

kent_myers
Newbie
Newbie
Posts: 23
Joined: Wed Feb 13, 2013 12:00 am

Re: Exception on application exit calling SeriesCount

Post by kent_myers » Fri May 10, 2013 9:13 pm

Hi Yeray,

I went back to your previous version and reduced the content of FormChartTimeSeries.pas to about 1000 lines. It cycles through 3 charts and then crashes. It also crashes on exit.

If you change the comboboxDateTime control occasionally, then behavior is different and crash is in a different place.

Hope we are getting close to a debuggable size.

Thanks,
Kent
Attachments
TeeChartDemo.zip
reduced application
(498.05 KiB) Downloaded 677 times

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Exception on application exit calling SeriesCount

Post by Yeray » Mon May 20, 2013 10:58 am

Hi,

I'm afraid none of the last attached applications compile fine for me here.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

kent_myers
Newbie
Newbie
Posts: 23
Joined: Wed Feb 13, 2013 12:00 am

Re: Exception on application exit calling SeriesCount

Post by kent_myers » Mon May 20, 2013 10:40 pm

Hi Yeray,

Can you give me an example of a compile error you are having? I cleaned my project and rebuilt and I don't get any fatal compile errors.

Just these:

[DCC Warning] TeePro912.dpk(240): W1033 Unit 'TeeLinearGaugeEditor' implicitly imported into package 'TeePro912'
[DCC Hint] FormChartTimeSeries.pas(90): H2219 Private symbol 'BarSeries' declared but never used
[DCC Hint] FormChartTimeSeries.pas(91): H2219 Private symbol 'PointSeries' declared but never used

Thanks,
Kent

kent_myers
Newbie
Newbie
Posts: 23
Joined: Wed Feb 13, 2013 12:00 am

Re: Exception on application exit calling SeriesCount

Post by kent_myers » Tue May 28, 2013 11:35 pm

Hi Yeray,

I realize that this is an annoying issue, but I need to get to the root cause. Maybe it is a problem in my code, but the exception continues to occur in TeeChart code.

If I am unable to resolve it, my company will very likely drop the TeeChart component and switch to DevExpress because this crash is causing our customers to complain. I hope you can spend a little more time helping me get to the root cause.

Thanks,
Kent

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Exception on application exit calling SeriesCount

Post by Narcís » Wed May 29, 2013 7:11 am

Hello Kent,
kent_myers wrote: I realize that this is an annoying issue, but I need to get to the root cause. Maybe it is a problem in my code, but the exception continues to occur in TeeChart code.
Sure, and we could reproduce it here. It is not an annoying issue, the problem is that your project is quite complex and we ended up spending too much time trying to figure out everything instead on focusing on TeeChart and the real issue. We would be very grateful if you collaborated trying to create a new simple project from scratch with the minimum code recreating the issue in this big project. My recommendation would be to make it as simple as possible avoiding all the sophistication and code that probably has nothing to do with the problem. If we can get to that point we will be glad to investigate the issue.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

kent_myers
Newbie
Newbie
Posts: 23
Joined: Wed Feb 13, 2013 12:00 am

Re: Exception on application exit calling SeriesCount

Post by kent_myers » Thu May 30, 2013 10:54 pm

Narcis,

I wrote a simple application that generates line, bar and polar charts one after the other when pushing a button, similar to my previous demo application, but of course it does not fail.

Since I have no idea what the source of the problem might be, beyond this basic chararacteristic of sequential charting, I think there is no way I am going to reproduce the problem starting from scratch.

Yeray said he was unable to compile my last attempt to reduce the original application, but he did not tell me what the problems were that he was having so that I could try to address them. The last reduced application was down to less than 1000 lines of code in the primary file (including comments). The app that I started from scratch is about 250 lines, so based on line count the difference in complexity is not that much.

If you will not investigate my reduced application that fails and I cannot think of a way to reproduce the problem starting from scratch, then I think we are at a deadlock.

I hope you will take another look.

Kent
Attachments
NewChartDemo.zip
app from scratch
(33.67 KiB) Downloaded 651 times

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Exception on application exit calling SeriesCount

Post by Yeray » Fri May 31, 2013 12:17 pm

Hi,
kent_myers wrote:Yeray said he was unable to compile my last attempt to reduce the original application, but he did not tell me what the problems were that he was having so that I could try to address them.
The application here gives me this error:
[DCC Fatal Error] FormChartTimeseries.pas(17): F2051 Unit TeeLinearGaugeEditor was compiled with a different version of TeeLinearGauge.TCustomGaugeMinMax
I've given another try. After removing the *.dcu, I can build the application without errors.
kent_myers wrote:The last reduced application was down to less than 1000 lines of code in the primary file (including comments). The app that I started from scratch is about 250 lines, so based on line count the difference in complexity is not that much.
That's right for the primary file, but what about the others?
TForm1.FormCreate calls TfrmChartTimeSeries.Create, defined at FormChartTimeSeries.pas (1090 lines)
TfrmChartTimeSeries.Create calls TTimeSeriesChartHRM.Create, defined at ClassTimeSeriesChartHRM.pas (686 lines)
TTimeSeriesChartHRM.Create calls TTimeSeriesChart.Create, defined at ClassTimeSeriesChart (1096 lines)
TTimeSeriesChart.Create calls TTimeSeriesDataTable.Create, defined at ClassTimeSeries (2989 lines)

You are not just creating a TChart, changing a few properties from it, loading some data and observing an undesired behaviour. You are customizing/extending the component so much that we can't be responsible of it.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply