Giter VIP home page Giter VIP logo

Comments (6)

ignazio1977 avatar ignazio1977 commented on July 3, 2024

I found some info on page 23 of this:
http://people.apache.org/~markt/presentations/2010-11-04-Memory-Leaks-60mins.pdf

It looks like the web application should call remove() on the thread local at the end of a request - but this cannot be done with the current OWL API code. Whether it would be convenient to do so, I think not, because the cache would then be renewed after each request - if parsing of the same or similar ontologies is done in separate requests, this would reduce the cache hits and complicate the architecture.

I think the best short term solution to this is to revert to your synchronized map solution; this is not ideal, as the synchronized weak cache is potentially a bottleneck for all threads parsing ontologies at the same time, but I cannot figure out a better one, at the moment.

from owlapi.

ignazio1977 avatar ignazio1977 commented on July 3, 2024

I have reverted this and deployed a new snapshot on Sonatype. If you reckon this is urgent, I could make a new release in a week or so.

from owlapi.

ansell avatar ansell commented on July 3, 2024

I don't know if it is urgent as I am not sure how often threads would be
reused by the ServletContainer in practice and how often people will be
reloading webapps without restarting the servlet container, if that was
part of the cause.

In production I rarely reload webapps without restarting the servlet
container, as there is typically a scheduled downtime so you can have the
luxury of a cold reboot. In testing however I can't be restarting Tomcat
each time so I tend to just rely on Tomcat redeploying the servlet and that
is where the warnings came up.

According to that presentation, Tomcat has a few different viable
strategies for some of the bugs and it mentioned configurable behaviour for
ThreadLocal clearing but didn't mention how to do that there.

You could try reusing this Public Domain ConcurrentWeakHashMap solution by
Doug Lea and Jason Greene that has adjustable concurrency:

http://www.java2s.com/Code/Java/Collections-Data-Structure/Ahashtablewithemweakkeysemfullconcurrencyofretrievalsandadjustableexpectedconcurrencyforupdates.htm

It appears to support concurrent retrievals based on its Javadoc, which
would be the main application of it in WeakCache, as puts should be very
rare in practice after a small warmup phase.

On 20 May 2013 17:43, ignazio1977 [email protected] wrote:

I have reverted this and deployed a new snapshot on Sonatype. If you
reckon this is urgent, I could make a new release in a week or so.


Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-18135684
.

from owlapi.

ansell avatar ansell commented on July 3, 2024

It seems that ConcurrentWeakHashMap was later redesigned to be ConcurrentReferenceHashMap (again Public Domain by the same authors) which supports different types of References for different purposes.

http://grepcode.com/file/repo1.maven.org/maven2/org.jboss/jboss-common-core/2.2.19.GA/org/jboss/util/collection/ConcurrentReferenceHashMap.java

from owlapi.

ignazio1977 avatar ignazio1977 commented on July 3, 2024

Something along those lines is a good plan - long term, we want to replace
these in house utilities with something better Apache or guava. This last
one has configurable collections to achieve the same purpose.
On 20 May 2013 12:33, "Peter Ansell" [email protected] wrote:

It seems that ConcurrentWeakHashMap was later redesigned to be
ConcurrentReferenceHashMap (again Public Domain by the same authors) which
supports different types of References for different purposes.

http://grepcode.com/file/repo1.maven.org/maven2/org.jboss/jboss-common-core/2.2.19.GA/org/jboss/util/collection/ConcurrentReferenceHashMap.java


Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-18143026
.

from owlapi.

sujoykr1 avatar sujoykr1 commented on July 3, 2024

Threads are going to be renewed over time to try and avoid a probable memory leak

from owlapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.