Hi! I have written a export script from doors to excel. The thing is that this script exports all modules in a folder to excel worksheets. All modules have the same view. The problem now is, I get after exporting three modules this crash:
DOORS: **** Translating a structured exception ****
DOORS: argv[0]: C:\Program Files (x86)\IBM\Rational\DOORS\9.5\bin\doors.exe
In the last line of the print you can read, that a dumpfile was written, but I can't open the dumpfile with the windows texteditor or so! Which programm I need to open this dumpfile? Furthermore, I can't interprete this crash dump above and I don't know why the script crashes exactly after exporting three modules! Can anybody help me? Thank you! tobi_mehrl - Tue Sep 08 04:30:18 EDT 2015 |
Re: My script crashes! I am not sure if you can get viable information from this traceback. Also from just this traceback without any code to go on you should not expect a lot of feedback. There could be any number of reasons for this error. Judging from the traceback: This is an access violalation, that was sent from a DXL GUI code part (sendMessage). Most likely this happens, because the DOORS client sends a window message to a closed or destroyed dialog or dialog part. This can happen e.g. in the following cases: - You called destroy from a callback. Never call destroy from a callback. - You called destroy on a dialog that was shown with show(DB). Only use hide. - Your DXL or DOORS is trying to interact with a dialog that was parented to the current module, but the current module was closed and therefore the dialog invalidated by DOORS: In this case parent the dialog to the dbExplorer.
For fixing the error I would start to add dbExplorer as the parent of the dialog and removing any destroy or hide statements inside the dialog. See if this fixes the error. Hope this helps, regards, Mathias
|
Re: My script crashes! Surely there is also a DXL error in the DXL window? |
Re: My script crashes!
These outright crash dumps are always unhelpful. Especially when they cause DOORS to fail without a DXL fault statement in the DXL window. I find I have to resort to other debug methods to track down errors when this happens. I have "an approach" that tends to help with debugging that is something like as follows: Routines that have parameters passed by reference (&x) that are overloaded by routines that have similar parameters not passed by reference (x).
Falling foul of DXL's piss-poor namespace management and redefining "global" or "perm" definitions, causing unrelated code to fail. If you can eventually narrow it down to a single routine, but the error is still unfathomable, then try isolating that routine "in abstract" in the DXL execution window - and test it with various parameter values "in harness". Indeed, once you have narrowed down the error to existing within a few lines of code, you can post it to the forum and ask if anyone else has encountered problems with similar scripts or perms. But that is really only a viable option once you have done the groundwork and have isolated the problem down to a few lines of code. The fewer the better.
Good luck.
|
Re: My script crashes! AlexTidmarsh - Thu Sep 10 03:06:42 EDT 2015
These outright crash dumps are always unhelpful. Especially when they cause DOORS to fail without a DXL fault statement in the DXL window. I find I have to resort to other debug methods to track down errors when this happens. I have "an approach" that tends to help with debugging that is something like as follows: Routines that have parameters passed by reference (&x) that are overloaded by routines that have similar parameters not passed by reference (x).
Falling foul of DXL's piss-poor namespace management and redefining "global" or "perm" definitions, causing unrelated code to fail. If you can eventually narrow it down to a single routine, but the error is still unfathomable, then try isolating that routine "in abstract" in the DXL execution window - and test it with various parameter values "in harness". Indeed, once you have narrowed down the error to existing within a few lines of code, you can post it to the forum and ask if anyone else has encountered problems with similar scripts or perms. But that is really only a viable option once you have done the groundwork and have isolated the problem down to a few lines of code. The fewer the better.
Good luck.
Incidentally - for any forum readers who are relative software engineering novices - "divide and conquer" works best as a binary search, if you can see how to implement one. Binary search then itself works best if you RELIGIOUSLY stick to the rules.
When it isn't feasible to "REMOVE" code as your elimination approach, try to work out how to eliminate by deduction (e.g. using logging statements) and then apply the binary search to that instead. Quite often you can eliminate suspects by providing a minimal number of logging statements to identify code that is "working" and code that is "failing".
Final thought: If you have code that has a bad track record for bugs, give serious consideration to the idea that it is "bad code" that needs to be thrown away and rewritten from scratch - using modularity, harness testing and logging as your guide that each part of that code is doing what is expected of it.
|
Re: My script crashes! Hi > Which programm I need to open this dumpfile? By the way there are some dump files in windows and it may be that this are the same file types. http://stackoverflow.com/questions/158534/reading-a-windows-dmp-file But even it the problem is inside such a file, it is a long way. Wolfgang
|
Re: My script crashes! AlexTidmarsh - Thu Sep 10 03:31:13 EDT 2015
Incidentally - for any forum readers who are relative software engineering novices - "divide and conquer" works best as a binary search, if you can see how to implement one. Binary search then itself works best if you RELIGIOUSLY stick to the rules.
When it isn't feasible to "REMOVE" code as your elimination approach, try to work out how to eliminate by deduction (e.g. using logging statements) and then apply the binary search to that instead. Quite often you can eliminate suspects by providing a minimal number of logging statements to identify code that is "working" and code that is "failing".
Final thought: If you have code that has a bad track record for bugs, give serious consideration to the idea that it is "bad code" that needs to be thrown away and rewritten from scratch - using modularity, harness testing and logging as your guide that each part of that code is doing what is expected of it.
Actually a rigorous "binary search" is only the "best" approach when you have no idea of the affected distribution. Nobody uses a "binary search" when looking in a hard dictionary for "apple" since we know it is near the beginning. Likewise in this case, you probably have an idea where the error occurs and should be looking there. Having your first split at 5/8 and your next at 3/4 is perfectly reasonable if it narrows down the sample size. Also, even when using a binary search it doesn't matter if you split "exactly" in half or not. Going 1/4-3/4 split once doesn't disrupt the search. -Louie |
Re: My script crashes! llandale - Sat Sep 12 16:18:29 EDT 2015 Actually a rigorous "binary search" is only the "best" approach when you have no idea of the affected distribution. Nobody uses a "binary search" when looking in a hard dictionary for "apple" since we know it is near the beginning. Likewise in this case, you probably have an idea where the error occurs and should be looking there. Having your first split at 5/8 and your next at 3/4 is perfectly reasonable if it narrows down the sample size. Also, even when using a binary search it doesn't matter if you split "exactly" in half or not. Going 1/4-3/4 split once doesn't disrupt the search. -Louie
Louie, I agree totally with your first comment. In so far that it applies to searching in a SORTED list - as per Donald Knuth's algorithm and you are looking for an English word in an English dictionary. (How convenient - what sort of bugs do you usually have?)
But joking aside...
If you know something about the relationship of the "value" to its "dataset", then you can use that as a heuristic. In that case, rigor in your "search algorithm" is probably less than relevant.
This is about when you do not have any convenient debugging clues. Such as when you get a total crash of the DXL interpreter or, worse, a shutdown of DOORS, and especially when it happens without any other visible clues. And I include in this, start-up crashes when a DXL script is read, random crashes that do not appear related to what was executing, and crashes that occur when there is no visible output (in, say, silent batch scripts). Worse still, it might only occur in code you wrote and tested as ok three months ago, or code that you didn't even contribute yourself. It might even be code that works fine in isolation, but crashes DOORS when you include it in a deployed system with other people's code (oh how often that has happened!). In other words, you really do have to hunt for the DXL file or subroutine that is causing the stack-dump crash and have no basis for concluding up front which one it might be. This doesn't happen that often, but it does happen - and it can be a painful showstopper when it does.
Incidentally, Binary Elimination is probably a better term than "Binary Search", as nothing is "sorted" when bug-hunting and Knuth coined the phrase for an algorithm specific to sorted lists. But that doesn't mean you can't apply the math of binary search to elimination tests.
So I don't agree with your second comment (about not disrupting a BINARY elimination): anything but a 50:50 split is suboptimal - the BINARY split (50:50 recursively) ensures a minimal number of tests - that is how its maths works. What you are suggesting is that you can get away with a different split if you have enough heuristics to make an "educated" guess as to where the thing you are searching for lies. In other words, what you say in your first comment (about apples) is yet again correct! If you have no clue where what you are searching for lies, then you cannot apply a heuristic guess, only a "random" one, which statistically is more likely to be wrong and thus will lead to more than the optimal number of tests - so anything other than exact BINARY splitting is suboptimal unless you are lucky more than 50% of the time.
Again - it's less important if all you are faced with is a 10-line piece of code that crashes DOORS in isolation. But it is important if you have a system with thousands of lines of code and many contributors, all of whom deny responsibility exactly because their code DID work in isolation.
P.S. This binary elimination approach is also the recommended way of using MSCONFIG in Windows to track down and eliminate services and start-ups that cause Windows applications to malfunction. So it is already a well-known and generally accepted approach to debugging "the unknown". In that example, you also usually exclude the least likely candidates (Microsoft's own services) from your search set before you start. So see the description on http://www.makeuseof.com/tag/how-to-troubleshoot-your-windows-with-the-msconfig-utility/ as an example of this debugging approach (the binary search bit is at the very end of the article). The trick is then to work out how best to apply the same sort of approach to your candidate set of DXL files and DXL subroutines.
|
Re: My script crashes! Hi,
I have searched for a failure in my code. I have now found, that the use function "closeIfNonNull" is used in my own function setCell() and obviously it makes problems. This "closeIfNonNull"-function is declared in C:\...\dxl\utils\ole.inc I have attached my own function "setCell()" and the oleCloseAutoObject function in which is this closeIfnonNull()-function used. I think there is a problem with the oleCloseAutoObject function from ole functions.
Do anybody know any helpful ideas? Attachments DXL_setCell.txt |
Re: My script crashes! tobi_mehrl - Mon Sep 14 09:15:47 EDT 2015 Hi,
I have searched for a failure in my code. I have now found, that the use function "closeIfNonNull" is used in my own function setCell() and obviously it makes problems. This "closeIfNonNull"-function is declared in C:\...\dxl\utils\ole.inc I have attached my own function "setCell()" and the oleCloseAutoObject function in which is this closeIfnonNull()-function used. I think there is a problem with the oleCloseAutoObject function from ole functions.
Do anybody know any helpful ideas?
Initial thoughts: I immediately have to ask: what and where is objCell?
It is not a parameter to your routine and thus must be a global, which means its initial value when entering your subroutine is always going to be suspect. From the "semantics" of the code I would deduce that it is meant to be an OleAutoObj. I have used these a lot in my own code, for instance in the interface to CodeSite I mentioned earlier. And these can cause havoc if encountered in an unexpected state in your code. So first off, I'd find where it is declared and make sure it is correctly initialised: with OleAutoObj types, it is NEVER a good idea to rely upon auto-declare.
OleAutoObj objCell = null // Declared as null and created / destroyed elsewhere OleAutoObj objCell = oleCreate(....) // Created here, but destroyed elsewhere (be careful about the lifecycle!) or OleAutoObj objCell = SomeFunction(....) // Created and returned by SomeFunction, but destroyed elsewhere (lifecycle?) or OleAutoObj objCell SomeFunction( objCell, ... ) // Created in SomeFunction by using a reference variable (Check that it IS passed by reference!)
Similarly, check who destroys it and when. Make sure it is destroyed and not just closed!
After a bit more thought: I would have concerns about your closeIfNonNull strategy, since you do not actually ensure the object is a null, you only close it. Check that it does render the variable to a recognisable null, don't just assume it does. Try adding the line objCell=null immediately after and see if that makes a difference to the crashing.
Hope this may help. If not, then no doubt others will chip in who have already experienced writing Excel exporting routines (I haven't) and will look more to the semantics of your routine. I've merely applied a "suspicions" approach, looking for the most likely candidate for an outright DOORS crash.
To demonstrate what I mean about ENSURING destruction - here's an excerpt from my logging code base, where I ensure a "logger" ole object is truly destroyed: //------------------------------------- void CloseLogger(OleAutoObj &Logger) //------------------------------------- // Every call to StartLogger() needs to be matched with a corresponding call to CloseLogger with the same logger variable! { if (null Logger) return oleCloseAutoObject Logger logger = null }
At some point, I too had encountered outright crashes of DOORS, until I'd adopted this strategy of pairing constructors and destructors and ensuring they were called in a properly managed lifecycle - and guaranteeing that the OLE object variable would always be NULL when the object was closed. So my guess is that this may lie at the root of your problem.
P.P.S You can test whether the DXL Interpreter "thinks" you meant to auto-declare a variable by turning Auto-Declare OFF when starting DOORS. See elsewhere on this forum on how to do this (search for auto declare). Unfortunately leaving it switched off isn't always possible so because much code already out there depends on this (abhorrent) practice. There are many lazy programmers out there.
|
Re: My script crashes! Hi Alex,
thank you for your request. I have read it. You are ask where is this objCell declared. "objCell" is a global variable from type OleAutoObj and is initialised with "null".
You write: "After a bit more thought: I would have concerns about your closeIfNonNull strategy, since you do not actually ensure the object is a null, you only close it. Check that it does render the variable to a recognisable null, don't just assume it does. Try adding the line objCell=null immediately after and see if that makes a difference to the crashing."
Yes this is right. This strategy don't come from me. I must adapt a existing DXL code, but this is not that problem. Before your answer tomorrow, I have inserted a if-statement around the function closeIfNonNull in this setCell-function, like this:
if(!null(objCell)) This shows the effect, that a lot more of modules were exported to excel, but this morning I get a similar also unspecified crash from doors.
You also write: "Try adding the line objCell=null immediately after and see if that makes a difference to the crashing." Where do you mean I should insert this line? |
Re: My script crashes! tobi_mehrl - Tue Sep 15 03:14:49 EDT 2015 Hi Alex,
thank you for your request. I have read it. You are ask where is this objCell declared. "objCell" is a global variable from type OleAutoObj and is initialised with "null".
You write: "After a bit more thought: I would have concerns about your closeIfNonNull strategy, since you do not actually ensure the object is a null, you only close it. Check that it does render the variable to a recognisable null, don't just assume it does. Try adding the line objCell=null immediately after and see if that makes a difference to the crashing."
Yes this is right. This strategy don't come from me. I must adapt a existing DXL code, but this is not that problem. Before your answer tomorrow, I have inserted a if-statement around the function closeIfNonNull in this setCell-function, like this:
if(!null(objCell)) This shows the effect, that a lot more of modules were exported to excel, but this morning I get a similar also unspecified crash from doors.
You also write: "Try adding the line objCell=null immediately after and see if that makes a difference to the crashing." Where do you mean I should insert this line? Hi
if(!null(objCell)) {
objCell = null Best regards Wolfgang |
Re: My script crashes! Hi, spooky. The script from yesterday has exported 6 modules and then comes a failure. Today the crash comes after 1 module! I don't know where is the failure. The problem is still the same. The DXL action window says the problem is in line with the closeIfNonNull function. What can I do?
I have also searched for Auto-Declare off, but I don't understand how it will goes, to turn off auto-declare. Have I run a script?
Now, only a few lines for the objCell variable. This variable includes as content the content from the current attribut content from the opened doors module. This content from objCell variable is sended to a oleVariable which writes in excel cell.
PS: I have now attached my complete DXL script. I would be very pleased, if a user could read my code and give me a answer/evaluation of my code! I don't find the mistake... Attachments myOwnExcelExport.dxl |
Re: My script crashes! tobi_mehrl - Tue Sep 15 05:03:35 EDT 2015 Hi, spooky. The script from yesterday has exported 6 modules and then comes a failure. Today the crash comes after 1 module! I don't know where is the failure. The problem is still the same. The DXL action window says the problem is in line with the closeIfNonNull function. What can I do?
I have also searched for Auto-Declare off, but I don't understand how it will goes, to turn off auto-declare. Have I run a script?
Now, only a few lines for the objCell variable. This variable includes as content the content from the current attribut content from the opened doors module. This content from objCell variable is sended to a oleVariable which writes in excel cell.
PS: I have now attached my complete DXL script. I would be very pleased, if a user could read my code and give me a answer/evaluation of my code! I don't find the mistake... I already told you that the problem is here (according to the traceback), that DOORS is trying to access a property of a dialog box, that has already been closed. You need to get your dialog box closing straight. You have multiple sources that will close your dialog box 1. The trigger (when the module is closed) 2. The user pressing close (X) 3. The "OK" function after you press Export 4. The current module when you close it (because your dialog will be parented to the current module, when you start it from there) Especially problematic: Inside the close, you delete the trigger, which means, closing the module from your loop fires the trigger, fires the closeDB, deletes the trigger while you are executing it? So. Try to get this straight:
Regards, Mathias void makeBoxForModuleExport() { // dont parent to module! parent to dbexplorer! // use: excelBox = create(dbExplorer, "String_Export_Excel", styleCentred ) excelBox = centered LS_("String_Export_Excel", NLSTEMP_("Export Excel")) excelTrigger = trigger(module, close, 10, closeModuleTrig) //"Schließen"-functionality of GUI ... ok(excelBox,LS_("String_Export", NLSTEMP_("Export")), doExcel) ... close(excelBox, true, closeDB) realize excelBox } ... bool closeModuleTrig(Trigger t) { hide excelBox // hide will call closeDB? void closeDB(DB db) { delete args delete excelTrigger // delete the trigger, while we are executing? hide excelBox } void makeBoxForFolderExport() { // do not parent to current module, use excelBox = create(dbExplorer, "..", styleCentered) excelBox = centered LS_("String_Export_Excel", NLSTEMP_("Export Excel")) ... // use apply here? ok(excelBox,LS_("String_Export", NLSTEMP_("Export")), doExcel) close(excelBox, true, closeDB) }
|
Re: My script crashes! tobi_mehrl - Tue Sep 15 05:03:35 EDT 2015 Hi, spooky. The script from yesterday has exported 6 modules and then comes a failure. Today the crash comes after 1 module! I don't know where is the failure. The problem is still the same. The DXL action window says the problem is in line with the closeIfNonNull function. What can I do?
I have also searched for Auto-Declare off, but I don't understand how it will goes, to turn off auto-declare. Have I run a script?
Now, only a few lines for the objCell variable. This variable includes as content the content from the current attribut content from the opened doors module. This content from objCell variable is sended to a oleVariable which writes in excel cell.
PS: I have now attached my complete DXL script. I would be very pleased, if a user could read my code and give me a answer/evaluation of my code! I don't find the mistake... Do you get the same traceback as before for the problem with the closeIfNonNull? If not then you might actually have two different problems ... And please post the DXL error (including DXL traceback) you are getting if you have the chance ... Regards, Mathias |
Re: My script crashes!
Initial thoughts? |
Re: My script crashes! Hi, thanks to all which have answered my question. I have implemented the changes which have Mathias suggested. The problem is, that my script still makes a crash. Furthermore I will show the DXL-interaction window output and the crash dump of Doors.
Crash dump:
DOORS: **** Translating a structured exception ****
DOORS: argv[0]: C:\Program Files (x86)\IBM\Rational\DOORS\9.5\bin\doors.exe
DOORS: argv[0]: C:\Program Files (x86)\IBM\Rational\DOORS\9.5\bin\doors.exe
Interaction-Windows output: -R-E- DXL: <utils/ole.inc:239> Es ist ein unerwarteter Fehler aufgetreten: doors.exe caused an EXCEPTION_ACCESS_VIOLATION in module doors.exe at 0023:007031BD
Rückverfolgung:
The ouput of the interaction-window points to line 960. In this line the script is in the "doExcel(DB)" routine at this line setCell(row, col, s, null, NO_HEADING). If you trace back to line 504, you will get the line "closeIfNonNull objCell". My guess is, that there is a problem with this ole object. In addition closeIfNonNull() is written as Wolfgang Uhr has described!
I have also attached the new version of my script. Attachments exporter.txt |
Re: My script crashes! tobi_mehrl - Tue Sep 22 04:18:20 EDT 2015 Hi, thanks to all which have answered my question. I have implemented the changes which have Mathias suggested. The problem is, that my script still makes a crash. Furthermore I will show the DXL-interaction window output and the crash dump of Doors.
Crash dump:
DOORS: **** Translating a structured exception ****
DOORS: argv[0]: C:\Program Files (x86)\IBM\Rational\DOORS\9.5\bin\doors.exe
DOORS: argv[0]: C:\Program Files (x86)\IBM\Rational\DOORS\9.5\bin\doors.exe
Interaction-Windows output: -R-E- DXL: <utils/ole.inc:239> Es ist ein unerwarteter Fehler aufgetreten: doors.exe caused an EXCEPTION_ACCESS_VIOLATION in module doors.exe at 0023:007031BD
Rückverfolgung:
The ouput of the interaction-window points to line 960. In this line the script is in the "doExcel(DB)" routine at this line setCell(row, col, s, null, NO_HEADING). If you trace back to line 504, you will get the line "closeIfNonNull objCell". My guess is, that there is a problem with this ole object. In addition closeIfNonNull() is written as Wolfgang Uhr has described!
I have also attached the new version of my script. This traceback tells a different story, than the DXL. Very curious. The traceback says: DOORS Main -- calls --> GetThreadDesktop -- calls -> GetWindow () -- calls --> DOORS code --> Access Violation ... Looking at the description of GetWindow it says, that it will try to find a parent / child window and in its remarks we find the quote:
Also when looking at the traceback, you can see, that it is very very very short. This crash does not seem to be a normal DXL crash. Compare for example with the traceback you get executing code like that: int &ref = addr_ 0 ref = 4 If you would have the crash inside the interpreter loop of the DOORS client, then your Traceback should have many more entries. Therefore I think the DXL traceback is misleading here. Therefore it still leads me to the suggestion that something about dialogs isn't right yet.My next steps would be the following: - Remove hiding of the dialog completely, i.e. - remove the trigger from the code temporarily. - replace the remaining "ok" calls with "apply" - remove the close callback
If that doesnt bring any meaningful difference, I would replace any "tempStringOf ..." by "stringOf" to avoid, that something tries to access an invalid Buffer memory. Only if this does not bring any difference, I would go in and comment out the content of the closeIfNonNull call ... Maybe this helps, regards, Mathias
|
Re: My script crashes! Hi,
thank you for your answer. I have now find the failure in my script. I have changed the ok() function in the dialog box to apply() function in the dialog box. At this point, the script runs fine!
But, if i export a folder with e.g. 14 modules in it, the script is going very slow. A export process over 14 modules will take 3,5 hours! I know that this is a problem of the OLE automation. Do you have any Idea to accelerate this export process? |