stackoverflow exception, best way to debug?

Questions about MultiCharts .NET and user contributed studies.
gvandenbosch
Posts: 30
Joined: 24 Oct 2013
Has thanked: 9 times
Been thanked: 3 times

stackoverflow exception, best way to debug?

Postby gvandenbosch » 27 Nov 2013

Hi,

When debugging my multicharts signal with visual studio sometimes a stackoverflow exception occurs. With small programs this is easily found.

However my signal is quite big now and it works properly when I load in 30 or 50 days.
But when I load in 100 days a stackoverflow exception occurs and there is no trace where it breaks on. It just tells than a module has an error.

How do I debug this kind of error easily, because stepping through the code for more than 50 days is quite time killing.

Cheers,
Gerard

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: stackoverflow exception, best way to debug?

Postby Henry MultiСharts » 27 Nov 2013

Hello Gerard,

You can use DebugDiag + Application Verifier for that.

gvandenbosch
Posts: 30
Joined: 24 Oct 2013
Has thanked: 9 times
Been thanked: 3 times

Re: stackoverflow exception, best way to debug?

Postby gvandenbosch » 28 Nov 2013

Thanks for the program suggestions.

I have tried them both and the DebugDiag gives something usefull.

Code: Select all

Count: 1
Type: System.NullReferenceException
Message:
Stack:
ChartingPlugin.Settings.VolumeProfileSettings.get_Defaults()
ChartingPlugin.VolumeProfile.InstrumentProperties(IntPtr)
<Module>.CChartingPluginInteropImpl.GetPropertyPageForSeria(CChartingPluginInteropImpl*, Int32, IUnknown*, IUnknown**)*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\Program Files\TS Support\MultiCharts .NET SE\ChartingPluginInterop.dll -
My only problem is that I don't know which MultiChart function is using this functions.

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: stackoverflow exception, best way to debug?

Postby Henry MultiСharts » 29 Nov 2013

Different exeptions can appear during MultiCharts operation. Most of them are expected behavior and are not actual errors. As you need to analyze the particular stackoverflow exeption you have - you can disaregard the other exceptions generated by MultiCharts.

gvandenbosch
Posts: 30
Joined: 24 Oct 2013
Has thanked: 9 times
Been thanked: 3 times

Re: stackoverflow exception, best way to debug?

Postby gvandenbosch » 02 Dec 2013

Hi Henry,

Ok, I see.

However my problem is a bit, I configured DebugDiag with full dump for stackoverflow.

The output I am getting multiple times is:

Code: Select all

[11/28/2013 7:54:27 PM] First chance exception - 0XE06D7363 caused by thread with System ID: 3588. DetailID = 5
When I look at DetailID5 I get:

Code: Select all

DetailID = 5
Count: 27
Exception #: 0XE06D7363
Stack:

WARNING: Stack unwind information not available. Following frames may be wrong.
KERNELBASE!RaiseException
MSVCR90!CxxThrowException
Dam
Dam
Dam
This and all the error messages are quite vague, is there an option to get more information of the crash or is this the information I have to do it with?

Cheers,
Gerard

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: stackoverflow exception, best way to debug?

Postby Henry MultiСharts » 02 Dec 2013

Gerard, please attach a mini dump for this exception or send it to my email (support@multicharts.com) and we will check it.

gvandenbosch
Posts: 30
Joined: 24 Oct 2013
Has thanked: 9 times
Been thanked: 3 times

Re: stackoverflow exception, best way to debug?

Postby gvandenbosch » 02 Dec 2013

Hi Henry,

Attached is the mini dump, thank you very much for wanting to take a look at it.

Cheers,
Gerard
Attachments
MultiCharts__PID__2516__Date__12_02_2013__Time_12_38_16PM__505__Log.txt
(389.21 KiB) Downloaded 488 times

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: stackoverflow exception, best way to debug?

Postby Henry MultiСharts » 02 Dec 2013

Gerard, this is not the dump file itself. This is the file that is created with the dump. Please attach the dmp file itself.

gvandenbosch
Posts: 30
Joined: 24 Oct 2013
Has thanked: 9 times
Been thanked: 3 times

Re: stackoverflow exception, best way to debug?

Postby gvandenbosch » 02 Dec 2013

Hi Henry,

There is no dump file created only this log file.
I've added the stack overflow exception with mini dump.
I have looked on google and looks like I set up everything right.

When I attach it to multicharts.exe this is correct?

Cheers,
Gerard

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: stackoverflow exception, best way to debug?

Postby Henry MultiСharts » 03 Dec 2013

0) Unzip the attached file;
1) Start DebugDiag;
2) Deactivate your rules;
2) Click Import button at the bottom of the program window;
3) Locate to the RuleForStackOverflowForProcexxMultiChartsEXE.ddconfig file and select it->Open->OK to confirm rule import;
4) You can start MultiCharts Net now and replicate the stackoverflow issue;
The dumps will be created in the following folder once the issue is replicated.
“C:\Program Files\DebugDiag\Logs\Crash rule for all instances of MultiCharts.exe”

Please send me the dump file/s and we will study them.
Attachments
RuleForStackOverflowForProcexxMultiChartsEXE.zip
(499 Bytes) Downloaded 176 times

gvandenbosch
Posts: 30
Joined: 24 Oct 2013
Has thanked: 9 times
Been thanked: 3 times

Re: stackoverflow exception, best way to debug?

Postby gvandenbosch » 04 Dec 2013

Hi Henry,

Did the steps exactly but still doesn't create a dump only a log file.

When I run through visual studio, it says it had stack overflow exception but doesn't create a logfile.

Could it be that without visual studio it crashes earlier on another exception?

Cheers,
Gerard

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: stackoverflow exception, best way to debug?

Postby Henry MultiСharts » 04 Dec 2013

Gerard,

Debugging user signal goes beyound our technical support. We can do that only as the custom project for you. If you are interested in it - please email me.
If you are able to replicate the same exception with any of the prebuilt studies please provide the following information:
- workspace you are using;
- in QuoteManager select the symbol you are using, make a right click on it->Export data->Export instrument (with data). Send me the Qmd export file for analysis;
- please attach a detailed problem description and highlight the problem on the screenshots;
- what exact version and build number of MultiCharts are you running? (in MultiCharts go to Help tab-> About)

gvandenbosch
Posts: 30
Joined: 24 Oct 2013
Has thanked: 9 times
Been thanked: 3 times

Re: stackoverflow exception, best way to debug?

Postby gvandenbosch » 05 Dec 2013

Hi Henry,

Thanks for the offer.
However I am doing this project for someone else and can't make public any code.

This is just an error I am walking into that I didn't encounter before programming C# and it is quite hard to get to the bottom of it.

Anyway, thanks for your help so far :).

Cheers,
Gerard

gvandenbosch
Posts: 30
Joined: 24 Oct 2013
Has thanked: 9 times
Been thanked: 3 times

Re: stackoverflow exception, best way to debug?

Postby gvandenbosch » 08 Dec 2013

Hi,

I found the line causing the exception, this is:

Code: Select all

dTmpPrice = historyList[i].bars[j].Close;
The strange thing is that, it works well with like 10 or 30 days.
But when putting it to 100 days then it crashes on this line.

I have tried checking if the bars object existed by putting following line above:

Code: Select all

if(historyList[i].bars[j] != null)
Still the code crashed here.
But above this code I am checking time and doesn't crash, so tested this:

Code: Select all

dTmpPrice = (double)historyList[i].bars[j].Time.Second;
This works fine and no exception occurs.

It seems that there is something wrong with the close parameter by loading in a lot of data.
Seems like a bug in your dataloader...

tradetree
Posts: 81
Joined: 29 Apr 2013
Location: www.threefoldmarkets.com
Has thanked: 12 times
Been thanked: 16 times
Contact:

Re: stackoverflow exception, best way to debug?

Postby tradetree » 08 Dec 2013

I do a lot of programming in C# for several trading platforms. I am surprised at how much trouble it is causing you because usually I can run in VStudio until it hits an exception. With code analysis and information from memory dumps and indexes I usually find a bad index or other pointer going out of range. It is really hard to look at a code snip and say anything useful, but with a double index, historyList.bars[j].Close, plus the accessor at the end there is a lot of room for bad indexes. I would look for bad castings or i or j out of range. It is possible that something is thinking the object is of one type, but it has been reclaimed by the garbage collector and is no longer pointing at a valid object.

Best of luck.

gvandenbosch
Posts: 30
Joined: 24 Oct 2013
Has thanked: 9 times
Been thanked: 3 times

Re: stackoverflow exception, best way to debug?

Postby gvandenbosch » 09 Dec 2013

Hi,

Unfortunatly visual studio doesn't catch a stack overflow exception anymore since .net 2.0.
If the logic with the indexes was wrong it should as well crash at 10 or 30 days of data.
And most of times when an index is out of range an outofrange exception is thrown and the debugger catches it.

The double index is nothing special, it is simply a list with days and for each day it contains a list with the bars that are delivered from the dataloader.

The other thing is that I can access the Time property. Also the object isn't null.
The actual snippet is like this:

Code: Select all

for(int j = 0; j < this.historyList[i].bars.Count(); j++)
{
TimeSpan tmpTimespan;
// Look for bar in the same minute
if(currentbarDate > historyList[i].bars[j].Time)
tmpTimespan = currentbarDate - historyList[i].bars[j].Time;
else
tmpTimespan = historyList[i].bars[j].Time - currentbarDate;

if(tmpTimespan.TotalSeconds <= 60)
{
// Save the price
dTmpPrice = historyList[i].bars[j].Close;
break;
}
}
If the bar was non-existent or out of range, it should already crash at the part where it gets the Timespan, but this works properly.

The list is created once, and nothing gets deleted from it.
It seems something really wrong with some of the bars I receive from the dataloader when I load in a lot of days.

Cheers,
Gerard

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: stackoverflow exception, best way to debug?

Postby Henry MultiСharts » 12 Dec 2013

Gerard, we will be able to help you only when the information is provided as requested in my post #12 of this thread. You can also check this discussion for useful information.


Return to “MultiCharts .NET”