struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Colin Sampaleanu <co...@Bspark.com>
Subject RE: Problem: (missing) Synchronization and ActionMappings
Date Fri, 17 Nov 2000 18:24:07 GMT
Perhaps the way to handle this is with optional synchronization wrappers. If
the user of the framework knows that mappings will be static, this is
indicated somehow with a configuration variable, and the framework does not
bother synchronizing those collections. So while developing the site, you
set it to dynamic, and then static when deployed for real use...

> -----Original Message-----
> From: Craig R. McClanahan [mailto:Craig.McClanahan@eng.sun.com]
> Sent: November 17, 2000 12:15 PM
> To: struts-dev@jakarta.apache.org
> Subject: Re: Problem: (missing) Synchronization and ActionMappings
> 
> Yah, I had just been thinking about those kinds of issues 
> while contemplating
> switching to the Java2 collection classes.  I want to avoid 
> synchronization if
> possible for the most common case (simply looking up a 
> mapping), but I am not
> sure that's possible yet ...
> 
> Craig
> 
> 
> Matthias Kerkhoff wrote:
> 
> > Hi all,
> >
> > if just looked at ActionMappings and found some 
> synchronization issues,
> > that may lead to NullPointerExceptions.
> >
> > For example, I don't see any protection against scenarios like this:
> >
> > - User A sends a request RA that resolves to RemoveActionMapping(M)
> >
> > [task/thread switch before M is removed]
> >
> > - User B sends a request RB that is resolved to Mapping M
> >
> > [task/thread switch to RA-thread]
> >
> > - Mapping M is removed and in turn 
> mapping.setMappings(null) is called
> >
> > [task/thread switch back to RB-thread]
> >
> > - the request handling of RB continues. Depending on how much of the
> >   request handling has been done (ie. where/when the switch 
> occurred),
> >   the mapping and the corresponding action don't recognize, 
> that they
> >   have been removed. (At least, there are no checks.)
> >   Thus any attempts to
> >   - action.createFormInstance(...)
> >   - action.findMapping(...)
> >   will result in uncatched NullPointerExceptions (due to 
> action.getMappings()
> >   returning null).
> >
> > I think, that there are plenty other scenarios with similar 
> results, all
> > resulting from the fact, that a Mapping may be removed or 
> replaced from
> > another thread, while it's "executed" in a first thread.
> >
> > Opinions ?
> >
> > Solutions ?
> >
> > --
> > Matthias                          mailto:make@BESToffers.de
> 

Mime
View raw message