AEM Shutdown slows in AEM 6.2 and 6.3. Thread dumps taken during shutdown show FelixStartLevel thread stuck in ungetSession calls:
"FelixStartLevel" #16 daemon prio=5 os_prio=0 tid=0x00007f8e15be3000 nid=0x3243 runnable [0x00007f8df4944000] java.lang.Thread.State: RUNNABLE at com.adobe.cq.scheduled.exporter.impl.ScheduledExporterImpl.ungetSession(ScheduledExporterImpl.java:402) at com.adobe.cq.scheduled.exporter.impl.ScheduledExporterImpl.unbindRepository(ScheduledExporterImpl.java:181)
"FelixStartLevel" #16 daemon prio=5 os_prio=0 tid=0x00007f8e15be3000 nid=0x3243 runnable [0x00007f8df4944000] java.lang.Thread.State: RUNNABLE at com.day.cq.polling.importer.impl.PollingImporterImpl.ungetSession(PollingImporterImpl.java:646) at com.day.cq.polling.importer.impl.PollingImporterImpl.deactivate(PollingImporterImpl.java:250)
Product bug CQ-96133 - The PollingImporterImpl and ScheduledExporterImpl delays AEM shutdown if the "Setup Initial Polling Configuration" thread fails with an exception.