Re: _EOCheapCopyMutableArray blocks
Re: _EOCheapCopyMutableArray blocks
- Subject: Re: _EOCheapCopyMutableArray blocks
- From: Chuck Hill <email@hidden>
- Date: Wed, 7 Dec 2005 15:41:22 -0800
Hi Corin,
I think you have been messing with EOF's head. When you do that, it
likes to mess with yours. :-)
On Dec 6, 2005, at 8:54 PM, Corin Lawson wrote:
Hi,
Recently found this peculiar anomaly... calling a method on
_EOCheapCopyMutableArray blocks!
Well, not exactly. _EOCheapCopyMutableArray implements the
EOFaulting interface and it is a pretty safe guess that this is what
implements array faults. What you have then is an object (empty
array I would guess) that is standing in for an array of real, actual
objects. When you try to call any methods on this array, like count
(), it can't return a correct answer in its current state. So, to
compute count(), it needs to fire (go to the database (for example)
and fetch all the primary keys for the objects that may eventually be
in the array and then turn those keys into faults) and fill itself
with faults. At that point it is an array of faults, and the array
can count the faults and return the result.
Something as simple as calling count() doesn't return ... WTF?
OK, so we now know that this is in fact firing the fault and the app
hangs when the fault is fired. Why might this happen?
1. Your code has gotten EOF into some strange state and it can't
figure out how to do this
2. Some other thread has the EOF stack locked and this thread is
waiting for access. This would be caused by bad locking in your code
that is leaving a lock in place.
3. A fetch is already in progress when you fire this fault and no
additional DB channel is available. I'm not sure how you would do
this or if it would instead raise an exception but I will mention it
any way.
4. Firing the fault triggers an infinite loop in your code. Have fun
finding this one! :-)
Please help.
Here is a code snippet and a bunch of logs (log4j)...
public class EOReseller extends EOGenericRecord {
// *snip*
public void addToDomains(com.auststyle.bders.eom.EODomain
newDomainsObject) {
logger.debug("Entering
com.auststyle.bders.eom.EOReseller.addToDomains...");
NSMutableArray array = (NSMutableArray) getDomains();
What does getDomains() do? Does it result in a call to willRead() on
this object?
Is this object in an editing context?
Was this object inserted into an EC _immediately_ after being created?
Hopefully this might trigger some ideas. I'd also try and get a
thread dump when it hangs and see if that isolates the problem.
Chuck
logger.debug("Array of domains is array == "+array+";");
logger.debug("\tlength is "+array.count());
willChange();
logger.debug("Adding EODomain to array...");
array.addObject(newDomainsObject);
logger.debug("Exiting
com.auststyle.bders.eom.EOReseller.addToDomains...");
}
// *snip*
}
2005-12-07 15:26:31,338|DEBUG|
com.auststyle.bders.eom.EOReseller<WorkerThread2> - Entering
com.auststyle.bders.eom.EOReseller.addObjectToPropertyWithKey
({values = {*snip* }; this = "<com.auststyle.bders.eom.EODomain
1fda7c <EOTemporaryGlobalID: 0 0 -45 27 -32 89 0 0 7 -47 1 0 0 0 1
8 3 120 113 -28 25 21 -55 -30>>"; }, domains)...
2005-12-07 15:26:31,339|DEBUG|
com.auststyle.bders.eom.EOReseller<WorkerThread2> - Entering
com.auststyle.bders.eom.EOReseller.addToDomains...
2005-12-07 15:26:31,340|DEBUG|
com.auststyle.bders.eom.EOReseller<WorkerThread2> - Entering
com.auststyle.bders.eom.EOReseller.storedValueForKey(domains)...
2005-12-07 15:26:31,341|DEBUG|
com.auststyle.bders.eom.EOReseller<WorkerThread2> - Exiting
com.auststyle.bders.eom.EOReseller.storedValueForKey
com.webobjects.eocontrol._EOCheapCopyMutableArray[86fe17]
2005-12-07 15:26:31,343|DEBUG|
com.auststyle.bders.eom.EOReseller<WorkerThread2> - Array of
domains is array ==
com.webobjects.eocontrol._EOCheapCopyMutableArray[86fe17];
2005-12-07 15:26:31,345|DEBUG|
com.auststyle.bders.eom.EOReseller<WorkerThread2> - Entering
com.auststyle.bders.eom.EOReseller.storedValueForKey(domains)...
2005-12-07 15:26:31,346|DEBUG|
com.auststyle.bders.eom.EOReseller<WorkerThread2> - Exiting
com.auststyle.bders.eom.EOReseller.storedValueForKey
com.webobjects.eocontrol._EOCheapCopyMutableArray[86fe17]
2005-12-07 15:26:31,348|DEBUG|
com.auststyle.bders.eom.EOReseller<WorkerThread2> - Entering
com.auststyle.bders.eom.EOReseller.storedValueForKey(name)...
2005-12-07 15:26:31,349|DEBUG|
com.auststyle.bders.eom.EOReseller<WorkerThread2> - Exiting
com.auststyle.bders.eom.EOReseller.storedValueForKey Bottle Domains
2005-12-07 15:26:31,350|DEBUG|
com.auststyle.bders.eom.EOReseller<WorkerThread2> - Entering
com.auststyle.bders.eom.EOReseller.storedValueForKey(username)...
2005-12-07 15:26:31,351|DEBUG|
com.auststyle.bders.eom.EOReseller<WorkerThread2> - Exiting
com.auststyle.bders.eom.EOReseller.storedValueForKey bottledomains
*snip*
2005-12-07 15:26:31,392|DEBUG|
com.auststyle.bders.eom.EOReseller<WorkerThread2> - Entering
com.auststyle.bders.eom.EOReseller.storedValueForKey(status)...
2005-12-07 15:26:31,394|DEBUG|
com.auststyle.bders.eom.EOReseller<WorkerThread2> - Exiting
com.auststyle.bders.eom.EOReseller.storedValueForKey test
com.auststyle.bders.eom.EOReseller.storedValueForKey(domains)...
2005-12-07 15:26:31,400|DEBUG|
com.auststyle.bders.eom.EOReseller<WorkerThread2> - Exiting
com.auststyle.bders.eom.EOReseller.storedValueForKey
com.webobjects.eocontrol._EOCheapCopyMutableArray[86fe17]
TIA,
Corin.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net
This email sent to email@hidden
--
Coming in 2006 - an introduction to web applications using WebObjects
and Xcode http://www.global-village.net/wointro
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems. http://www.global-village.net/products/practical_webobjects
_______________________________________________
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