Juan Hernandez has uploaded a new change for review. Change subject: packaging: Remove out of data .jar.index files ......................................................................
packaging: Remove out of data .jar.index files The application server creates .jar.index files in the modules directory in order to speed up class scanning and class loading. When the application server is updates those files are not refreshed unless the application server is started with an user that has permission to write to the /usr/share/jbossas/modules directory. The engine doesn't have those permissions, so it can end up using out of date indexes, and this can generate class loading this problems. To address that issue this patch changes the engine start script so that it scans the modules directories before starting the engine, when it is still running as root, and removes the indexes that are out of date. Change-Id: I4f27390a232df42b477dc0e9abe7909e10d9abb1 Bug-Url: https://bugzilla.redhat.com/889217 Signed-off-by: Juan Hernandez <[email protected]> --- M packaging/fedora/engine-service.py 1 file changed, 28 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/92/10292/1 diff --git a/packaging/fedora/engine-service.py b/packaging/fedora/engine-service.py index b3f5d40..47e3c6a 100644 --- a/packaging/fedora/engine-service.py +++ b/packaging/fedora/engine-service.py @@ -415,11 +415,17 @@ enginePermMin = engineConfig.getString("ENGINE_PERM_MIN") enginePermMax = engineConfig.getString("ENGINE_PERM_MAX") - # Module path should include first the engine modules so that they can override - # those provided by the application server if needed: + # Remove out of data index files from the modules directories: jbossModulesDir = os.path.join(jbossHomeDir, "modules") engineModulesDir = os.path.join(engineUsrDir, "modules") + fixIndexes(jbossModulesDir) + fixIndexes(engineModulesDir) + + # Module path should include first the engine modules so that they can override + # those provided by the application server if needed: engineModulePath = "%s:%s" % (engineModulesDir, jbossModulesDir) + + # Check the modules # We start with an empty list of arguments: engineArgs = [] @@ -583,6 +589,26 @@ shutil.rmtree(engineTmpDir) +def fixIndexes(modulesDir): + # Find and delete any out of date index older than the corresponding jar + # file: + for parentDir, childrenDirs, childrenFiles in os.walk(modulesDir): + for childFile in childrenFiles: + if not childFile.endswith(".jar"): + continue + jarFile = os.path.join(parentDir, childFile) + indexFile = jarFile + ".index" + if not os.path.exists(indexFile): + continue + jarTs = os.path.getmtime(jarFile) + indexTs = os.path.getmtime(indexFile) + if indexTs > jarTs: + continue + syslog.syslog(syslog.LOG_WARNING, "Index \"%s\" is out ouf date, " + "removing it." % indexFile) + os.remove(indexFile) + + def checkEngine(): # Load the configuration: loadConfig() -- To view, visit http://gerrit.ovirt.org/10292 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4f27390a232df42b477dc0e9abe7909e10d9abb1 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Juan Hernandez <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
