Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

I/O error 103

2,209 views
Skip to first unread message

Mikael Lenfors

unread,
Oct 13, 2007, 8:10:02 AM10/13/07
to
Hello!

I have a program that has been running for years and now I suddenly get I/O
error 103. I'ts running as a windows service.

The code loooks someting like this

Try
AssignFile(F, FileName);
If FileExists(FileName) Then
Append(F)
Else
Rewrite(F);

Try
While DataAvailable Do
Begin
-- Do some processing ---
Writeln(F, Dtata);
End;
Except
On E: Exception Do
Begin
Logg('Process error: ' + E.Message);
End;
End;

CloseFile(F);

Except
On E: Exception Do
Begin
Logg('Open file error: ' + E.Message);
End;
End;

Last days it started to logg I/O error 103. It's running on a Windows 2003
server with F-secure antivirus (same problem with antivirus disabled).
I randomly get "Process error: I/O error 103" and "Open file error: I/O
error 103". Nine out of ten times there is no problem whatsoever!

The machine get's windows updates from WSUS automatically. I run ChkDsk /F
without errors.

Please, any ideas?

Regards, Mikael


Kent Briggs

unread,
Oct 13, 2007, 10:38:23 AM10/13/07
to
Mikael Lenfors wrote:

> I have a program that has been running for years and now I suddenly get I/O
> error 103.

From my old Borland Pascal Programmer's Reference:

I/O Error 103 = "File not open", reported by Close, Read, Write, Seek,
Eof, FilePos, FileSize, Flush, BlockRead, BlockWrite if the file is not
open.

--
Kent Briggs, kbr...@spamcop.net
Briggs Softworks, http://www.briggsoft.com

Mikael Lenfors

unread,
Oct 14, 2007, 10:58:14 AM10/14/07
to
Yes thanks, I know this. If you check my code sample you maybe see my
problem... The error shouldent appear in my sample! It's been running for
years but started with this error 8/10-07. Windows updates?

regards, Mikael


"Kent Briggs" <kbr...@spamcop.net> skrev i meddelandet
news:4710d86d$1...@newsgroups.borland.com...

Roger Lascelles

unread,
Oct 17, 2007, 7:55:37 PM10/17/07
to
"Mikael Lenfors" <mik...@lenfors.se> wrote in message
news:4710...@newsgroups.borland.com...

> Hello!
>
> I have a program that has been running for years and now I suddenly get
> I/O error 103. I'ts running as a windows service.
>
> The code loooks someting like this
>
> Try
> AssignFile(F, FileName);
> If FileExists(FileName) Then
> Append(F)
> Else
> Rewrite(F);
<snip>

Suggestion 1, alter the code to give more information when an error occurs.
For example, does the error always come after an Append or a Rewrite or
both? Or perhaps you know already?

Suggestion 2, if your code gets called often, FileExists may be letting you
down, because it tracks through the file system and may not be precisely in
sync with what is happening. Windows requires time for stuff to propagate
around, and multi-core CPUs add another variable. I know the FileExists()
sequence has been used from the days of TP, but it makes me uneasy and I
often use a TFileStream which can open existing files or WinAPI CreateFile
for total control.

Roger Lascelles

0 new messages