Push Publishing: Invalidation of pages shows deceiving message due to missing mod user
Related to
https://my.dotcms.com/tickets/detail.dot?id=80e16f71-1958-49d1-819d-66cc0f9a7738
For Push Publishing tasks, there's a chance that the pages/contents on a bundle refer to a Mod User that might not exist on the Target environment. At the moment the PageServices/ContentletServices classes are called, a Map of these contents are requested in order to invalidate them from Cache.
However, we get this error message in case the Mod User pulled from the pushed object does not exist on the DB
https://github.com/dotCMS/core/blob/master/dotCMS/src/main/java/com/dotmarketing/portlets/htmlpageasset/model/HTMLPageAsset.java#L157
We still populate the Map with a dummy mod user and let the process continue, however, this error message is deceiving and may be interpreted as a failed Push task.
ERROR c.d.p.h.m.HTMLPageAsset [Thread-2470] dotcms.org.2857 com.dotmarketing.business.NoSuchUserException: dotcms.org.2857
at com.dotmarketing.business.UserFactoryLiferayImpl.loadUserById(UserFactoryLiferayImpl.java:145)
at com.dotmarketing.business.UserAPIImpl.loadUserById(UserAPIImpl.java:69)
at com.dotmarketing.portlets.htmlpageasset.model.HTMLPageAsset.getMap(HTMLPageAsset.java:155)
at com.dotmarketing.portlets.htmlpageasset.business.HTMLPageAssetAPIImpl.fromContentlet(HTMLPageAssetAPIImpl.java:186)
at com.dotmarketing.services.ContentletServices.invalidate(ContentletServices.java:170)
at com.dotmarketing.services.ContentletServices.invalidateWorking(ContentletServices.java:160)
at com.dotmarketing.services.PageServices.invalidate(PageServices.java:88)
at com.dotmarketing.services.PageServices.invalidateAll(PageServices.java:58)
at com.dotcms.enterprise.publishing.remote.handler.ContentHandler$1.run(SourceFile:455)
at com.dotmarketing.db.HibernateUtil.finalizeCommitListeners(HibernateUtil.java:758)
at com.dotmarketing.db.HibernateUtil.closeSession(HibernateUtil.java:725)
at com.dotmarketing.db.HibernateUtil.commitTransaction(HibernateUtil.java:812)
at com.dotcms.publisher.receiver.BundlePublisher.process(BundlePublisher.java:201)
at com.dotcms.rest.PublishThread.run(PublishThread.java:41)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.liferay.portal.NoSuchUserException: dotcms.org.2857
at com.liferay.portal.ejb.UserPersistence.findByPrimaryKey(UserPersistence.java:246)
at com.liferay.portal.ejb.UserUtil.findByPrimaryKey(UserUtil.java:128)
at com.liferay.portal.ejb.UserLocalManagerImpl.getUserById(UserLocalManagerImpl.java:357)
at com.liferay.portal.ejb.UserLocalManagerUtil.getUserById(UserLocalManagerUtil.java:145)
at com.dotmarketing.business.UserFactoryLiferayImpl.loadUserById(UserFactoryLiferayImpl.java:143)
... 14 more
##Possible Solution:
Change the logging level and message of this line and indicate it will continue with a dummy user or system user.
PR: https://github.com/dotCMS/core/pull/11800
Passed QA.
In order to verify if issue is fixed I followed the steps below:
-
Added a file asset in the sender and pushed it to the receiver
-
Created a new user in the sender (test user).
-
Logged out and logged back in using this new user
-
Edited file asset using this new user and verified that Mod. User is assigned to him:

-
Pushed the file asset
-
In the receiver, verified that Mod. User was assigned to system user

-
Verified that log message has been updated with new wording: INFO handler.a: User with ID: dotcms.org.2823 does not exist. Leaving system user as mod user
Tested locally using the following environments in the sender and receiver: Upgrade from dotcms_3.6 with client dataset (db and assets) to master branch / commit 5e8b1376dbe7af2b6bf23a374cb7c3b218280e86 Ubuntu 14.04.1 / Postgres 9.3.5 / Chrome v54.0.2840.98 / Tomcat 8 / Java 8