struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthias Kerkhoff <m...@BESToffers.de>
Subject Problem: (missing) Synchronization and ActionMappings
Date Fri, 17 Nov 2000 11:48:02 GMT
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