* [Caml-list] Strange File IO bug
@ 2016-07-26 19:33 Dmitriy Musatkin
2016-07-27 16:56 ` Adrien Nader
0 siblings, 1 reply; 3+ messages in thread
From: Dmitriy Musatkin @ 2016-07-26 19:33 UTC (permalink / raw)
To: caml-list
[-- Attachment #1: Type: text/plain, Size: 899 bytes --]
Hi all,
I maintain a small OCaml program that generates some data, writes it to a
temporary file and creates another process, which then reads that temporary
file. Recently, I've received a few reports from users that the program
generates an empty file when it should not. All of the affected users run
either 64bit Win7 or Win10. I have access to one of those users' machines,
and I can reproduce the issue consistently, however I'm not able to
reproduce the issue on any other machine.
The file io part looks something like following:
let oc = open_out_bin file in
output_string oc s;
close_out oc
The string "s" has non-zero size. The out channel has non-zero length and
doing Unix.stat on the file after its closed shows non-zero size. However,
both the newly created process and Windows see the file as empty after the
program exits.
Any ideas on what might be happening?
Thanks,
Dmitriy
[-- Attachment #2: Type: text/html, Size: 1149 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Strange File IO bug
2016-07-26 19:33 [Caml-list] Strange File IO bug Dmitriy Musatkin
@ 2016-07-27 16:56 ` Adrien Nader
2016-07-27 18:24 ` Gerd Stolpmann
0 siblings, 1 reply; 3+ messages in thread
From: Adrien Nader @ 2016-07-27 16:56 UTC (permalink / raw)
To: Dmitriy Musatkin; +Cc: caml-list
Hi,
On Tue, Jul 26, 2016, Dmitriy Musatkin wrote:
> Hi all,
>
> I maintain a small OCaml program that generates some data, writes it to a
> temporary file and creates another process, which then reads that temporary
> file. Recently, I've received a few reports from users that the program
> generates an empty file when it should not. All of the affected users run
> either 64bit Win7 or Win10. I have access to one of those users' machines,
> and I can reproduce the issue consistently, however I'm not able to
> reproduce the issue on any other machine.
>
> The file io part looks something like following:
> let oc = open_out_bin file in
> output_string oc s;
> close_out oc
>
Most probably, "flush oc" before "close oc": out_channel is buffered. :)
--
Adrien Nader
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Strange File IO bug
2016-07-27 16:56 ` Adrien Nader
@ 2016-07-27 18:24 ` Gerd Stolpmann
0 siblings, 0 replies; 3+ messages in thread
From: Gerd Stolpmann @ 2016-07-27 18:24 UTC (permalink / raw)
To: Adrien Nader; +Cc: Dmitriy Musatkin, caml-list
[-- Attachment #1: Type: text/plain, Size: 1385 bytes --]
Am Mittwoch, den 27.07.2016, 18:56 +0200 schrieb Adrien Nader:
> Hi,
>
> On Tue, Jul 26, 2016, Dmitriy Musatkin wrote:
> > Hi all,
> >
> > I maintain a small OCaml program that generates some data, writes it to a
> > temporary file and creates another process, which then reads that temporary
> > file. Recently, I've received a few reports from users that the program
> > generates an empty file when it should not. All of the affected users run
> > either 64bit Win7 or Win10. I have access to one of those users' machines,
> > and I can reproduce the issue consistently, however I'm not able to
> > reproduce the issue on any other machine.
> >
> > The file io part looks something like following:
> > let oc = open_out_bin file in
> > output_string oc s;
> > close_out oc
> >
>
> Most probably, "flush oc" before "close oc": out_channel is buffered. :)
No. close implies flush.
Another cause could be a network drive, and a synchronization issue.
Gerd
> --
> Adrien Nader
>
--
------------------------------------------------------------
Gerd Stolpmann, Darmstadt, Germany gerd@gerd-stolpmann.de
My OCaml site: http://www.camlcity.org
Contact details: http://www.camlcity.org/contact.html
Company homepage: http://www.gerd-stolpmann.de
------------------------------------------------------------
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-07-27 18:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-26 19:33 [Caml-list] Strange File IO bug Dmitriy Musatkin
2016-07-27 16:56 ` Adrien Nader
2016-07-27 18:24 ` Gerd Stolpmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox