[rules-users] KnowledgeAgentImpl memory leak (5.5.0.Final)

alineasol engineering at alineasol.com
Mon Mar 24 10:04:25 EDT 2014


First of all thank you very much for your helpWe have downloaded drools-5.5.x
source code and tried your patch and we have noticed:- When our resources
(guvnor) are not accessible KnowledgeAgent does not rebuild kbase- When our
resources (guvnor) are accessible and we made some change then
KnowledgeAgent rebuild kbase after every loop because guvnor responses
LastModified (((HttpURLConnection) conn).getLastModified) as GMT datetime
but it is not (it depends of the timezone)We have done more changes in
drools-core.5.5.0.FINAL in the class UrlResource.java version to fix this   
private long grabLastMod() throws IOException {        // use File if
possible, as http rounds milliseconds on some machines, this fine level of
granularity is only really an issue for testing        //
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4504473        if
("file".equals(url.getProtocol())) {            File file = getFile();           
return file.lastModified();        }        URLConnection conn =
openURLConnection(getURL());        if (conn instanceof HttpURLConnection) {           
((HttpURLConnection) conn).setRequestMethod("HEAD");        }.......*       
long date = 0;        try {            date =
Long.parseLong(conn.getHeaderField("lastModified"));        } catch
(Exception e) { /* well, we tried ... */        }        if (date == 0) {           
date = conn.getLastModified();        }*.......        return date;    }On
the other hand if cache file is updated KnowledgeAgent keeps rebuilding
kbase, so to fix this we update lastRead variablepublic InputStream
getInputStream() throws IOException {        try {            long lastMod =
grabLastMod();            if (lastMod == 0) {                //we will try
the cache...                if (cacheFileExists()) {                   
*this.lastRead = getCacheFile().lastModified();*                    return
fromCache();                }            }......Finally, all these changes
do not solve the problem of memory leak with incremental kbase changes
because resource changes generate a kbase rebuilding (guvnor up). This
causes a kbase memory increase



--
View this message in context: http://drools.46999.n3.nabble.com/KnowledgeAgentImpl-memory-leak-5-5-0-Final-tp4028798p4028932.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20140324/dd1f4479/attachment.html 


More information about the rules-users mailing list