Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (568)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  jar_cacheXXXXXXX ......  (Read 796 times)
0 Members and 1 Guest are viewing this topic.
Offline DzzD
« Posted 2010-04-01 20:48:12 »

just fall into another plugin bugs todays ....

I was wondering why I got out of disk space and after looking for some minutes I finally found this folder: XX:/Users/DzzD/AppData/Local/Temp/ (on Vista, this is a little different folder on XP but bug can be reproduced with XP too) it was containing hundreds of thousands file each named jar_cacheXXXXX ( more than 14GB ! ), seems that those files are created when using URLConnection with setUseCache(true) the funny things is that they are even NOT used as cached files (always reloaded) and they are not jar files.. in my particular case renaming them to ".png" works and I can then open them with any image editor....


so conclusion are : never deleted and never used as cached file version and file are not what the name would indicate (jar_cacheXXX are not jar ....)


( NB: after removing setUsecahe(true) all is going nice & faster )


http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4166799   

and they said fixed ?!?

Online Riven
« League of Dukes »

JGO Overlord


Medals: 803
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #1 - Posted 2010-04-01 22:17:40 »

Oracle should hire another bunch of monkeys.

Most clientside bugs that plague Java are the kind of bugs you make in highschool.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline DzzD
« Reply #2 - Posted 2010-04-01 23:27:23 »

here is a test case :

open you temp folder X:/Users/~/AppData/Local/Temp (on Vista) and try to run this Applet http://demo.dzzd.net/JarCacheBug/  it will fullfill your disk (no fear it would requiere a very long time...)

this only happen on aborted or unclosed transferts : developpers may not use setUseCache(true) on URLConnection or ensure that stream is always properly closed to solve this but it would be a lot better if the JVM was ALWAYS freing those files when exiting ....

EDIT: bug seems to be appear randomly.... sometimes it work nice


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
/**
 * JarCacheBug Applet application
 *
 * Using URLConnection with setUseCache(true) have severals issues :
 *  - create hundreds of useless (not used as cache) in ~/AppData/Local/Temp/ (for Vista) <br>
 *  - slow down the network <br>
 *  - misnamed files (jar_cacheXXXXX files can be any kind of file and are the raw copy of the downloaded ressource ec: png / class / txt / etc.. files )<br>
 * <br>
 * this Applet will download several times the same file from the server using URLConnection & setUseCache(true) and intentionaly not gracefully end the connection , while running open your XX:/Users/~/AppData/Local/Temp/ directory (or the equivalent on your system)<br>
 *
 * @author Bruno Augier http://dzzd.net/
 * @version 1.00 2010/04/02
 */

 
import java.awt.*;
import java.applet.*;
import java.net.*;
import java.io.*;

public class JarCacheBug extends Applet implements Runnable
{
   public static final long serialVersionUID = 0x01;
   
   
   private volatile boolean threadMustRun;
   private volatile Thread thread;
   private volatile int downloadCount;
   private volatile int downloadSize;
   
   public void init()
   {
      this.threadMustRun=true;
      this.downloadCount=0;
      this.downloadSize=0;
   }
   
   public void start()
   {
      this.thread=new Thread(this);
      this.thread.start();
   }
   
   public void run()
   {
      try
      {
     
         while(this.threadMustRun)
         {
            URL url=new URL(this.getCodeBase()+"/JAVA.PNG");
            URLConnection uc=url.openConnection();
            uc.setUseCaches(true);
           
            int size=uc.getContentLength();
           
            if(size==-1)
               throw new Exception(" No source file length ");
           
            byte data[]=new byte[size];
           
            InputStream is=uc.getInputStream();
           
            int nbRead=0;
            do
            {
               int nbToRead=Math.min(size-nbRead,10*1024);
               int nb=is.read(data,nbRead,nbToRead);
           
               if(nb==-1)
                  throw new Exception(" reading error ");
           
               nbRead+=nb;
           
            }
            while(nbRead!=size);
           
            //Simulate transfert abort by not closing the stream
           //is.close();
           
            this.downloadSize+=size;            
            this.downloadCount++;
           
            this.repaint();
           
            Thread.sleep(100);
         }
      }
      catch(Exception e)
      {
         e.printStackTrace();
      }
      this.threadMustRun=false;
      this.thread=null;
   }

   public void paint(Graphics g)
   {
      g.drawString( this.downloadCount + " downloads finished (" + this.downloadSize + " total bytes) ", 50, 60 );
   }
   
   public void destroy()
   {
      this.threadMustRun=false;
      try
      {
         this.thread.join();
      }
      catch(InterruptedException ie)
      {
         ie.printStackTrace();
      }
   }
}



Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline DzzD
« Reply #3 - Posted 2010-04-01 23:52:10 »

hum.. not sure how to always reproduce it ... seems that if the ressource is loaded once than it does not appear anymor , dont know this version  http://demo.dzzd.net/JarCacheBug/ seems now to always cause the bug for me ... I changed the image

the jar_cacheXXX files sometimes appears when you close the applet and not while it is running

Offline DzzD
« Reply #4 - Posted 2010-04-02 00:06:07 »

I would say that the issue seems to be that when you close a browser with an applet every opened URLConnection using cache (not closed inputstream) even old one are all copied to some jar_cacheXXX files in the temp dir rather than being discarded

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Pippogeek (41 views)
2014-09-24 16:13:29

Pippogeek (32 views)
2014-09-24 16:12:22

Pippogeek (22 views)
2014-09-24 16:12:06

Grunnt (47 views)
2014-09-23 14:38:19

radar3301 (30 views)
2014-09-21 23:33:17

BurntPizza (65 views)
2014-09-21 02:42:18

BurntPizza (37 views)
2014-09-21 01:30:30

moogie (44 views)
2014-09-21 00:26:15

UprightPath (53 views)
2014-09-20 20:14:06

BurntPizza (55 views)
2014-09-19 03:14:18
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!