Why does the Connect chat window load forever for a specific user?
When the user opens Connect chat it shows loading but doesn't complete.
- Log on to affected instance
- Impersonate affected user
- Navigate to chat url https://<instance>.service-now.com/$c.do
The chat page takes a long time to load.
- When a chat was created from task record, (for example connect conversation initiated from an incident record) system was trying to load all the conversations from that record
- While doing that, if it found a sys_attachment record associated to it, which was created by certain user, but user name was modified in sys_user table for some reason
- Then the chat logic looks for user previous name in sys_user table as per sys_attachment record "created by" field
- Since it could not find the user in sys_user table, the logic fails and throws null pointer exception and chat page loads forever
Null Pointer Exception:
14:14:43.11: java.lang.NullPointerException: java.lang.RuntimeException: java.lang.NullPointerException: com.glide.rest.handler.impl.ServiceHandlerImpl.handleInvocationTargetException(ServiceHandlerImpl.java:79) com.glide.rest.handler.impl.ServiceHandlerImpl.invokeService(ServiceHandlerImpl.java:50) com.glide.rest.processors.RESTAPIProcessor.process(RESTAPIProcessor.java:227) com.glide.processors.AProcessor.runProcessor(AProcessor.java:412) com.glide.processors.AProcessor.processTransaction(AProcessor.java:187) com.glide.processors.ProcessorRegistry.process(ProcessorRegistry.java:165) com.glide.ui.GlideServletTransaction.process(GlideServletTransaction.java:49) com.glide.sys.ServletTransaction.run(ServletTransaction.java:34) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) java.lang.Thread.run(Thread.java:748)
14:14:43.11: #11814881 [REST API] RESTAPIProcessor : Handling exception java.lang.NullPointerException
14:14:43.12: #11814881 [REST API] RESTAPIProcessor : Unknown exception RuntimeException:java.lang.NullPointerExceptionDetail: null
14:14:43.12: #11814881 /api/now/connect/collaborators/all -- total transaction time: 0:00:00.722, transaction processing time: 0:00:00.526, total wait time: 0:00:00.196, session wait: 0:00:00.196, semaphore wait: 0:00:00.000, source: 188.8.131.52, chars: 165, uncompressed chars: 212, SQL time: 169 (count: 111), business rule: 153 (count: 20), phase 1 form length: 0, largest chunk written: 155, request parms size: 40, largest input read: 0
Use one of the following workarounds:
- When modifying a user name, make sure it is also reflected in sys_attachment table Created By column
- Modify the user name in sys_user table as per the value in created by field of sys_attachment table
For a more permanent solution, upgrade to Istanbul or Jakarta, where the above exception is handled in a better way. It loads the chat page successfully irrespective of exception.