Results 1 to 1 of 1
- 09-21-2011, 08:19 PM #1
"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.
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?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; } }
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 08:25 PM.
Get in the habit of using standard Java naming conventions!
Similar Threads
-
how to write a program for " world cup " in java
By sus in forum New To JavaReplies: 24Last Post: 06-21-2010, 04:49 PM -
MoneyOut.println("It took you (whats wrong?>",year,"<WW?) years to repay the loan")
By soc86 in forum New To JavaReplies: 2Last Post: 01-24-2009, 06:56 PM -
Java subprocesses via Runtime.exec() and windows "end process tree"...
By fxRichard in forum Advanced JavaReplies: 2Last Post: 01-06-2009, 03:53 PM -
the dollar sign "$", prints like any other normal char in java like "a" or "*" ?
By lse123 in forum New To JavaReplies: 1Last Post: 10-20-2008, 07:35 AM -
Struts 1.x <bean:write format="0.00%"> help?
By prabhurangan in forum Web FrameworksReplies: 0Last Post: 07-02-2008, 12:59 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks