There is no expiration for objects. However, keep in mind that the runtime
uses a garbage collection that is synchronous and not guaranteed to
complete. That means that when all references to something are removed and
that thing should be garbage collected, there is a chance that it won't get
garbage collected for a while. There is a small chance that is what is
There is also chance that a memory leak is causing code to run unexpectedly.
Let's say you have a session object with a clientId property that is
listening for changes to a valueobject and sends the changes to a server.
By listening to a valueobject, the valueobject actually has a strong or weak
reference to the session object depending on how you set it up.
Now let's say you try to destroy the session object but the value object
stays around. You might null out the app's reference to the session object
and set its clientId to null, but if you forget to remove the listener to
the value object or if you used a weak reference listener and thought you
don't have to clean it up (which is true, it will eventually go away), the
problem is that if the valueobject gets modified before the sessionobject
gets garbage collected, the old session object will get notified and call
the server with a null clientId.
Thanks for feedback.
In my case, I'm sending the data via HTTP post and not utilizing value objects (see example). In the popup window, I reference parentApplication.CLIENT_ID, which never changes after the user logs in. If say the user leaves this popup window open for 2 hours, could that exacerbate the problem, as you described? Sorry if my question is off base - I'm not a expert on Flex memory arch & management.
It shouldn't matter. You could write a set function for CLIENT_ID and watch
for it to go null and report the call stack at the time.
I did note that you are using the CLIENT_ID variable but the error was about
ItemClientID. Are you sure they are the same and directly passed from the
request handler to the DB or could there be some server code that turns it
CLIENT_ID (in flex) maps to ItemClientID in the application and database. This column essentially identifies which client owns the record. No where in the application ItemClientID is set it to null. I do, however, see where I properly catch the exception but don't exit the function/transaction properly, and as result, execution flow continues. This would explain why I get a database error message.
I'll need to do further debugging. As you would imagine, it will be difficult since it happens so infrequently and can't reproduce locally.
1 person found this helpful
That's when I would consider adding diagnostics to the app. If you set
-verbose-stacktraces=true in the compiler, the SWF will contain line number
information. Then if you change your CLIENT_ID var to a set function you
can do something like this:
public function set CLIENT_ID(value:String):void
if (value == null || value =="")
Alert.show(new Error().getStackTrace(), "Please Send To Me", this,
That would show you the code path that sets it to null.