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

2014-03-27 Thread alineasol
We only have resolved the rebuild from cache problem when resources are down

You have the changes in the class *UrlResource.java* in our previous post in
bold and also the patch posted by Toshiya Kobayashi: 
https://github.com/droolsjbpm/drools/commit/34d7d2c7de1ce55cea93f7317a7c682c69c57eae
https://github.com/droolsjbpm/drools/commit/34d7d2c7de1ce55cea93f7317a7c682c69c57eae
  





--
View this message in context: 
http://drools.46999.n3.nabble.com/KnowledgeAgentImpl-memory-leak-5-5-0-Final-tp4028798p4028986.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


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

2014-03-27 Thread alineasol
Now we only have the memory leak problem when kbase is rebuilt because of
resource changes



--
View this message in context: 
http://drools.46999.n3.nabble.com/KnowledgeAgentImpl-memory-leak-5-5-0-Final-tp4028798p4028994.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


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

2014-03-24 Thread alineasol
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=4504473if
(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.___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

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

2014-03-24 Thread alineasol
First of all thank you very much for your help 


We 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 variable 
public 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-tp4028798p4028934.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


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

2014-03-20 Thread alineasol
is it this problem a known bug?
We have noticed this problem in our production system. We can not change
Drools version easily. 



--
View this message in context: 
http://drools.46999.n3.nabble.com/KnowledgeAgentImpl-memory-leak-5-5-0-Final-tp4028798p4028819.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


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

2014-03-20 Thread alineasol
We use a Linux system and we set the maximum memory size for the tomcat java
process, so we can not increase it.



--
View this message in context: 
http://drools.46999.n3.nabble.com/KnowledgeAgentImpl-memory-leak-5-5-0-Final-tp4028798p4028820.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] ResourceChangeScannerImpl - Thread stop problem (v5.5.0 final)

2014-03-20 Thread alineasol
Any idea about this?



--
View this message in context: 
http://drools.46999.n3.nabble.com/ResourceChangeScannerImpl-Thread-stop-problem-v5-5-0-final-tp4027160p4028821.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


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

2014-03-19 Thread alineasol
Hello,

We have a  KnowledgeAgent with this configuration:
   * drools.resource.scanner.interval = 900
   * drools.agent.monitorChangeSetEvents = true
   * drools.agent.scanResources = true
   * drools.agent.scanDirectories = true
   * drools.agent.newInstance = false
   * drools.resource.urlcache = /path/cache

We have noticed a memory leak in the class KnowledgeAgentImpl when the
resources are down. The KnowledgeAgentImpl begins to reload from cache all
the resources every scanner interval they are not reachable. The
KnowledgeAgentImpl object increases its size every loop causing a Java Perm
Gen error.

We use:
   * drools release 5.5.0.Final
   * jdk1.6.0_45
   * apache tomcat 7.0.42


Any suggestion?

Thank you. 



--
View this message in context: 
http://drools.46999.n3.nabble.com/KnowledgeAgentImpl-memory-leak-5-5-0-Final-tp4028798.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users