• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Concurrent request handling
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Concurrent request handling


  • Subject: Re: Concurrent request handling
  • From: Chuck Hill <email@hidden>
  • Date: Wed, 25 May 2011 10:46:23 -0700


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@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Concurrent request handling (From: Gennady Kushnir <email@hidden>)
 >Re: Concurrent request handling (From: Chuck Hill <email@hidden>)
 >Re: Concurrent request handling (From: Кушнир Геннадий <email@hidden>)

  • Prev by Date: Re: Using DataGrid in WO
  • Next by Date: Hashcode/ETag for EOs
  • Previous by thread: Re: Concurrent request handling
  • Next by thread: Time profiling
  • Index(es):
    • Date
    • Thread