[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
Got lots of ehcache-sizeof-agent<xxxxx>.jar when calculate memory and disk  XML
Forum Index -> Ehcache
Author Message
hanpran

neo

Joined: 04/24/2012 09:00:06
Messages: 2
Offline

Hi,
I have question about memory and disk size.
I used following methods to calculate memory and disk used for each cache.
long memory = cache.calculateInMemorySize();
long disk = cache.calculateOnDiskSize();

But I found following info from log
Apr 24, 2012 6:01:33 PM net.sf.ehcache.pool.impl.DefaultSizeOfEngine <init>
INFO: using Agent sizeof engine

And it will generate a jar file in temp folder every time when my server start.
Such as ehcache-sizeof-agent6180971373061181966.jar
I have got lots of ehcache-sizeof-agent<xxxxx>.jar in the temp folder.
Am I using the correct method? How to avoid the jar generation in temp folder? Thanks.
alexsnaps

consul

Joined: 06/19/2009 09:06:00
Messages: 484
Offline

When trying to load the AgentSizeOf, we will extract the ehcache-sizeof-agent.jar from the ehcache-core.jar and mark it as deleteOnExit()
Could it be you kill your Java process, rather than having it exit properly ? If not, what Java version are you running ? And on what platform ? Some AppServer involved ?

If want to avoid the agent to be loaded at runtime, you can use the -javaagent: switch to point to the jar while starting the VM.

Alex Snaps (Terracotta engineer)
hanpran

neo

Joined: 04/24/2012 09:00:06
Messages: 2
Offline

Hi,
Thanks for your response.
I use tomcat6 and java1.6 on windows. The temp jar was generated under tomcat temp dir.
I just run CacheManager.shutdown() when the server is stopped.
Should it delete the temp jar file?

What does "deleteOnExit() " mean? When server stopped or java process stopped?
alexsnaps

consul

Joined: 06/19/2009 09:06:00
Messages: 484
Offline

When the VM exits... Is your app being redeployed a lot ? Cause that could also cause problems I think... We could have the CacheManager delete it when it is being shut down indeed.
So you don't kill tomcat ? You do shut it down properly ? When that is being done, are the files properly deleted ?

Alex Snaps (Terracotta engineer)
lijie

journeyman

Joined: 09/04/2012 23:10:13
Messages: 19
Offline

Hi, we meet the same problem, how to avoid generate the jar in the temp directiory?
thx~
alexsnaps

consul

Joined: 06/19/2009 09:06:00
Messages: 484
Offline

Same questions as above. How do you shut your JVM process down ?
Are new files being created with each redeploy of the app ?

Alex Snaps (Terracotta engineer)
wrightd

neo

Joined: 08/21/2014 05:25:32
Messages: 1
Offline

Same issues here. Hundreds of ehcache-sizeof-agentXXXX.jar files in temp folder.
I'm on Windows. No App server involved. I have a bunch of Junit tests which start up a CacheManager, do some stuff, and shut the CacheManager down again. For each test looks like I'm getting one of these jar files in the temp folder.
Pretty sure the ant/junit architecture is shutting down the JVM properly.

A little research reveals that calling deleteOnExit might not be sufficient on windows to ensure the file is deleted. See the PS to this answer on stackoverflow:
http://stackoverflow.com/a/16694493

Is it possible some class is not closing the jar file?
 
Forum Index -> Ehcache
Go to:   
Powered by JForum 2.1.7 © JForum Team