Get Sessions from Application

2007-09-05 Thread Daniele Corti
Hi all,
   I've a problem with my last app:
   We use our app as a WebService that provide license for our products and
donwload upgrades, and a Web Site for Support.
   It has happen (today) that we make some changes, so shutdown the app,
while someone was downloading an update.

   You can easly image that our customer wasn't happy about this

   I was thinking to prepare a method in Application for searching in active
session if someone is logged in, and display it in the admin panel, but I
wasn't able to find out how to access to the sessions.
   Is there a way to do this, or not?

   I will thank you for every advices

-- 
Daniele Corti
AIM: S0CR4TE5
Messenger: [EMAIL PROTECTED]

--
Computers are like air conditioners -- they stop working properly if you
open
WINDOWS

-- 
What about the four lusers of the apocalypse? I nominate:
advertising, can't log in, power switch and what backup?
--Alistair Young
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Re: In WOComponent constructor and need to go to another WOComponent and not come back

2007-09-05 Thread Pierre Bernard

Hi!

The constructor is an odd place for this.

The constructor is called from pageWithName(). That is in the request- 
response loop preceding the one that would actually use the component.  
If you already know at that point in time where you want to go and  
where not, you should modify the caller so that pageWithName() is  
called with the correct arguments.


There might nonetheless be situations where you may want to forbid  
viewing a certain page. E.g. it is a private page and you want a  
safety net just in case some day someone writes code that doesn't  
check access right before going to the page. For that I would code a  
check in the awake() method. If the check fails throw an exception.  
Optionally that exception could carry information on where to take the  
user. The exception handler in your Application class should take care  
of routing the user to the appropriate page.


Pierre

On Sep 5, 2007, at 2:41 AM, Baiss Eric Magnusson wrote:



I'm in the Constructor of a WOComponent sub-class and I realize I  
have to be in another page.


I invoke a new pageWithName, but then what?


Baiss Eric Magnusson
http://www.Track-Your-Finances.com
http://www.CascadeWebDesign.com


___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/webobjects-lists%40houdah.com

This email sent to [EMAIL PROTECTED]


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

This email sent to [EMAIL PROTECTED]


Re: Get Sessions from Application

2007-09-05 Thread Mike Schrag

Assuming you're not using a servlet deployment:

  WOServerSessionStore sessionStore = (WOServerSessionStore)  
WOApplication.application().sessionStore();

  NSArray sessions = sessionStore._sessions().allValues();

Note that this will only return the sessions that exist within a  
single instance.  If you are running multiple instances, you would  
need to check each instance.  Also, SessionStore does not expose the  
last access time as public -- we add that to our base session  
subclass and touch the value in session.awake() so you can tell if  
the sessions are recently used.  I don't recall if Session has a  
method that tells you if its currently checked out or not, either,  
but you can also add a boolean check to at least see if the session  
is currently awake or not.


ms

On Sep 5, 2007, at 4:10 AM, Daniele Corti wrote:


Hi all,
   I've a problem with my last app:
   We use our app as a WebService that provide license for our  
products and donwload upgrades, and a Web Site for Support.
   It has happen (today) that we make some changes, so shutdown the  
app, while someone was downloading an update.


   You can easly image that our customer wasn't happy about this

   I was thinking to prepare a method in Application for searching  
in active session if someone is logged in, and display it in the  
admin panel, but I wasn't able to find out how to access to the  
sessions.

   Is there a way to do this, or not?

   I will thank you for every advices

--
Daniele Corti
AIM: S0CR4TE5
Messenger: [EMAIL PROTECTED]

--
Computers are like air conditioners -- they stop working properly  
if you open

WINDOWS

--
What about the four lusers of the apocalypse? I nominate:
advertising, can't log in, power switch and what backup?
--Alistair Young
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/mschrag% 
40mdimension.com


This email sent to [EMAIL PROTECTED]



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

This email sent to [EMAIL PROTECTED]

Re: Get Sessions from Application

2007-09-05 Thread Daniele Corti
2007/9/5, Mike Schrag [EMAIL PROTECTED]:

 Assuming you're not using a servlet deployment:

   WOServerSessionStore sessionStore = (WOServerSessionStore)
 WOApplication.application().sessionStore();
   NSArray sessions = sessionStore._sessions().allValues();


Thanks that's what I need!

Note that this will only return the sessions that exist within a single
 instance.  If you are running multiple instances, you would need to check
 each instance.  Also, SessionStore does not expose the last access time as
 public -- we add that to our base session subclass and touch the value in
 session.awake() so you can tell if the sessions are recently used.


I don't think I will need a too accurated value, I only need to know if a
variable in the Session is setted: I mean, I use an Enterprise Object
GWSUser to memorize witch user is logged in in each session, so I only need
to know if it there are users logged in and how many they are


I don't recall if Session has a method that tells you if its currently
 checked out or not, either, but you can also add a boolean check to at least
 see if the session is currently awake or not.
 ms
 On Sep 5, 2007, at 4:10 AM, Daniele Corti wrote:

 Hi all,
I've a problem with my last app:
We use our app as a WebService that provide license for our products
 and donwload upgrades, and a Web Site for Support.
It has happen (today) that we make some changes, so shutdown the app,
 while someone was downloading an update.

You can easly image that our customer wasn't happy about this

I was thinking to prepare a method in Application for searching in
 active session if someone is logged in, and display it in the admin panel,
 but I wasn't able to find out how to access to the sessions.
Is there a way to do this, or not?

I will thank you for every advices

 --
 Daniele Corti
 AIM: S0CR4TE5
 Messenger: [EMAIL PROTECTED]

 --
 Computers are like air conditioners -- they stop working properly if you
 open
 WINDOWS

 --
 What about the four lusers of the apocalypse? I nominate:
 advertising, can't log in, power switch and what backup?
 --Alistair Young
  ___
 Do not post admin requests to the list. They will be ignored.
 Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
 Help/Unsubscribe/Update your Subscription:

 http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40mdimension.com

 This email sent to [EMAIL PROTECTED]




  ___
 Do not post admin requests to the list. They will be ignored.
 Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/webobjects-dev/ildenae%40gmail.com

 This email sent to [EMAIL PROTECTED]




-- 
Daniele Corti
AIM: S0CR4TE5
Messenger: [EMAIL PROTECTED]

--
Computers are like air conditioners -- they stop working properly if you
open
WINDOWS

-- 
What about the four lusers of the apocalypse? I nominate:
advertising, can't log in, power switch and what backup?
--Alistair Young
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Re: Get Sessions from Application

2007-09-05 Thread Mike Schrag
Be very careful accessing values of a session ... Make sure you lock  
properly.


On Sep 5, 2007, at 9:05 AM, Daniele Corti wrote:




2007/9/5, Mike Schrag [EMAIL PROTECTED]:
Assuming you're not using a servlet deployment:

  WOServerSessionStore sessionStore = (WOServerSessionStore)  
WOApplication.application().sessionStore();

  NSArray sessions = sessionStore._sessions().allValues();

Thanks that's what I need!

Note that this will only return the sessions that exist within a  
single instance.  If you are running multiple instances, you would  
need to check each instance.  Also, SessionStore does not expose  
the last access time as public -- we add that to our base session  
subclass and touch the value in session.awake() so you can tell if  
the sessions are recently used.


I don't think I will need a too accurated value, I only need to  
know if a variable in the Session is setted: I mean, I use an  
Enterprise Object GWSUser to memorize witch user is logged in in  
each session, so I only need to know if it there are users logged  
in and how many they are



I don't recall if Session has a method that tells you if its  
currently checked out or not, either, but you can also add a  
boolean check to at least see if the session is currently awake or  
not.


ms

On Sep 5, 2007, at 4:10 AM, Daniele Corti wrote:


Hi all,
   I've a problem with my last app:
   We use our app as a WebService that provide license for our  
products and donwload upgrades, and a Web Site for Support.
   It has happen (today) that we make some changes, so shutdown  
the app, while someone was downloading an update.


   You can easly image that our customer wasn't happy about this

   I was thinking to prepare a method in Application for searching  
in active session if someone is logged in, and display it in the  
admin panel, but I wasn't able to find out how to access to the  
sessions.

   Is there a way to do this, or not?

   I will thank you for every advices

--
Daniele Corti
AIM: S0CR4TE5
Messenger: [EMAIL PROTECTED]

--
Computers are like air conditioners -- they stop working properly  
if you open

WINDOWS

--
What about the four lusers of the apocalypse? I nominate:
advertising, can't log in, power switch and what backup?
--Alistair Young
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/mschrag% 
40mdimension.com


This email sent to [EMAIL PROTECTED]




 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  ( Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/ildenae% 
40gmail.com


This email sent to [EMAIL PROTECTED]



--
Daniele Corti
AIM: S0CR4TE5
Messenger: [EMAIL PROTECTED]

--
Computers are like air conditioners -- they stop working properly  
if you open

WINDOWS

--
What about the four lusers of the apocalypse? I nominate:
advertising, can't log in, power switch and what backup?
--Alistair Young


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

This email sent to [EMAIL PROTECTED]

Re: Get Sessions from Application

2007-09-05 Thread Daniele Corti
2007/9/5, Mike Schrag [EMAIL PROTECTED]:

 Be very careful accessing values of a session ... Make sure you lock
 properly.


Well, I'm only reading them, not writing

On Sep 5, 2007, at 9:05 AM, Daniele Corti wrote:



 2007/9/5, Mike Schrag [EMAIL PROTECTED]:
 
  Assuming you're not using a servlet deployment:
 
WOServerSessionStore sessionStore = (WOServerSessionStore)
  WOApplication.application().sessionStore();
NSArray sessions = sessionStore._sessions().allValues();
 

 Thanks that's what I need!

 Note that this will only return the sessions that exist within a single
  instance.  If you are running multiple instances, you would need to check
  each instance.  Also, SessionStore does not expose the last access time as
  public -- we add that to our base session subclass and touch the value in
  session.awake() so you can tell if the sessions are recently used.
 

 I don't think I will need a too accurated value, I only need to know if a
 variable in the Session is setted: I mean, I use an Enterprise Object
 GWSUser to memorize witch user is logged in in each session, so I only need
 to know if it there are users logged in and how many they are


 I don't recall if Session has a method that tells you if its currently
  checked out or not, either, but you can also add a boolean check to at least
  see if the session is currently awake or not.
  ms
  On Sep 5, 2007, at 4:10 AM, Daniele Corti wrote:
 
  Hi all,
 I've a problem with my last app:
 We use our app as a WebService that provide license for our products
  and donwload upgrades, and a Web Site for Support.
 It has happen (today) that we make some changes, so shutdown the app,
  while someone was downloading an update.
 
 You can easly image that our customer wasn't happy about this
 
 I was thinking to prepare a method in Application for searching in
  active session if someone is logged in, and display it in the admin panel,
  but I wasn't able to find out how to access to the sessions.
 Is there a way to do this, or not?
 
 I will thank you for every advices
 
  --
  Daniele Corti
  AIM: S0CR4TE5
  Messenger: [EMAIL PROTECTED]
 
  --
  Computers are like air conditioners -- they stop working properly if you
  open
  WINDOWS
 
  --
  What about the four lusers of the apocalypse? I nominate:
  advertising, can't log in, power switch and what backup?
  --Alistair Young
   ___
  Do not post admin requests to the list. They will be ignored.
  Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
  Help/Unsubscribe/Update your Subscription:
 
  http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40mdimension.com
 
  This email sent to [EMAIL PROTECTED]
 
 
 
 
   ___
  Do not post admin requests to the list. They will be ignored.
  Webobjects-dev mailing list  ( Webobjects-dev@lists.apple.com)
  Help/Unsubscribe/Update your Subscription:
 
  http://lists.apple.com/mailman/options/webobjects-dev/ildenae%40gmail.com
 
  This email sent to [EMAIL PROTECTED]
 



 --
 Daniele Corti
 AIM: S0CR4TE5
 Messenger: [EMAIL PROTECTED]

 --
 Computers are like air conditioners -- they stop working properly if you
 open
 WINDOWS

 --
 What about the four lusers of the apocalypse? I nominate:
 advertising, can't log in, power switch and what backup?
 --Alistair Young



  ___
 Do not post admin requests to the list. They will be ignored.
 Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/webobjects-dev/ildenae%40gmail.com

 This email sent to [EMAIL PROTECTED]




-- 
Daniele Corti
AIM: S0CR4TE5
Messenger: [EMAIL PROTECTED]

--
Computers are like air conditioners -- they stop working properly if you
open
WINDOWS

-- 
What about the four lusers of the apocalypse? I nominate:
advertising, can't log in, power switch and what backup?
--Alistair Young
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Re: Get Sessions from Application

2007-09-05 Thread Guido Neitzer

On 05.09.2007, at 07:05, Daniele Corti wrote:

I don't think I will need a too accurated value, I only need to  
know if a variable in the Session is setted: I mean, I use an  
Enterprise Object GWSUser to memorize witch user is logged in in  
each session, so I only need to know if it there are users logged  
in and how many they are


I do this with a database table that tracks the current users. It's a  
matter of a couple of minutes to implement this:


- create a table in the database, log the session id, a time stamp,  
the instance, and the current user in Session.awake() (I only update  
a record for the session id, so I don't have many rows in that table),


- delete this row in Session.terminate(),

- call Session.terminate() when the user logs out,

- write a cleanup method that removes all entries for this instance  
from the db.


This works well and does not have to do dirty things in the  
sessionStore. Maybe I forgot something here, but that's the basic  
principle. And in the admin part of the application I have a page  
showing all entries from that table that updates automatically with  
an AjaxUpdateContainer - so you can set the instance to refuse new  
sessions, users get a message (through the PageWrapper) and you can  
see when they log out. You can even log there current page or  
whatever they are doing at the moment if you want (I only log the  
navigation status from ERXNavigation).


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

This email sent to [EMAIL PROTECTED]


Re: Get Sessions from Application

2007-09-05 Thread Chuck Hill


On Sep 5, 2007, at 1:10 AM, Daniele Corti wrote:


Hi all,
   I've a problem with my last app:
   We use our app as a WebService that provide license for our  
products and donwload upgrades, and a Web Site for Support.
   It has happen (today) that we make some changes, so shutdown the  
app, while someone was downloading an update.


   You can easly image that our customer wasn't happy about this


I am wondering if this is really a code problem or just a deployment  
administration problem.   You need to make some app changes so you:


1. Install the new version
2. Create, configure, schedule and start X new instances of the  
application
3. Unschedule the instances of the previous version and set to Refuse  
New Sessions


Now the logged in users on the old version can finish what they were  
doing.  When their sessions time out, the apps will terminate.  Users  
arriving at your site after this get sent to the new instances.


No need for code changes.

Chuck



   I was thinking to prepare a method in Application for searching  
in active session if someone is logged in, and display it in the  
admin panel, but I wasn't able to find out how to access to the  
sessions.

   Is there a way to do this, or not?

   I will thank you for every advices

--
Daniele Corti
AIM: S0CR4TE5
Messenger: [EMAIL PROTECTED]

--

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  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Deadlocks

2007-09-05 Thread Simon McLean

Hi -

We're experiencing some pretty bad deadlock issues at the moment and  
I'm pretty convinced it's down to EC lock abuse.


Can anyone confirm that if we follow these rules:

** If you do want all that Wonder magic and love:
1) extend ERXApplication
2) extend ERXSession
3) use ERXEC.newEditingContext() instead of new EOEditingContext()
4) Add to Properties:
er.extensions.ERXApplication.useEditingContextUnlocker=true
er.extensions.ERXEC.defaultAutomaticLockUnlock=true
er.extensions.ERXEC.useSharedEditingContext=false
er.extensions.ERXEC.defaultCoalesceAutoLocks=true

... we should never have to manually lock or unlock an EC ? Or put  
another way, when using these rules is there any situation that we  
would have to call ec.lock() or ec.unlock() in our code ?


Thanks, Simon ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Re: Deadlocks

2007-09-05 Thread Guido Neitzer

On 05.09.2007, at 16:01, Simon McLean wrote:

We're experiencing some pretty bad deadlock issues at the moment  
and I'm pretty convinced it's down to EC lock abuse.


Get a stacktrace of your running application to verify that:

http://tinyurl.com/3bpkkv


... we should never have to manually lock or unlock an EC ?


That is true, yes - but you still might run into problems if you do  
bad things.


Or put another way, when using these rules is there any situation  
that we would have to call ec.lock() or ec.unlock() in our code ?


I normally lock and unlock manually on long response pages / tasks,  
as the unlocking of editing contexts relies on the request response  
loop.


If you see problems in the stacktrace, when the session gets checked  
out from the session store, make sure you NEVER EVER touch something  
from the session's default editing context inside your  
performAction method on a long response page. This will autolock  
your session's default editing context, it will not get unlocked,  
because you are outside of the rr loop and the next checkout for that  
session will fail.


The other thing I saw with deadlocks: if you run out of space on your  
server, log4j might deadlock.


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

This email sent to [EMAIL PROTECTED]


Re: Deadlocks

2007-09-05 Thread Mike Schrag
If you see problems in the stacktrace, when the session gets  
checked out from the session store, make sure you NEVER EVER touch  
something from the session's default editing context inside your  
performAction method on a long response page. This will autolock  
your session's default editing context, it will not get unlocked,  
because you are outside of the rr loop and the next checkout for  
that session will fail.
This particular deadlock should be fixed as of a couple weeks ago  
after we talked, btw ... I think I rolled autolocking into long  
response, also.  But generally speaking, if you're in another thread,  
I would lock manually to be safe.


Also, if you ever access an EODatabaseContext directly, you MUST lock  
that yourself.  It will not autolock, and that will cause terrible  
problems.


ms

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

This email sent to [EMAIL PROTECTED]


Re: Deadlocks

2007-09-05 Thread Chuck Hill


On Sep 5, 2007, at 3:01 PM, Simon McLean wrote:


Hi -

We're experiencing some pretty bad deadlock issues at the moment  
and I'm pretty convinced it's down to EC lock abuse.


What makes you think that?  As Guido indicated, if you don't have  
stack traces you are just guessing.  Guessing is not an effective  
form of debugging.  :-)




Can anyone confirm that if we follow these rules:

** If you do want all that Wonder magic and love:
1) extend ERXApplication
2) extend ERXSession
3) use ERXEC.newEditingContext() instead of new EOEditingContext()
4) Add to Properties:
er.extensions.ERXApplication.useEditingContextUnlocker=true
er.extensions.ERXEC.defaultAutomaticLockUnlock=true
er.extensions.ERXEC.useSharedEditingContext=false
er.extensions.ERXEC.defaultCoalesceAutoLocks=true

... we should never have to manually lock or unlock an EC ? Or put  
another way, when using these rules is there any situation that we  
would have to call ec.lock() or ec.unlock() in our code ?



You are probably safe for general EC usage there, but you can still  
do other bad things and end up deadlocked.


Chuck


--

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  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Deadlocks

2007-09-05 Thread Steven Mark McCraw
You are probably safe for general EC usage there, but you can still  
do other bad things and end up deadlocked.


There are many great things in the win column for WebObjects, but I  
believe one of the definite negatives of the technology is how  
ridiculously easy it is to deadlock a webobjects application.  You  
have to take the bad with the good.  This is miserably scary and  
nasty until you learn to dump the thread stack traces (see the URL  
Guido posted earlier:  http://tinyurl.com/3bpkkv.  Learning the  
tricks shown here cost me a week of sleep once, but now it's  
beautifully documented, so profit from the work people have done to  
write up these instructions).  Once you have the stack traces in  
hand, it becomes pretty obvious where the problem is and you can fix  
it.  Look for the thread which isn't stuck in a wait queue or  
sleeping while waiting for requests.


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

This email sent to [EMAIL PROTECTED]


Re: Deadlocks

2007-09-05 Thread Chuck Hill


On Sep 5, 2007, at 4:12 PM, Steven Mark McCraw wrote:

You are probably safe for general EC usage there, but you can  
still do other bad things and end up deadlocked.


There are many great things in the win column for WebObjects, but  
I believe one of the definite negatives of the technology is how  
ridiculously easy it is to deadlock a webobjects application.


Is it easy?  Or is that just the nature of the concurrency beast?   
The only ways to cause deadlock that I can think of are (a) improper  
exception handling related to releasing locks and (b) unbalanced lock  
usage.  I'd expect those to cause problems in any multi-threaded,  
concurrent environment.  There _were_ some issues in this area in  
prior versions.  AFAIK, these are fixed.



The one thing I can think of  that WO could have added is some  
try...catch or try...finally blocks in WOSession.  These could, if  
present, handle when the developer does not properly handle the  
exceptions that happen in their code.


Can you think of anything else that could be done?


Chuck


  You have to take the bad with the good.  This is miserably scary  
and nasty until you learn to dump the thread stack traces (see the  
URL Guido posted earlier:  http://tinyurl.com/3bpkkv.  Learning the  
tricks shown here cost me a week of sleep once, but now it's  
beautifully documented, so profit from the work people have done to  
write up these instructions).  Once you have the stack traces in  
hand, it becomes pretty obvious where the problem is and you can  
fix it.  Look for the thread which isn't stuck in a wait queue or  
sleeping while waiting for requests.


Mark



--

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  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Deadlocks

2007-09-05 Thread Matthew W. Taylor

If virtue
can't be mine alone
at least my faults
can be my own.
- Piet Hein

Deadlocks in WebObjects have always been my own fault.  I'm thankful to
Andrew Lindesay's HOWTO.  It's a super easy process -- and saves my bacon
from my own carelessness.

 From: Steven Mark McCraw [EMAIL PROTECTED]
 Date: Wed, 5 Sep 2007 20:22:42 -0400
 To: Chuck Hill [EMAIL PROTECTED]
 Cc: WebObjects (Group) webobjects-dev@lists.apple.com
 Subject: Re: Deadlocks
 
 Is it easy?  Or is that just the nature of the concurrency beast?
 
 I consider it easy because I've had to deal with it so many times.  I
 think WebObjects seems worse than a normal multithreaded app because
 things you do that are totally unrelated to concurrency from the
 programmer's point of view can cause you deadlock.

Deadlocks sure are frustrating. In my opinion WO locks are only more
noticeable than other web app environments, because, in classical WO
programming, you've only got one channel to the DB per application. Lock
that up -- and the rest of the app is toast.  Other programming environments
might suffer less by having more avenues to the data.  You might be equally
guilty of poor practice in those environments but possibly not even notice
it. Instead you reboot your app when it slows to a crawl, or runs out of
descriptors, blaming it on Java.

 It's nice that so
 much of the concurrency-handling misery you would ordinarily have to
 think about with multithreaded applications is hidden from you, but
 when it goes wrong, it is the height of confusion.

Well when we see that copy of open-source WO, Real Soon Now (tm). we can
all say  what confusion?
 
-=- matt

Matthew Taylor
Northwestern University


smime.p7s
Description: S/MIME cryptographic signature
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]