Error: NonClosedInputStream

Issue

The following errors appear in author error logs:

22.01.2008 12:54:29 ERROR delivery: Unhandled Exception: com.day.cq.engine.ServiceException: /usr/local/day/cq-4.2/author/data/author/crx/workspaces/live_author/blobs/f6/6a/562772914484980cb2f403e8c920/1.68.0 (Too many open files): /usr/local/day/cq-4.2/author/data/author/crx/workspaces/live_author/blobs/f6/6a/562772914484980cb2f403e8c920/1.68.0 (Too many open files) 23.01.2008 12:37:42 ERROR jmx: IO Problem parsing descriptor for com.day.cq.util.scheduler.Event java.io.FileNotFoundException: /usr/local/day/cq-4.2/author/data/author/bin/classes/com/day/cq/util/scheduler/Event.xml (Too many open files)

23.01.2008 12:48:38 ERROR webdav: Put failed: Too many open files 23.01.2008 12:48:40 ERROR webdav: Put failed: Too many open files 23.01.2008 12:49:14 ERROR webdav: Put failed: Too many open files 23.01.2008 12:50:59 ERROR adapter: Error while updating digest: java.io.FileNotFoundException: /usr/local/day/cq-4.2/author/data/author/crx/workspaces/live_author/blobs/59/94/22047a324f25bb11674aa01a7de7/1.177.0 (Too many open files) 23.01.2008 12:50:59 ERROR adapter: Error while updateing digest: java.io.FileNotFoundException: /usr/local/day/cq-4.2/author/data/author/crx/workspaces/live_author/blobs/f3/cf/f4cc11f84023a4f498cc35be08b2/1.177.0 (Too many open files)

When these errors occur, users can still log in to author. However, the page shows missing items, red Xs for images, and so one, so author is not usable. Then, it's necessary to manually kill and restart the author processes.

Solution

Change this kind of code to something like the following:

try { InputStream ins = atom.getStream(); layer = new Layer(ins); }catch(Exception e) { // Log: exception } finally { try { if ( ins != null ) { ins.close(); ins = null; } } catch (IOException ex) { // Log: Cannot close input stream. } }

Additional information

This error occurs when the file contains constructs like the following:

layer = new Layer(atom.getStream());

atom.getStream opens a stream, but doesn't close the stream again.

 Adobe

Get help faster and easier

New user?

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online