Whenever a user is created or associated to a user-group some zip files are created in liferay tomcat temp folder . The files correspond to the public private pages of the group associated . If user created are very large server crashes saying "Too many open files".
The zip files are created when we call adduser method of UserService.
The add user internally calls addUserGroupUsers which leads to file creation
1. UserLocalServiceUtil.addUserGroupUsers(userGroupId, userIds); //UserInfoLocalServiceImpl in addUsersUserGroups() method
2. userGroupLocalService.copyUserGroupLayouts(userGroupId, userIds); //UserLocalServiceImpl.java-> addUserGroupUsers() method
3. files = exportLayouts(userGroupId, parameterMap); //UserGroupLocalServiceImpl.java-> copyUserGroupLayouts() method
//Code that exports layouts to zip file in UserGroupLocalServiceImpl.java
files = layoutLocalService.exportLayoutsAsFile(groupId, true, null, parameterMap, null, null);
files = layoutLocalService.exportLayoutsAsFile(groupId, false, null, parameterMap, null, null);
In layout exporter the file are created by usingexportLayoutsAsFile() method mentioned above .
zipWriter = ZipWriterFactoryUtil.getZipWriter();//LayoutExporter.class -> exportLayoutsAsFile() method
PortletDataContext context = new PortletDataContextImpl(companyId, groupId, parameterMap, new HashSet(), startDate, endDate, zipWriter);
If we try to bypass the zip file creation the files and files then files are not created but when user logs in the portal it gets default liferay pages not the group public, private pages . My initial thought was that the server looks for the temp folder zip files only if its newly created (connection to file open) otherwise it will refer database so I created another user but before logging in I restarted the server . Group -pages were still not reflected even though the user has mapping to the user-group in database .
Are these zip files in temp are mandatory for first time logging??
I also tried to delete the temp files every 1 minute via an batch process, but though the zip file is getting deleted, the file handle still remains open. The file handle for all these zip files are created by the main liferay process and only server restart kills the file handler
I did some analysis and found that the files are created/not-created in following cases
1. When user is associated with a group that has different template of public private page. 2 zip files are created.
2. When user is created and not associated to any user-group .As only association of user group created the zip. No zip file is created
3. When user is associated to a user group with no public private pages ,that is an empty group .
4. When the group has same template for public private pages . one zip file is created as each zip file correspond to user pages.
5. When user group is altered in a way that portlets on public private pages are changed or an empty group is assigned some template zip is created for the group not the user