Results 1 to 1 of 1
  1. #1
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

    Default "The process tried to write to a nonexistent pipe"

    EDIT: I figured out my problem thanks to the magic of posting about it. My program was ending when it detected a log file entry that was after the date range it was supposed to be converting. If the log contained a large amount of data after this, the type command would print the error when it tried to write to my program, which had ended.

    ORIGINAL POST:

    I've written a program that converts a proprietary log file to HTML. It reads from standard input and writes to standard output. It's used by piping the log file to it with type or cat, and then redirecting the output to a file.

    A couple people are using it successfully, but one user is having problems when his log files get too large. He gets this error: "The process tried to write to a nonexistent pipe"

    I think what's happening is my program is prematurely detecting the end of the file and exiting. My program just reads from stdin until read returns -1.

    Java Code:
    while(true) {
    				int read = System.in.read(buffer);
    				if(read == -1) break;
    				Record record = new Record(buffer, 0);
    				Date ts = record.getDate();
    				if(ts.after(begin) || ts.equals(begin)) {
    					if(ts.before(end)) {
    						records.add(record);
    					}
    					else break;
    				}
    			}
    Could the problem be caused by a limited buffer size in the shell's pipe or a delay in writing to it? Would that cause read to return -1?

    Is there anything I can do, short of changing my program to read the file directly instead of reading from stdin?
    Last edited by kjkrum; 09-21-2011 at 09:25 PM.
    Get in the habit of using standard Java naming conventions!

Similar Threads

  1. Replies: 24
    Last Post: 06-21-2010, 05:49 PM
  2. Replies: 2
    Last Post: 01-24-2009, 07:56 PM
  3. Replies: 2
    Last Post: 01-06-2009, 04:53 PM
  4. Replies: 1
    Last Post: 10-20-2008, 08:35 AM
  5. Struts 1.x <bean:write format="0.00%"> help?
    By prabhurangan in forum Web Frameworks
    Replies: 0
    Last Post: 07-02-2008, 01:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •