Dec. 5, 2019, 6:31 p.m. bryce AEM Dispatcher AEM Tips and Tricks
When Adobe made the change to begin using
etc.clientlibs as a directory, we encountered issues with some existing Dispatcher cache invalidation configurations. For certain cache files, Dispatcher may delete the file on disk when a flush is called. Directories should not get deleted and Dispatcher will drop a
.stat file within them. This
.stat file's time stamp is what Dispatcher checks when deciding whether to update the requested cache file or not.
However, because of that pesky
. character within the name of the client library cache, the Dispatcher was fooled into thinking the cache (
etc.clientlibs) should be deleted on invalidation of any
/etc files. This caused further issues when it would attempt to recreate the directory. On the next request it could be unable to create the
etc.clientlibs directory at the file system level due to a race condition. Thus, no cached client libraries would be created, and until this was manually fixed (recreate the directory by hand), all requests would hit the Publishers.
To fix this we wrote a shell script which was triggered by the Dispatcher during invalidation. To call the script we added the following to our Dispatcher configuration:
/invalidateHandler "/opt/dispatcher/scripts/invalidate.sh" 
This ran our
invalidate.sh  shell script every time our Dispatcher's cache was invalidated from a Flush Agent, thus triggering a recreation of the
etc.clientlibs directory and preventing our race condition.