[jira] [Updated] (JCR-3568) Property.getBinary().getStream() files in tempDir not removed by InputStream.close() nor by Binary.dispose()

2016-09-27 Thread Julian Reschke (JIRA)

 [ 
https://issues.apache.org/jira/browse/JCR-3568?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Julian Reschke updated JCR-3568:

Description: 
I need to inspect the the files stored to the jcr:data-Property in Node 
jcr:content which is a subnode of a nt:file-Node. Access mode is WebDAV using 
JCR 2.0-API.
Jackrabbit does not drop the temp files created by the command 
Property.getBinary().getStream() by the closing instructions 
InputStream.close() nor Binary.dispose(). I get a RepositoryException "No space 
left on device" when the  tempspace becomes full.

The executed code is;

{code}
public class DownloadLoopMain {

private final static Logger LOGGER = 
LoggerFactory.getLogger("Test.DownloadLoopMain");

String repository = "http://localhost:8080/server";;
String user="admin";
String password="admin";
Session session;
File temp = new File(System.getProperty("java.io.tmpdir"));

List nodeList = new ArrayList();

public DownloadLoopMain() throws Exception {
LOGGER.info("TempDir=" + temp.getPath());
long totalsize=0;

connectRepository();
buildNodeList();

List tempfiles = getTempFiles(temp.listFiles());
LOGGER.info("Start with number of files in Tempdir:" + 
tempfiles.size());
for (String node : nodeList) {  
LOGGER.info("Retrieve node " + node);
Node currentNode=session.getNode(node);
Node fileNode = currentNode.getNode("jcr:content");
Property jcrdata = fileNode.getProperty("jcr:data");
Binary fileBin=jcrdata.getBinary();
long filesize=fileBin.getSize();
totalsize+=filesize;
InputStream file = fileBin.getStream();

LOGGER.info("Now we have number of files in Tempdir:" + 
tempfiles.size());  

List newTempfiles = 
getTempFiles(temp.listFiles());

// Display new files in temp-directory
compareTempfiles("new", newTempfiles, tempfiles);

// Display files gone from temp-directory
compareTempfiles("gone", tempfiles, newTempfiles);

tempfiles=newTempfiles;

file.close();
fileBin.dispose();
}
}


/**
 * Compare List of tempfiles.
 * @param intend
 * @param list1
 * @param list2
 */
public void compareTempfiles(String intend, List list1, 
List list2 ) {
for (String[] list1file : list1) {
boolean known=false;
for (int i=0; i< list2.size(); i++) {
String[] list2file=list2.get(i);
if (list1file[0].equals(list2file[0])) {
known=true;
break;
}
}
if (!known) {
LOGGER.info(intend + " tempfile=" + 
list1file[0]+ " " + list1file[1]);
}
}
}

public List getTempFiles(File[] files) {
List filesList = new ArrayList();
for (File file : files) {
String[] filedesc = new String[2];
filedesc[0]=file.getName();
filedesc[1]=file.length()+"";
filesList.add(filedesc);
}
return filesList;
}

public void buildNodeList() throws IOException {
String path ="E:/Jackrabbit/logs/Populate-Files.log";
File file = new File(path);
BufferedReader br = new BufferedReader(new FileReader(file));
String line;
while ((line=br.readLine())!=null) {
nodeList.add(line);
}
br.close();
String 
knownPath="/content/dam/ebase/privatebase/en/media/franz/2012/11_november/1211_VV-Interview_en_640x320_VP8.webm/jcr:content/renditions/original";

}


private void connectRepository() throws Exception {
LOGGER.info("About ot connect to " + this.repository);
Repository repository = 
org.apache.jackrabbit.commons.JcrUtils.getRepository(this.repository);
char[] password=this.password.toCharArray();
 

[jira] [Updated] (JCR-3568) Property.getBinary().getStream() files in tempDir not removed by InputStream.close() nor by Binary.dispose()

2016-09-27 Thread Julian Reschke (JIRA)

 [ 
https://issues.apache.org/jira/browse/JCR-3568?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Julian Reschke updated JCR-3568:

Description: 
I need to inspect the the files stored to the jcr:data-Property in Node 
jcr:content which is a subnode of a nt:file-Node. Access mode is WebDAV using 
JCR 2.0-API.
Jackrabbit does not drop the temp files created by the command 
Property.getBinary().getStream() by the closing instructions 
InputStream.close() nor Binary.dispose(). I get a RepositoryException "No space 
left on device" when the  tempspace becomes full.

The executed code is;
public class DownloadLoopMain {

private final static Logger LOGGER = 
LoggerFactory.getLogger("Test.DownloadLoopMain");

String repository = "http://localhost:8080/server";;
String user="admin";
String password="admin";
Session session;
File temp = new File(System.getProperty("java.io.tmpdir"));

List nodeList = new ArrayList();

public DownloadLoopMain() throws Exception {
LOGGER.info("TempDir=" + temp.getPath());
long totalsize=0;

connectRepository();
buildNodeList();

List tempfiles = getTempFiles(temp.listFiles());
LOGGER.info("Start with number of files in Tempdir:" + 
tempfiles.size());
for (String node : nodeList) {  
LOGGER.info("Retrieve node " + node);
Node currentNode=session.getNode(node);
Node fileNode = currentNode.getNode("jcr:content");
Property jcrdata = fileNode.getProperty("jcr:data");
Binary fileBin=jcrdata.getBinary();
long filesize=fileBin.getSize();
totalsize+=filesize;
InputStream file = fileBin.getStream();

LOGGER.info("Now we have number of files in Tempdir:" + 
tempfiles.size());  

List newTempfiles = 
getTempFiles(temp.listFiles());

// Display new files in temp-directory
compareTempfiles("new", newTempfiles, tempfiles);

// Display files gone from temp-directory
compareTempfiles("gone", tempfiles, newTempfiles);

tempfiles=newTempfiles;

file.close();
fileBin.dispose();
}
}


/**
 * Compare List of tempfiles.
 * @param intend
 * @param list1
 * @param list2
 */
public void compareTempfiles(String intend, List list1, 
List list2 ) {
for (String[] list1file : list1) {
boolean known=false;
for (int i=0; i< list2.size(); i++) {
String[] list2file=list2.get(i);
if (list1file[0].equals(list2file[0])) {
known=true;
break;
}
}
if (!known) {
LOGGER.info(intend + " tempfile=" + 
list1file[0]+ " " + list1file[1]);
}
}
}

public List getTempFiles(File[] files) {
List filesList = new ArrayList();
for (File file : files) {
String[] filedesc = new String[2];
filedesc[0]=file.getName();
filedesc[1]=file.length()+"";
filesList.add(filedesc);
}
return filesList;
}

public void buildNodeList() throws IOException {
String path ="E:/Jackrabbit/logs/Populate-Files.log";
File file = new File(path);
BufferedReader br = new BufferedReader(new FileReader(file));
String line;
while ((line=br.readLine())!=null) {
nodeList.add(line);
}
br.close();
String 
knownPath="/content/dam/ebase/privatebase/en/media/franz/2012/11_november/1211_VV-Interview_en_640x320_VP8.webm/jcr:content/renditions/original";

}


private void connectRepository() throws Exception {
LOGGER.info("About ot connect to " + this.repository);
Repository repository = 
org.apache.jackrabbit.commons.JcrUtils.getRepository(this.repository);
char[] password=this.password.toCharArray();
 

[jira] [Updated] (JCR-3568) Property.getBinary().getStream() files in tempDir not removed by InputStream.close() nor by Binary.dispose()

2013-05-14 Thread Tobias Bocanegra (JIRA)

 [ 
https://issues.apache.org/jira/browse/JCR-3568?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tobias Bocanegra updated JCR-3568:
--

Attachment: jcr3568-r1482639.patch

new patch that implements a ref counter to avoid disposal of still used 
binaries.

> Property.getBinary().getStream() files in tempDir not removed by 
> InputStream.close() nor by Binary.dispose() 
> -
>
> Key: JCR-3568
> URL: https://issues.apache.org/jira/browse/JCR-3568
> Project: Jackrabbit Content Repository
>  Issue Type: Bug
>  Components: jackrabbit-spi-commons, jackrabbit-webdav
>Affects Versions: 2.4, 2.6, 2.7
> Environment: Windows 7 Pro, Java 6.0.39, WebDAV, JCR 2.0
>Reporter: Ulrich Schmidt
> Attachments: jcr3568-r1482639.patch
>
>
> I need to inspect the the files stored to the jcr:data-Property in Node 
> jcr:content which is a subnode of a nt:fille-Node. Access mode is WebDAV 
> using JCR 2.0-API.
> Jackrabbit does not drop the tempfiles created by the command 
> Property.getBinary().getStream() by the closing instruchtions 
> InputStream.close() nor Binary.dispose(). I get a RepositoryException "No 
> space left on device" when der tempsace becomes full.
> The executed code is;
> public class DownloadLoopMain {
>   private final static Logger LOGGER = 
> LoggerFactory.getLogger("Test.DownloadLoopMain");
>   String repository = "http://localhost:8080/server";;
>   String user="admin";
>   String password="admin";
>   Session session;
>   File temp = new File(System.getProperty("java.io.tmpdir"));
>   List nodeList = new ArrayList();
>   public DownloadLoopMain() throws Exception {
>   LOGGER.info("TempDir=" + temp.getPath());
>   long totalsize=0;
>   
>   connectRepository();
>   buildNodeList();
>   List tempfiles = getTempFiles(temp.listFiles());
>   LOGGER.info("Start with number of files in Tempdir:" + 
> tempfiles.size());
>   for (String node : nodeList) {  
>   LOGGER.info("Retrieve node " + node);
>   Node currentNode=session.getNode(node);
>   Node fileNode = currentNode.getNode("jcr:content");
>   Property jcrdata = fileNode.getProperty("jcr:data");
>   Binary fileBin=jcrdata.getBinary();
>   long filesize=fileBin.getSize();
>   totalsize+=filesize;
>   InputStream file = fileBin.getStream();
>   
>   LOGGER.info("Now we have number of files in Tempdir:" + 
> tempfiles.size());  
>   
>   List newTempfiles = 
> getTempFiles(temp.listFiles());
>   // Display new files in temp-directory
>   compareTempfiles("new", newTempfiles, tempfiles);
>   
>   // Display files gone from temp-directory
>   compareTempfiles("gone", tempfiles, newTempfiles);
>   
>   tempfiles=newTempfiles;
>   
>   file.close();
>   fileBin.dispose();
>   }
>   }
>   
>   
>   /**
>* Compare List of tempfiles.
>* @param intend
>* @param list1
>* @param list2
>*/
>   public void compareTempfiles(String intend, List list1, 
> List list2 ) {
>   for (String[] list1file : list1) {
>   boolean known=false;
>   for (int i=0; i< list2.size(); i++) {
>   String[] list2file=list2.get(i);
>   if (list1file[0].equals(list2file[0])) {
>   known=true;
>   break;
>   }
>   }
>   if (!known) {
>   LOGGER.info(intend + " tempfile=" + 
> list1file[0]+ " " + list1file[1]);
>   }
>   }
>   }
>   public List getTempFiles(File[] files) {
>   List filesList = new ArrayList();
>   for (File file : files) {
>   String[] filedesc = new String[2];
>   filedesc[0]=file.getName();
>   filedesc[1]=file.length()+"";
>   filesList.add(filedesc);
>   }
>   return filesList;
>   }
>   
>   public void buildNodeList() throws IOException {
>   String path ="E:/Jackrabbit/logs/Populate-Fi

[jira] [Updated] (JCR-3568) Property.getBinary().getStream() files in tempDir not removed by InputStream.close() nor by Binary.dispose()

2013-05-03 Thread Tobias Bocanegra (JIRA)

 [ 
https://issues.apache.org/jira/browse/JCR-3568?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tobias Bocanegra updated JCR-3568:
--

Affects Version/s: 2.4

> Property.getBinary().getStream() files in tempDir not removed by 
> InputStream.close() nor by Binary.dispose() 
> -
>
> Key: JCR-3568
> URL: https://issues.apache.org/jira/browse/JCR-3568
> Project: Jackrabbit Content Repository
>  Issue Type: Bug
>  Components: jackrabbit-spi-commons, jackrabbit-webdav
>Affects Versions: 2.4, 2.6, 2.7
> Environment: Windows 7 Pro, Java 6.0.39, WebDAV, JCR 2.0
>Reporter: Ulrich Schmidt
>
> I need to inspect the the files stored to the jcr:data-Property in Node 
> jcr:content which is a subnode of a nt:fille-Node. Access mode is WebDAV 
> using JCR 2.0-API.
> Jackrabbit does not drop the tempfiles created by the command 
> Property.getBinary().getStream() by the closing instruchtions 
> InputStream.close() nor Binary.dispose(). I get a RepositoryException "No 
> space left on device" when der tempsace becomes full.
> The executed code is;
> public class DownloadLoopMain {
>   private final static Logger LOGGER = 
> LoggerFactory.getLogger("Test.DownloadLoopMain");
>   String repository = "http://localhost:8080/server";;
>   String user="admin";
>   String password="admin";
>   Session session;
>   File temp = new File(System.getProperty("java.io.tmpdir"));
>   List nodeList = new ArrayList();
>   public DownloadLoopMain() throws Exception {
>   LOGGER.info("TempDir=" + temp.getPath());
>   long totalsize=0;
>   
>   connectRepository();
>   buildNodeList();
>   List tempfiles = getTempFiles(temp.listFiles());
>   LOGGER.info("Start with number of files in Tempdir:" + 
> tempfiles.size());
>   for (String node : nodeList) {  
>   LOGGER.info("Retrieve node " + node);
>   Node currentNode=session.getNode(node);
>   Node fileNode = currentNode.getNode("jcr:content");
>   Property jcrdata = fileNode.getProperty("jcr:data");
>   Binary fileBin=jcrdata.getBinary();
>   long filesize=fileBin.getSize();
>   totalsize+=filesize;
>   InputStream file = fileBin.getStream();
>   
>   LOGGER.info("Now we have number of files in Tempdir:" + 
> tempfiles.size());  
>   
>   List newTempfiles = 
> getTempFiles(temp.listFiles());
>   // Display new files in temp-directory
>   compareTempfiles("new", newTempfiles, tempfiles);
>   
>   // Display files gone from temp-directory
>   compareTempfiles("gone", tempfiles, newTempfiles);
>   
>   tempfiles=newTempfiles;
>   
>   file.close();
>   fileBin.dispose();
>   }
>   }
>   
>   
>   /**
>* Compare List of tempfiles.
>* @param intend
>* @param list1
>* @param list2
>*/
>   public void compareTempfiles(String intend, List list1, 
> List list2 ) {
>   for (String[] list1file : list1) {
>   boolean known=false;
>   for (int i=0; i< list2.size(); i++) {
>   String[] list2file=list2.get(i);
>   if (list1file[0].equals(list2file[0])) {
>   known=true;
>   break;
>   }
>   }
>   if (!known) {
>   LOGGER.info(intend + " tempfile=" + 
> list1file[0]+ " " + list1file[1]);
>   }
>   }
>   }
>   public List getTempFiles(File[] files) {
>   List filesList = new ArrayList();
>   for (File file : files) {
>   String[] filedesc = new String[2];
>   filedesc[0]=file.getName();
>   filedesc[1]=file.length()+"";
>   filesList.add(filedesc);
>   }
>   return filesList;
>   }
>   
>   public void buildNodeList() throws IOException {
>   String path ="E:/Jackrabbit/logs/Populate-Files.log";
>   File file = new File(path);
>   BufferedReader br = new BufferedReader(new FileReader(file));
>   String l

[jira] [Updated] (JCR-3568) Property.getBinary().getStream() files in tempDir not removed by InputStream.close() nor by Binary.dispose()

2013-04-23 Thread Julian Reschke (JIRA)

 [ 
https://issues.apache.org/jira/browse/JCR-3568?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Julian Reschke updated JCR-3568:


  Component/s: jackrabbit-spi-commons
Affects Version/s: 2.7

> Property.getBinary().getStream() files in tempDir not removed by 
> InputStream.close() nor by Binary.dispose() 
> -
>
> Key: JCR-3568
> URL: https://issues.apache.org/jira/browse/JCR-3568
> Project: Jackrabbit Content Repository
>  Issue Type: Bug
>  Components: jackrabbit-spi-commons, jackrabbit-webdav
>Affects Versions: 2.6, 2.7
> Environment: Windows 7 Pro, Java 6.0.39, WebDAV, JCR 2.0
>Reporter: Ulrich Schmidt
>
> I need to inspect the the files stored to the jcr:data-Property in Node 
> jcr:content which is a subnode of a nt:fille-Node. Access mode is WebDAV 
> using JCR 2.0-API.
> Jackrabbit does not drop the tempfiles created by the command 
> Property.getBinary().getStream() by the closing instruchtions 
> InputStream.close() nor Binary.dispose(). I get a RepositoryException "No 
> space left on device" when der tempsace becomes full.
> The executed code is;
> public class DownloadLoopMain {
>   private final static Logger LOGGER = 
> LoggerFactory.getLogger("Test.DownloadLoopMain");
>   String repository = "http://localhost:8080/server";;
>   String user="admin";
>   String password="admin";
>   Session session;
>   File temp = new File(System.getProperty("java.io.tmpdir"));
>   List nodeList = new ArrayList();
>   public DownloadLoopMain() throws Exception {
>   LOGGER.info("TempDir=" + temp.getPath());
>   long totalsize=0;
>   
>   connectRepository();
>   buildNodeList();
>   List tempfiles = getTempFiles(temp.listFiles());
>   LOGGER.info("Start with number of files in Tempdir:" + 
> tempfiles.size());
>   for (String node : nodeList) {  
>   LOGGER.info("Retrieve node " + node);
>   Node currentNode=session.getNode(node);
>   Node fileNode = currentNode.getNode("jcr:content");
>   Property jcrdata = fileNode.getProperty("jcr:data");
>   Binary fileBin=jcrdata.getBinary();
>   long filesize=fileBin.getSize();
>   totalsize+=filesize;
>   InputStream file = fileBin.getStream();
>   
>   LOGGER.info("Now we have number of files in Tempdir:" + 
> tempfiles.size());  
>   
>   List newTempfiles = 
> getTempFiles(temp.listFiles());
>   // Display new files in temp-directory
>   compareTempfiles("new", newTempfiles, tempfiles);
>   
>   // Display files gone from temp-directory
>   compareTempfiles("gone", tempfiles, newTempfiles);
>   
>   tempfiles=newTempfiles;
>   
>   file.close();
>   fileBin.dispose();
>   }
>   }
>   
>   
>   /**
>* Compare List of tempfiles.
>* @param intend
>* @param list1
>* @param list2
>*/
>   public void compareTempfiles(String intend, List list1, 
> List list2 ) {
>   for (String[] list1file : list1) {
>   boolean known=false;
>   for (int i=0; i< list2.size(); i++) {
>   String[] list2file=list2.get(i);
>   if (list1file[0].equals(list2file[0])) {
>   known=true;
>   break;
>   }
>   }
>   if (!known) {
>   LOGGER.info(intend + " tempfile=" + 
> list1file[0]+ " " + list1file[1]);
>   }
>   }
>   }
>   public List getTempFiles(File[] files) {
>   List filesList = new ArrayList();
>   for (File file : files) {
>   String[] filedesc = new String[2];
>   filedesc[0]=file.getName();
>   filedesc[1]=file.length()+"";
>   filesList.add(filedesc);
>   }
>   return filesList;
>   }
>   
>   public void buildNodeList() throws IOException {
>   String path ="E:/Jackrabbit/logs/Populate-Files.log";
>   File file = new File(path);
>   BufferedReader br = new BufferedReader(new FileRe

[jira] [Updated] (JCR-3568) Property.getBinary().getStream() files in tempDir not removed by InputStream.close() nor by Binary.dispose()

2013-04-17 Thread Stefan Guggisberg (JIRA)

 [ 
https://issues.apache.org/jira/browse/JCR-3568?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Guggisberg updated JCR-3568:
---

Component/s: (was: jackrabbit-api)
 jackrabbit-webdav
   Priority: Major  (was: Blocker)

this is not a jackrabbit-core issue. 

i ran your test code against a local repository with the default configuration 
(created with "new TransientRepository()").

i used test files with a total size of about 1gb.

there were no temp files created.

this might be a sling issue or a webdav-client or -server issue. 

to further narrow down the problem please run your test with
the following configurations:

- standalone repository accessed in-proc (not deployed in sling)
- standalone repository server accessed via webdav (not deployed in sling)

 




> Property.getBinary().getStream() files in tempDir not removed by 
> InputStream.close() nor by Binary.dispose() 
> -
>
> Key: JCR-3568
> URL: https://issues.apache.org/jira/browse/JCR-3568
> Project: Jackrabbit Content Repository
>  Issue Type: Bug
>  Components: jackrabbit-webdav
>Affects Versions: 2.6
> Environment: Windows 7 Pro, Java 6.0.39, WebDAV, JCR 2.0
>Reporter: Ulrich Schmidt
>
> I need to inspect the the files stored to the jcr:data-Property in Node 
> jcr:content which is a subnode of a nt:fille-Node. Access mode is WebDAV 
> using JCR 2.0-API.
> Jackrabbit does not drop the tempfiles created by the command 
> Property.getBinary().getStream() by the closing instruchtions 
> InputStream.close() nor Binary.dispose(). I get a RepositoryException "No 
> space left on device" when der tempsace becomes full.
> The executed code is;
> public class DownloadLoopMain {
>   private final static Logger LOGGER = 
> LoggerFactory.getLogger("Test.DownloadLoopMain");
>   String repository = "http://localhost:8080/server";;
>   String user="admin";
>   String password="admin";
>   Session session;
>   File temp = new File(System.getProperty("java.io.tmpdir"));
>   List nodeList = new ArrayList();
>   public DownloadLoopMain() throws Exception {
>   LOGGER.info("TempDir=" + temp.getPath());
>   long totalsize=0;
>   
>   connectRepository();
>   buildNodeList();
>   List tempfiles = getTempFiles(temp.listFiles());
>   LOGGER.info("Start with number of files in Tempdir:" + 
> tempfiles.size());
>   for (String node : nodeList) {  
>   LOGGER.info("Retrieve node " + node);
>   Node currentNode=session.getNode(node);
>   Node fileNode = currentNode.getNode("jcr:content");
>   Property jcrdata = fileNode.getProperty("jcr:data");
>   Binary fileBin=jcrdata.getBinary();
>   long filesize=fileBin.getSize();
>   totalsize+=filesize;
>   InputStream file = fileBin.getStream();
>   
>   LOGGER.info("Now we have number of files in Tempdir:" + 
> tempfiles.size());  
>   
>   List newTempfiles = 
> getTempFiles(temp.listFiles());
>   // Display new files in temp-directory
>   compareTempfiles("new", newTempfiles, tempfiles);
>   
>   // Display files gone from temp-directory
>   compareTempfiles("gone", tempfiles, newTempfiles);
>   
>   tempfiles=newTempfiles;
>   
>   file.close();
>   fileBin.dispose();
>   }
>   }
>   
>   
>   /**
>* Compare List of tempfiles.
>* @param intend
>* @param list1
>* @param list2
>*/
>   public void compareTempfiles(String intend, List list1, 
> List list2 ) {
>   for (String[] list1file : list1) {
>   boolean known=false;
>   for (int i=0; i< list2.size(); i++) {
>   String[] list2file=list2.get(i);
>   if (list1file[0].equals(list2file[0])) {
>   known=true;
>   break;
>   }
>   }
>   if (!known) {
>   LOGGER.info(intend + " tempfile=" + 
> list1file[0]+ " " + list1file[1]);
>   }
>   }
>   }
>   public List getTempFiles(File[] files) {
>   List fil