Re: EOObjectNotAvailableException: prepareForSaveWithCoordinator
Re: EOObjectNotAvailableException: prepareForSaveWithCoordinator
- Subject: Re: EOObjectNotAvailableException: prepareForSaveWithCoordinator
- From: Stefan Klein <email@hidden>
- Date: Sun, 19 Oct 2008 00:44:18 +0200
Lachlan Deck schrieb:
On 17/10/2008, at 7:03 PM, Stefan Klein wrote:
That's my problem, theirs no other exception in the log files. The
exception seems to occurs every leap year, so i can't reproduce it.
Is there a way to catch the exception and get rid of the corrupt
object and reload it?
Well the question is: is it corrupt data or is it just that instance
that's going weird over time? If the former - then that's more easily
fixed. If the latter this is harder as you're playing a guessing game.
Is it on a scheduled restart?
It's the instance that's going weird. The instance are scheduled once a
week, so I changed that to every night.
We put in some code recently to keep an eye on new worker threads
being created - as for us it's an early warning sign that things are
tending towards an unstable state ... and it's time to refuse new
sessions and start up another instance.
So in your app constructor, for example:
NSNotificationCenter.defaultCenter().addObserver( this,
new NSSelector(
"willDispatchRequest", ERXConstant.NotificationClassArray ),
WOApplication.ApplicationWillDispatchRequestNotification,
null );
Note: ERXConstant.NotificationClassArray == new Class[] {
NSNotification.class }
public void willDispatchRequest( NSNotification notification )
{
if ( notification != null && notification.object() instanceof
WORequest )
{
WORequest request = ( WORequest )notification.object();
try
{
WODefaultAdaptor da = ( WODefaultAdaptor
)adaptors().objectAtIndex( 0 );
String das = da.toString();
int n = das.indexOf( "nmbOfWorkerThreads=" ) +
"nmbOfWorkerThreads=".length();
String nwt = das.substring( n, das.indexOf( " ", n ) );
this._currentWorkerThreadCount = Integer.valueOf( nwt );
n = das.indexOf( "nmbOfActiveThreads=" ) +
"nmbOfActiveThreads=".length();
String awt = das.substring( n, das.indexOf( " ", n ) );
this._currentActiveThreadCount = Integer.valueOf( awt );
if ( this._currentActiveThreadCount >
ERXProperties.intForKeyWithDefault( "ish.activeWorkerThreadWarning", 8
) )
{
StringBuilder b = new StringBuilder( "Exceeded
active worker thread warning level:\n" );
b.append(
notification.object().getClass().getName() + " => max = " + nwt + ",
active = " + awt + "\n" );
b.append( "REQUEST: " + request.uri() );
LOG.error( b.toString(), new Exception() );
}
}
catch ( Exception e )
{
LOG.error( "Exception looking for active worker
threads", e );
}
}
}
But this might not be your problem.
Hmmm, as you say it is harder then playing a guessing game :'( .
But I think I will add a working thread counter to see if there is
something unusually.
Lachlan Deck schrieb:
On 17/10/2008, at 6:51 AM, Stefan Klein wrote:
i got the following exception:
com.webobjects.eoaccess.EOObjectNotAvailableException:
prepareForSaveWithCoordinator: Cannot save the object with globalID
_EOIntegralKeyGlobalID[Benutzer (java.lang.Long)4559]. The row
referenced by this globalID was missing from the database at the
time a fetch was attempted. Either it was removed from the database
after this application got a pointer to it, or there is a
referential integrity problem with your database. To be notified
when fetches fail, implement a delegate on EODatabaseContext that
responds to databaseContextFailedToFetchObject().
at
com.webobjects.eoaccess.EODatabaseContext.prepareForSaveWithCoordinator(EODatabaseContext.java:5831)
at
com.webobjects.eocontrol.EOObjectStoreCoordinator.saveChangesInEditingContext(EOObjectStoreCoordinator.java:409)
at
com.webobjects.eocontrol.EOEditingContext.saveChanges(EOEditingContext.java:3187)
But I know that the object for this id exist, cause that user
logged in many times before in that instance. The instance was
running for several days without any problem.
After the exception occurs the first time, the user can't log in
again in that instance. A login to the second instance did work.
After stopping and starting the first instance all works fine.
Does any one have a suggestion?
Check the logs. Probably had some exceptions that went unnoticed.
with regards,
--
Lachlan Deck
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
with regards,
--
Lachlan Deck
Thanks for your hints
Stefan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden