When the Kepler dev has been running for a long time (a few hours), there appears to be a problem with the configuring ports on all of the actors. When you add a port and hit commit, it doesn't do anything and the window w/ of the configuring ports just stays open. when you exit out if you decide to save ports, nothing happens and the window remains open. If you decide to not save port modifications, then the window closes but nothing's saved. This has happened a few times on mine but is solved when you close and restart Kepler.
#2 Updated by Oliver Soong about 11 years ago
I think I'm able to replicate this. FYI, I still have 12506K memory free. I'm not sure it's a memory issue, and I'm not sure it's related to running Kepler for a long time. I think it has to do with misconfiguring ports. I suspect some error handling is causing some sort of inconsistent state. I'll try and find out a few more specifics on this, as it's going to bite me a bunch of times in the near future. I get this in the console:
Exception in thread "AWT-EventQueue-0" ptolemy.kernel.util.InternalErrorException: Port stored in _ports not found in actual target.
#4 Updated by Oliver Soong about 11 years ago
I can't seem to figure out exactly what replicates it. The closest I can come is getting ports to swap relations.
I don't know if they're actually related. Take two ports (e.g., input named in and and output named out). Hook them up (so the pre-actor outputs to "in" and the post-actor receives from "out". Open the ports window and swap the names, then click apply. You get an error. You can't apply again, but you can commit. As soon as you do that, the relations swap sides.
#6 Updated by Christopher Brooks about 11 years ago
I was able to reproduce this once, but now I can't.
The problem here is that swapping the name of two ports (or any two objects that
extend NamedObj) require renaming one to a temporary name first.
So, to swap A and B.
1. Rename A to C
2. Click Apply
3. Rename B to A
4. Click Apply
5. Rename C to B
6. Click Commit.
When I use the port configuration dialog to just swap two names:
1. Rename A to B
2. Rename B to A
3. Click Apply
I get a name duplication exception, which is as expected. What happens
here is that the table is processed by row and any change requests are
added to StringBuffer of change requests. When all the rows are done,
all the change requests are executed. So, when swapping two names,
the first change request tries to change the name of A to B, but there
is already a B, so we get a name duplication exception. Then, the
second change request occurs, which is to swap B to A, but A still
exists, so we get a second name duplication exception. This is as expected.
One strange thing is that the error is reported to stderr instead of being
popped up in a dialog. This is because the error occurs in the Swing Event Thread.
I modified the code so that it calls MessageHandler.error() so that the
an error dialog will appear.
PortConfigurerDialog checks to see if there are duplicate names, checking
for swapped names seems rather tricky and error prone. To do this would
require doing a bunch of the name duplication checks that we do anyway.
So, unless we get a more compelling and reproducible test case that brings
up the stack trace, I'm tempted to leave this one as is with the error
message coming up in a dialog and the error message giving a hint about
how to swap names.
#7 Updated by Oliver Soong about 11 years ago
It's frustrating that we can all see the original bug, but can't reliably replicate it.
As for the port swapping thing, one way to get rid of the port swapping problem is to process all the port changes, then error check, rather than error check at each step. I don't know how hard that is to do, but as long as there's an "original copy" to go back to in case the final fails validation, internal intermediate clashes won't matter.
#8 Updated by Christopher Brooks about 11 years ago
I modified PortConfigurerDialog._apply() so that if the change request fails,
then the port configurer dialog will close. The reason is that if the
change request fails, then who knows what the problems are with the ports.
It is easier to start over. A better solution would be to have better undo/redo
in the dialog.