On May 24, 2011, at 10:50 PM, Кушнир Геннадий wrote:

> Hello
> 
>>> How could that be that session is awaken by one thread and action is
>>> invoked by another within the same RRloop?
>> 
>> Are you sure that is what is happening?  Could it be that you have a bug in 
>> your session's sleep() method that is sometimes causing the EC to NOT get 
>> unlocked?
>       public void sleep() {
>               if(!isTerminating())
>                       ecLockManager.unlock();
>               super.sleep();
>       }
> I can't find any bug here ))

Not your problem, but a better way to write that is:
        public void sleep() {
           try {
                if(!isTerminating())
                        ecLockManager.unlock();
           } finally {
                super.sleep();
           }
        }

> 
>> Can you post the thread traces?
> 2011-05-23    22:17:33        INFO    tX47k7Qn2z0d6CXNtlL4pw  Attempting to 
> lock editing context from WorkerThread14 that was previously locked in 
> WorkerThread3
> java.lang.Exception: null
> [0]   net.rujel.reusables.SessionedEditingContext.lock:118
> [30]  net.rujel.reusables.SessionedEditingContext.saveChanges:73   // here 
> super.saveChanges() is called
> [31]  net.rujel.ui.LessonNoteEditor.save:412
> [32]  net.rujel.ui.LessonNoteEditor.save:352
> [85]  net.rujel.reusables.UTF8Application.dispatchRequest:46
> {java.lang.Exception: null
> [0]   net.rujel.reusables.SessionedEditingContext.lock:118
> [1]   net.rujel.reusables.MultiECLockManager.lock:66
> [2]   net.rujel.Session.awake:118
> [9]   net.rujel.reusables.UTF8Application.dispatchRequest:46}
> {}

Is the first trace, is this there?
> [1]   net.rujel.reusables.MultiECLockManager.lock:66
> [2]   net.rujel.Session.awake:118

It looks like you are somehow sharing editing contexts across sessions or using 
a session's editing context in a non RR loop thread.


Chuck


> traces are filtered to include only my classes and recently active one
> 
> 
>> My first guess is that your EOEditingContext has a bug in it, and the 
>> messages you are seeing are not valid.
>> 
>> 
>> Chuck
> 
> I have looked through it a lot of times. And could not find any.
> Maybe you could?
> 
>       private String _nameOfLockingThread = null;
>       private NSMutableArray _stackTraces = new NSMutableArray();
>       private NSMutableArray _prevTraces = new NSMutableArray();
> 
>          public void lock() {
>              String nameOfCurrentThread = Thread.currentThread().getName();
> // prepare filtered stack trace:
>              String trace = WOLogFormatter.formatTrowable(new Exception());
>              if (_stackTraces.count() == 0) {
>                  _stackTraces.addObject(trace);
>                  _nameOfLockingThread = nameOfCurrentThread;
>              } else {
>                  if (nameOfCurrentThread.equals(_nameOfLockingThread)) {
>                      _stackTraces.addObject(trace);
>                  } else {
>                      logger.log(WOLogLevel.INFO,
>         "Attempting to lock editing context from " + nameOfCurrentThread
>         + " that was previously locked in " + _nameOfLockingThread,
>          new  Object[] {session,trace,_stackTraces,_prevTraces});
>                  }
>              }
>              super.lock();
>          }
> 
>          public void unlock() {
>              super.unlock();
>              if (_stackTraces.count() > 0)
>                  _prevTraces.addObject(_stackTraces.removeLastObject());
>              else
>                  _stackTraces.count();
>              if (_stackTraces.count() == 0) {
>                  _nameOfLockingThread = null;
>                  _prevTraces.removeAllObjects();
>              }
>          }
> 
> I think those methods consist of really simple statements that should not 
> cause problems.
> 
> ---
> Gennady Kushnir

-- 
Chuck Hill             Senior Consultant / VP Development

Come to WOWODC this July for unparalleled WO learning opportunities and real 
peer to peer problem solving!  Network, socialize, and enjoy a great 
cosmopolitan city.  See you there!  http://www.wocommunity.org/wowodc11/

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to