Shibboleth Developer's Meeting, 2020-06-05
Call Administrivia
09:00 Central US / 10:00 Eastern US / 15:00 UK / 17:00 FI
Calls are normally the 1st and 3rd Fridays of each month. Next call would be Friday 2020-06-19. Any reason to deviate from this?
60 to 90 minute call window.
This week's call will use the Zoom system at GU, see ZoomGU for access info.
AGENDA
Add items for discussion here
Attendees:
Brent
Daniel
Henri
Ian
- Thread safety is hard:
- Arises through - MDA-242Getting issue details... STATUS
- Things in both the MDA and our other code claim to be
@ThreadSafe
when they are, strictly, insufficiently synchronized.- There seems to be a widespread pattern where setters are
synchronized
while getters are not. As this is dominant in older MDA code, I think it may come from Chad originally.- From Gaetz's book: It is a common mistake to assume that synchronization needs to be used only when writing to shared variables; this is simply not true.
- You need to synchronize both setters and getters to get the visibility guarantees I think you want.
- If you're using something else to get those guarantees, then you are probably
@ThreadSafeAfterInit
and not@ThreadSafe
and you don't need either setters or getters to be synchronized. - Simple example would be
AbstractInitializableComponent
, which just has getters but none aresynchronized
. (There is synchronization on the effective settersinitialize
anddestroy
). - Or,
MessageLifetimeSecurityHandler
wheresetMessageLifetime
issynchronized
butgetMessageLifetime
is not.
- Sometimes code just refers to the field instead of the getter anyway.
- There seems to be a widespread pattern where setters are
- We probably get away with this because:
- roperties aren't set after initialization.
- Everything is initialized on one thread and then other threads are created to do the work. As long as these are explicitly started later or initiated by classes such as
Executor
, visibility is guaranteed by the library (not the language). - Real processors don't buffer writes forever, anyway.
- I can't find anywhere we have documented our approach to writing concurrent beans.
- I think there are two consistent positions:
- Objects are
@ThreadSafe
and get there by either:- If having constructor arguments, having only
final
fields. - If an
InitializableComponent
, having every setter and gettersynchronized
and never referring to fields except through the getter. - Some combination of the above and other techniques to make the object fully thread-safe.
- If having constructor arguments, having only
- Objects are
@ThreadSafeAfterInit
(obviously only applies toInitializableComponent
)- Setters and getters need not be
synchronized
. User constraint that creation of the object and all steps up to and includinginitialize
must be performed on the same thread before the object becomes visible to another thread.
- Setters and getters need not be
- Objects are
Marvin
Rod
Scott
Tom
Other