Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: Module SkipList Access Violation Error
Topic Summary:
Created On: 13-May-2008 13:02
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 13-May-2008 13:02
User is offline View Users Profile Print this message


Lisa Carver

Posts: 61
Joined: 15-Jun-2005

Hi All

This will probably be simple for you all, but its driving me nuts.

My code loops through the modules in a project, processes them. Previous to that, I have opened all the modules in the database required to allow interrogation of linked objects (source modules), and added them to a skiplist.

At the end, I have the following (where mm are the modules I have opened to follow the links):

for mm in modSkip1 do
{
if (!null mm)
{
if (open(module fullName mm))
{
close(mm)
}
}
}

But when it gets to the 'if (open(module fullName mm))' line it throws an exception violation error, and I don't understand why. Any ideas would be appreciated, its got to be something simple.

Many thanks
Report this to a Moderator Report this to a Moderator
 13-May-2008 13:43
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

If I'm understanding you right, mm is a variable of type Module?

If so then you should be doing:

if(open(mm)) {
close(mm)
}


Your problem is that you're improperly using the Module type.

-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com
Report this to a Moderator Report this to a Moderator
 13-May-2008 14:07
User is offline View Users Profile Print this message


Lisa Carver

Posts: 61
Joined: 15-Jun-2005

Thank you for your reply David.

You are correct in that mm is a variable of type Module, however I get this error after changing the script:

incorrect arguments for function (open)
Report this to a Moderator Report this to a Moderator
 13-May-2008 16:03
User is offline View Users Profile Print this message


Peter Albert

Posts: 232
Joined: 30-Dec-2005

The 'open' perm works on variables of type 'ModName_', this is why it throws an error when you use the 'Module' variable. The 'module' perm actually returns a 'ModuleName_' type variable, therefore the 'open(module fullName mm)' construction works in your code.

Unfortunately, this does not help on your original problem :-)

The exception violation error typically occurs when you loop through a Skip list with a wrong variable type, hence, I would double-check whether 'mm' is *really* of Module type, and whether you *really* did put modules into the Skip list.

Regards,

Peter
Report this to a Moderator Report this to a Moderator
 13-May-2008 16:37
User is offline View Users Profile Print this message


Lisa Carver

Posts: 61
Joined: 15-Jun-2005

Thank you Peter, I will investigate your suggestions.
Report this to a Moderator Report this to a Moderator
 13-May-2008 21:22
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

... clarification ... make sure you put a 'Module' handle as the DATA of the Skip list. That's important since the "for thing in Skip" look loops through the DATA, not the KEY. If you put a 'Module' as the Key and perhaps the Name as the Data, then your skip loop may look like this:

string NameMod
Module mm

for NameMod in ModSkip1 do
{ mm = (Module key ModSkip1)
now check mm
}

- Louie
Report this to a Moderator Report this to a Moderator
 13-May-2008 22:09
User is offline View Users Profile Print this message


Kris Farrin

Posts: 5
Joined: 22-Aug-2006

I've run into the very same problem a few different times--in different scripts--so I'd say I'm quite confident it's not a coding error. It only seems to occur when you have a lot of modules open (I'm guessing 20 or 30+, but I've never tested it to find out when it starts occurring). It will work fine with less modules open, and will even close some of the modules in the list fine, but may crash somewhere in the middle.

I've thought about reporting it, but Telelogic always wants a copy of our code and our database, which we can't provide, so unless it's a huge problem for us we try to find a work around. In this case it's always been either closing the modules when they're no longer needed, or simply making sure they're saved and leaving them open. The latter uses a lot of memory, but is better than totally grenading Doors.

Maybe someone else will know something more.
-Kris
Report this to a Moderator Report this to a Moderator
 14-May-2008 13:23
User is offline View Users Profile Print this message


Lisa Carver

Posts: 61
Joined: 15-Jun-2005

Thanks Kris and Louie

I put the modules in the skiplist as follows:

Module mm

mm = read(fullName(i), false)
put(modSkip1, fullName(i), mm)

and close at the end like this:

for mm in modSkip1 do
{
if (!null mm)
{
if (open(module fullName mm))
{
close(mm)
}
}
}

This appears to work for some scripts as Kris says, but not on this particular one, and I can't tell what the difference is.
Report this to a Moderator Report this to a Moderator
 14-May-2008 13:32
User is offline View Users Profile Print this message


Scott Boisvert

Posts: 348
Joined: 14-Apr-2006

When creating modSkip1 did you use create () or createString (). Your using a string as key for the skip list which if you use create () could cause an issue. Try using createString () when creating modSkip1.

-------------------------
Scott Boisvert
Engineering Tools Administrator
L-3 Communications - Avionics Systems
scott.boisvert@l-3com.com
Report this to a Moderator Report this to a Moderator
 14-May-2008 13:41
User is offline View Users Profile Print this message


Lisa Carver

Posts: 61
Joined: 15-Jun-2005

Thanks Scott, but I did create the modSkip1 with createString().

Thanks anyway
Report this to a Moderator Report this to a Moderator
 14-May-2008 15:08
User is offline View Users Profile Print this message


Scott Boisvert

Posts: 348
Joined: 14-Apr-2006

Worth a try.

What's your memory look like when you get the error?

I've received a similar error when DOORS sucks up all the system memory (just got this error on another script, which prompted this thoughy).

I ran the attached script in a project with 800+ modules on a client that has been connected to my test server for a couple days (all ready sucking up a bunch of memory) and was able to duplicate the Access Violation Error. I closed the client and opened a new client and reran the script with no issues.

Is it possible that you're opening so many modules along with all the other processing that your running out of system memory?

During testing of some of my scripts I'll run them with the task manager open and monitor their memory/CPU usage in the Processes tab.

-------------------------
Scott Boisvert
Engineering Tools Administrator
L-3 Communications - Avionics Systems
scott.boisvert@l-3com.com
Report this to a Moderator Report this to a Moderator
 14-May-2008 21:29
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

My testing shows that you can still get the name and the 'open' state of a 'Module' handle, so long as its not null, even if that Module has been closed, even after making the script wait a respectable amount of time for the Handle to get corrupted, which it doesn't. That makes your code better and therefore baffling why its aborting.

- Louie
Report this to a Moderator Report this to a Moderator
 14-May-2008 22:17
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

... Correction. After waiting a rediculous amount of time, the 'Module' handle of a closed module finally produced an exception violation diagnostic log.

Attached is my test code. Modify the 1st line to point to an actual formal module. Run the script, then Open. Then Info and see that 'true' is in the middle indicating its open. Close. Info, notice 'false' but otherwise good information about the module (specifically its 'fullName'). Hit Info button as often as you like, every minute or so, and eventually (after 45 minutes) the module handle gets corrupted and you get an exception violation, in spite of the 'noError' 'lastError' error traps.

That's all very curious. Guess you cannot store Module handles for later.

In your case, you could get the fullName out of the Skip list and check to see if its still open, and if it is THEN use the Module handle in the Skip to close it. Hhhmmmm, I wonder if that would work perfectly if the module is closed, then opened again, after you insert it into the Skip. Either that, if its still open, ignore the Module handle in the Skip and get a new module handle by opening the module read-invisible.

- Louie

PS. This disovery caused me to change some code of my own that stored Module handles and compared them to currently open Modules.
Report this to a Moderator Report this to a Moderator
 16-May-2008 15:08
User is offline View Users Profile Print this message


Lisa Carver

Posts: 61
Joined: 15-Jun-2005

May I extend my thanks to all of you for your help and suggestions.

I think I was trying to close modules that were already closed, but having said that, I thought I had tried to trap that in the skiplist close modules routine, so I am still stumped. However the script does run ok now.
Report this to a Moderator Report this to a Moderator
 16-May-2008 15:42
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

Yes, it looks like the Module handle eventually becomes perhaps 'corrupted' some time after you close the module. Thus storing them in a Skip for later retrieval isn't that reliable, so you need to store that info differently, and the fullName seems like a good candidate.

- Louie
Report this to a Moderator Report this to a Moderator
 30-Aug-2008 01:11
User is offline View Users Profile Print this message


Thomas Young

Posts: 20
Joined: 12-Apr-2005

While looking for another issue I came across this interesting thread. Glad to see I'm not alone in wrestling with Skiplists! This thread helped me get an upper hand in the battle. Thanks.

btw, another way to close all the modules you have opened is:

for m in current Project do close m

Where m is a Module variable. The DXL help calls this the "for open module in project" for-loop.

Edited: 30-Aug-2008 at 01:12 by Thomas Young
Report this to a Moderator Report this to a Moderator
 1-Sep-2008 08:43
User is offline View Users Profile Print this message


Paul Howstan

Posts: 47
Joined: 27-Sep-2006

Hi,

There's also for Module in database which loops round every module that the current user has open in the entire database. If you combine this with the skip list, you can then only close the modules that your code has opened.

for mod in database do
{
if(module is in skip list) close(mod)
}

i.e. the dxl script must add the name or ModName_ reference to the skip list if it wants it to be closed at the end.

The reason for doing this is that closing the modules in the skip list does not always behave itself (or so I've found). I often have modules left over after the close function that will not close (probably because they reference each other and the for loop is itterating through them in the wrong order). However, the for module in database loop some how overcomes this problem and all modules are closed. Also, it doesn't matter if the user accidentilly closes a module while your script is running as it will be ignored in the for module in database loop.

Hope this helps a little,

Paul
Report this to a Moderator Report this to a Moderator
 3-Sep-2008 16:09
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

I prefer to get a handle on all modules that are open when the script starts, and at the end of the script close all open modules that are not in the original list. That's easier than trying to keep track of each and every module your script opens, especially since your script may open a module that is already open.

- Louie
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.