On Fri, 18 Jul 2025 at 16:55, Bertho Stultiens <l...@vagrearg.org> wrote:

> another race condition.
>
> In mb2hal.c:
>      hal_ready(gbl.hal_mod_id);
>      OK(gbl.init_dbg, "HAL components created OK");
>      gbl.quit_flag = 0;
>      signal(SIGINT, quit_signal);
>      signal(SIGTERM, quit_signal);

Yes, that does seem a little badly placed  in the code.

> The same race condition is still present because the 'result' file is
> closed (in runtests by the shell) when halrun exists. But we know that
> halrun's exit is not enough to prevent the race because halrun must have
> exited or 'checkresult' will not be executed.

That makes sense, but appears not to be true. Adding this:

# Wait to make sure the result file is finished writing
while lsof | grep "/result" > /dev/null
do
   date +"%T.%6N"
done

Results in:

Running test: tests/mb2hal/mb2hal.1a
21:10:51.263123
21:10:51.366667
21:10:51.470404
21:10:51.574493
Runtest: 1 tests run, 1 successful, 0 failed + 0 expected, 0 skipped,
0 shmem errors


> > But I am also wondering if that check should be in the "runtests"
> > script rather than in specific "checkresults" scripts.
>
> That depends on finding a common denominator for _all_ tests that must
> be satisfied.

I think that testing for the result file write being complete probably
is universal to files where a result file is expected.
(which is one of a small number of cases in runtests)

The fact that this works isn't enough to convince me that it is an
answer, though, for the reasons you outline.
But, clearly, the file is being seen as open even while runtests runs,
and then closes a few milliseconds later.

-- 
atp
"A motorcycle is a bicycle with a pandemonium attachment and is
designed for the especial use of mechanical geniuses, daredevils and
lunatics."
— George Fitch, Atlanta Constitution Newspaper, 1912


_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to