Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) FCX Crashes (Read 4791 times)
asloan
YaBB Newbies
*
Offline



Posts: 35
Joined: Mar 6th, 2006
FCX Crashes
Nov 13th, 2007 at 3:38pm
Print Post  
I know that this is somewhat vague, but I hope that you can give me some pointers on what to look for.

We have a VB app which gets data from another app and creates a diagram from that data.  The diagram is laid out in a tree format down to a specified level, and then those branches are laid out bordered. Each box is grouped to it's parent.

Often times the border aligned branches are very long vertically, so we have provided a right-click option which will allow the user to split those long branches into multiple vertical branches.  This is done by creating "dummy" nodes to the parent and attaching the child nodes, distributed equally, to those dummy nodes.

This is working great, except that for large diagrams(1000+ nodes), after splitting branches a couple times, the FCX control will often crash as if the diagram is too large for it to process.  I have included error handling in every piece of code and it is never hitting the error handling code.

Any ideas? Let me know if you need more details of what the code is doing.

Thanks,
Alan
  
Back to top
 
IP Logged
 
asloan
YaBB Newbies
*
Offline



Posts: 35
Joined: Mar 6th, 2006
Re: FCX Crashes
Reply #1 - Nov 13th, 2007 at 5:51pm
Print Post  
In follow-up, I think that I have the problem isolated to this function. This function is suppossed to re-group all nodes to their parents. Do you see any problems with this code that would cause such a crash?

---------------------------------------------------------------
Private Sub reGroupAll()
Dim gr1 As group
Dim x As Integer
Dim y As Integer
Dim bx As box
Dim pBox As box
Dim aTmp() As String

On Error GoTo reGroupAll_Error

'Destroy all groups
For x = FC(fcIdx).Groups.Count - 1 To 0 Step -1
Set gr1 = Nothing
Set gr1 = FC(fcIdx).Groups(x)
FC(fcIdx).DestroyGroup gr1
Next x

'Re-group everything
Set gr1 = Nothing
For x = 0 To FC(fcIdx).boxes.Count - 1
Set bx = Nothing
Set bx = FC(fcIdx).boxes(x)
Set gr1 = Nothing
If bx.OutgoingArrows.Count <> 0 Then
Set gr1 = FC(fcIdx).CreateGroup(bx)
If Not gr1 Is Nothing Then
For y = 0 To bx.OutgoingArrows.Count - 1
Set pBox = Nothing
Set pBox = bx.OutgoingArrows(y).DestinationBox
gr1.AttachToCorner pBox, 0
Next y
End If
End If
Next x

On Error GoTo 0
Exit Sub

reGroupAll_Error:
WriteErr "Error " & Err.Number & " (" & Err.Description & ") in procedure reGroupAll(line:" & Erl & ") of Form frmPreviewFCX"

End Sub
---------------------------------------------------------------
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: FCX Crashes
Reply #2 - Nov 14th, 2007 at 6:11am
Print Post  
Please email the saved flowchart file to support@mindfusion.eu. Does it crash while that code executes, or later on when the control should redraw the tree on the screen?

Stoyan
  
Back to top
 
IP Logged
 
asloan
YaBB Newbies
*
Offline



Posts: 35
Joined: Mar 6th, 2006
Re: FCX Crashes
Reply #3 - Nov 14th, 2007 at 8:08pm
Print Post  
It crashes while the code executes. I've added logging into my application and it always crashes on this line:

gr1.AttachToCorner pBox, 0

Once in a while, it will actually complete the re-grouping, but as soon I click anywhere in the FCX control...CRASH! The FC_Clicked event never fires when the crash happens in this case.

It almost seems like the control is merely being overloaded. There's one more test that I'm going to perform and that is I'm going to turn off the BeginUndoRecord/EndUndorecord stuff to see if maybe the amount of actions being recorded is causing the failure.

In the meantime, I'm e-mailing the flowchart file.

Thanks,
Alan
  
Back to top
 
IP Logged
 
asloan
YaBB Newbies
*
Offline



Posts: 35
Joined: Mar 6th, 2006
Re: FCX Crashes
Reply #4 - Nov 14th, 2007 at 8:25pm
Print Post  
OK, I've completed the test I mentioned in the last post about turning off the BeginUndoRecord/EndUndorecord stuff and guess what...No Crashes!!

So..That said, is there something that I can do that will allow me to use the BeginUndoRecord/EndUndorecord features? I REALLY need to be able to use this functionality as the diagrams we generate take A LOT of time to create and if somebody tries to split a branch and they don't like the outcome, I can't really expect them to re-run the entire diagram again, which would also undo any changes that they made to it.

FYI:  FC.UndoDepth is currently set to 2000

Thanks,
Alan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: FCX Crashes
Reply #5 - Nov 14th, 2007 at 8:50pm
Print Post  
Hi,

Have you set UndoEnabled = false, or just removed the Begin/EndUndoRecord calls?

Stoyan
  
Back to top
 
IP Logged
 
asloan
YaBB Newbies
*
Offline



Posts: 35
Joined: Mar 6th, 2006
Re: FCX Crashes
Reply #6 - Nov 14th, 2007 at 8:52pm
Print Post  
I removed the Begin/EndUndoRecord calls.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: FCX Crashes
Reply #7 - Nov 15th, 2007 at 7:22am
Print Post  
Our developer has traced this to a CreateStreamOnHGlobal call returning E_OUTOFMEMORY. The process has only about 30 MB of memory allocated at that point, so we are not sure why that error would happen.

Our guess is that OLE might have some maximal number of memory streams that can be used simultaneously, and that number is reached when using composite undo records in your case.

In our test we have run reGroupAll() in a loop, using the diagram you have emailed us, and the error is returned for the 7th composite command. The previously saved composite records have 3396 constituent sub-records each. When not using composite commands, the records are discarded when UndoDepth is reached at 2000, so the error does not happen.

We will have to change the control to use some other memory allocation mechanism instead of OLE memory streams to work around this. For now, you could try using a small UndoDepth, e.g. allowing for only 3 or 4 composite commands to be recorded. That should ensure that the streams are disposed of before the limit is reached.

Stoyan
  
Back to top
 
IP Logged
 
asloan
YaBB Newbies
*
Offline



Posts: 35
Joined: Mar 6th, 2006
Re: FCX Crashes
Reply #8 - Nov 15th, 2007 at 3:47pm
Print Post  
Thanks for your help Stoyan. Reducing the UndoBuffer resolved the problem, however at the expense of flexibility to the user. Since merely selecting a node creates an undo record, it wouldn't be long before these composite undo records are purged from the buffer.

In my splitting code, there is a lot of stuff going on. Do you thing that this would work?

Creating smaller composite records as my split function does it's thing. Then at the end of the complete operation, using MergeUndoRecords to merge the whole process into one record.

Or would that have the same effect as one big composite undo record?

Thanks Again,
Alan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: FCX Crashes
Reply #9 - Nov 15th, 2007 at 4:15pm
Print Post  
MergeUndoRecords creates a composite record too, so it won't help much.

Now the reGroupAll sub destroys all groups, then creates them again and attaches the nodes. You can considedrably reduce the size of the composite record by not recreating all groups, but only ones related to the tree branch that has been split. Otherwise you get a sub-record added to the composite for each DestroyGroup, CreateGroup and Attach method call (for more than 700 groups in the diagram you have sent us).

Stoyan
  
Back to top
 
IP Logged
 
asloan
YaBB Newbies
*
Offline



Posts: 35
Joined: Mar 6th, 2006
Re: FCX Crashes
Reply #10 - Nov 16th, 2007 at 3:58pm
Print Post  
It seems like an UndoDepth of 7 will work for us, so I'm going to leave it at that.

Thanks for all of your help!
Alan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint