[quake3-bugzilla] [Bug 4346] ioq3ded enters endless loop if stdin is not a tty

bugzilla-daemon at icculus.org bugzilla-daemon at icculus.org
Thu Nov 19 11:22:52 EST 2009


http://bugzilla.icculus.org/show_bug.cgi?id=4346

--- Comment #1 from Guillaume Bougard <bougard.g at gmail.com> 2009-11-19 11:22:45 EST ---
Created an attachment (id=2205)
 --> (http://bugzilla.icculus.org/attachment.cgi?id=2205)
Working work-around + fix com_speeds output on dedicated server

You made me curious even if that case isn't so important.

I found 2 problems.

Firstly, when STDIN is /dev/null, a select on it returns immediately. So in
Com_Frame(), Com_Event_Loop() checks are returning after no event found giving
many times in the same ms. So it mostly results with a 0ms delay and then will
loop checking for new event. Then Com_Event_Loop() will be called as most as
possible during 1 ms.

I tried to force a Sys_Sleep() in the loop, but that did nothing... And I found
in fact, on Unix, Sys_Sleep() is based on waiting event on STDIN with a
timeout. When STDIN is /dev/null, as I said, it returns immediately... So
Sys_Sleep() is not useable when stdin is set to /dev/null.

I finally found a way to fix that case when console is disabled using
"nanosleep" calls only when console is disabled. It is working on my linux
x86_64 system (Fedora 11). I attached the patch. I don't think it is the best,
so feel free to enhance it.

Also, I saw com_speeds usage is providing wrong output on dedicated server. The
patch contains also a fix for this minor case.

-- 
Configure bugmail: http://bugzilla.icculus.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the quake3-bugzilla mailing list