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
Jira Legacy server Shibboleth JIRA columns key,summary,type,created,updated,due,assignee,reporter,priority,status,resolution serverId 180d847f-bce4-36b2-9964-771bff586829 key MDA-242 - 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.
Objects are - If having constructor arguments, having only
@ThreadSafeAfterInit
(obviously only applies toInitializableComponent
)Setters and getters need not besynchronized
. 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 threadFull discussion there. - Arises through
- TL;DR: we're probably OK, mostly, but we might want to document some assumptions and possibly tweak a couple of base classes in
java-support
to future-proof them.
Marvin
Rod
Scott
Tom
Other