struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <Craig.McClana...@eng.sun.com>
Subject Re: Problem: (missing) Synchronization and ActionMappings
Date Fri, 17 Nov 2000 17:15:16 GMT
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