Author Topic: "A resource was"-dialog pops up on diagr  (Read 6124 times)

kosh.iii

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
"A resource was"-dialog pops up on diagr
« on: June 12, 2009, 11:16:33 pm »
I'm working with the Java eaapi.jar and use the convenience method below to perform an auto-layout and image export in one step:

Code: [Select]
   /**
     * @param diagramGUID
     * @param imageExportFile
     * @param l
     */
    public static void layoutAndImageExport(String diagramGUID, String imageExportFile, EaDiagramLayout l) {
        File imageExport = new File(imageExportFile);
        Diagram diagram = getDiagram(diagramGUID);
        if (!imageExport.getParentFile().exists())
            imageExport.getParentFile().mkdirs();
        try {
            repository.GetProjectInterface().LayoutDiagramEx(diagramGUID, l.getLayoutStyle().getId(), l.getIterations(),
                    l.getLayerSpacing(), l.getColumnSpacing(), false);
            repository.GetProjectInterface().PutDiagramImageToFile(diagramGUID, imageExport.getAbsolutePath(), 1);
            if (logger.isDebugEnabled())
                logger.debug("Exported '" + diagram.GetName() + "' to file " + imageExport + " [" + imageExport.length()                        + " Bytes]");
        } catch (Exception e) {
            logger.error("Error occured layouting/exporting diagram " + diagram.GetName() + ": "
                    + repository.GetProjectInterface().GetLastError(), e);
        }
    }

In most cases this works absolutely well. But in some cases my Java application will freeze as an invisible modal popup dialog appears. You can get to the dialog using <Alt-Tab> and sometimes it reveals its content, which is always: A required resource was - Nothing more, just this text and an "Ok" button which I must activate to dismiss the dialog - and then my Java application resumes it's work - until the next diagram causes this dialog to pop up.

Has anyone of you ever experienced something like this? Can you tell me that this - obviously incomplete - error message is telling me?
« Last Edit: June 13, 2009, 12:11:38 am by kosh.iii »

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: "A resource was"-dialog pops up on diagr
« Reply #1 on: June 15, 2009, 05:00:27 pm »
Please confirm which version of EA you are currently using.  Make sure you are running the latest build of EA from our website (currently EA 7.5 build 845) and try running your code again.

If the issue continues, submit an official bug report so we can investigate this issue further.

Van Lepthien

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: "A resource was"-dialog pops up on d
« Reply #2 on: September 23, 2010, 06:04:08 am »
I am having a similar problem with EA 7.5 build 850. Has this been addressed in 8.0?

kosh.iii - did you get a resolution?
« Last Edit: September 23, 2010, 06:05:20 am by VLepthien »

mrf

  • EA User
  • **
  • Posts: 311
  • Karma: +0/-0
    • View Profile
Re: "A resource was"-dialog pops up on d
« Reply #3 on: September 23, 2010, 08:41:52 am »
The method PutDiagramImageToFile() must open the diagram in question to take an image of it. Unfortunately at the moment it doesn't actually close it if it wasn't open to begin with.

So what you'll find is that if your method layoutAndImageExport() is within a loop you'll be accumulating a mass of open diagrams which chews up the amount of Windows graphical resources at EAs disposal.

The error message you are getting is that there aren't any more resources left to be assigned to EA.

The workaround is quite simple, just get a reference to the diagram ID that you are layingout/saving to file and call Repository.CloseDiagram() after you've saved it to file.

Can you also please bring this to the attention of support so that it is logged for resolution.
« Last Edit: September 23, 2010, 08:43:48 am by mfraser »
Best Regards,

Michael

[email protected]
"It is more complicated than you think." - RFC 1925, Section 2.8

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13241
  • Karma: +554/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: "A resource was"-dialog pops up on diagr
« Reply #4 on: September 23, 2010, 03:23:06 pm »
Michael,

Is this related to the "error creating window handle" issue?
I get this error regularly when I have Visual Studio, EA, SQL Server Managament studio and things like that open.
It seems that one or more of those applications keeps allocating window handles without releasing them. After a while all my window handles are gone, and I can't even get a context menu in Windows.
Closing one of the "big" applications usually solves the issue for a while, but every once in a while I need a complete reboot to get anything done.
It looks like it is related to the docked windows framework that is used by EA, VS, SQL Server Management Studio.

Geert

mrf

  • EA User
  • **
  • Posts: 311
  • Karma: +0/-0
    • View Profile
Re: "A resource was"-dialog pops up on diagr
« Reply #5 on: September 24, 2010, 09:00:16 am »
Geert,

I'm not totally sure if its related. While EA is a fairly hungry user of GDI resources we do take care to ensure that they are freed when they are finished with. Obviously the more diagrams/docked windows you have open the more will be used.

The problem in this case is that (for some reason) the automation interface does not close a diagram after a particular operation (contrary to the users' expectation). Whether this was a concious design decision (ie the user may want to use the diagram later on) or an oversight I'm not sure.

You can track GDI object/handle usage through the stock Windows task manager. Just make the appropriate columns visible.
Best Regards,

Michael

[email protected]
"It is more complicated than you think." - RFC 1925, Section 2.8

itwerx

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: "A resource was"-dialog pops up on d
« Reply #6 on: September 30, 2010, 04:58:25 am »
Similar issue here running a 30-day demo of 8.0.863.13 on Windows 7 (64bit) trying to import a source tree of ~10k files, (mostly php, if that's relevant).  It ran for 30min or so then got a half-dozen of those resource errors after which it became completely non-responsive, though the rest of the system is running fine and other apps are having no problems.  Ideas. anyone?
« Last Edit: September 30, 2010, 05:13:42 am by itwerx »

itwerx

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: "A resource was"-dialog pops up on diagr
« Reply #7 on: September 30, 2010, 08:25:35 am »
Had creation of logical diagrams enabled and noticed it wasn't closing them after creation.  Turning that off "fixed" it.