[ecasound] [PATCH] libecasoundc: retry eci_impl_fd_read() even if poll timeout (was: Re: eci_init() fails on MIPS)

From: Alessandro Ghedini <alessandro@email-addr-hidden>
Date: Fri Jan 31 2014 - 13:33:28 EET

On Thu, Jan 30, 2014 at 11:05:24PM +0200, Kai Vehmanen wrote:
> Hi,
>
> On Sun, 26 Jan 2014, Alessandro Ghedini wrote:
> >the eci_init() function in libecasoundc doesn't seem to work on MIPS. The
> >following test case fails:
>
> this will launch a ecasound process on the background and try to
> connect to it via a pipe. Perhaps the executable cannot be started.

Nope, ecasound gets started correctly.

> You could try run the test program with "ECASOUND_LOGFILE=log.txt
> ./test" or try to "strace -f ./test" to figure out what's going
> wrong.

This is the relevant part (when the error occurs):

[...]
9070 clock_gettime(CLOCK_MONOTONIC, {1721804, 754373473}) = 0
9068 <... poll resumed> ) = 0 (Timeout)
9070 clock_gettime(CLOCK_MONOTONIC, {1721804, 756334781}) = 0
9070 clock_gettime(CLOCK_MONOTONIC, {1721804, 756537710}) = 0
9070 clock_gettime(CLOCK_MONOTONIC, {1721804, 756738400}) = 0
9070 clock_gettime(CLOCK_MONOTONIC, {1721804, 756939884}) = 0
9070 clock_gettime(CLOCK_MONOTONIC, {1721804, 757140772}) = 0
9070 clock_gettime(CLOCK_MONOTONIC, {1721804, 757342496}) = 0
9070 clock_gettime(CLOCK_MONOTONIC, {1721804, 757544092}) = 0
9070 clock_gettime(CLOCK_MONOTONIC, {1721804, 757745677}) = 0
9070 clock_gettime(CLOCK_MONOTONIC, {1721804, 757947137}) = 0
9070 clock_gettime(CLOCK_MONOTONIC, {1721804, 758148795}) = 0
9070 clock_gettime(CLOCK_MONOTONIC, {1721804, 758349873}) = 0
9070 clock_gettime(CLOCK_MONOTONIC, {1721804, 758551329}) = 0
9070 clock_gettime(CLOCK_MONOTONIC, {1721804, 758752200}) = 0
9070 clock_gettime(CLOCK_MONOTONIC, {1721804, 758954256}) = 0
9070 clock_gettime(CLOCK_MONOTONIC, {1721804, 759155872}) = 0
9070 clock_gettime(CLOCK_MONOTONIC, {1721804, 759357456}) = 0
9070 clock_gettime(CLOCK_MONOTONIC, {1721804, 759559136}) = 0
9070 clock_gettime(CLOCK_MONOTONIC, {1721804, 759760719}) = 0
9070 clock_gettime(CLOCK_MONOTONIC, {1721804, 759962259}) = 0
9070 clock_gettime(CLOCK_MONOTONIC, {1721804, 760202002}) = 0
9068 write(2, "\n(ecasoundc_sa) Error='read() error', cmd='' last_error='' cmd_cnt=1 last_cnt=0.\n", 81) = 81
9068 brk(0x85e000) = 0x85e000
9070 clock_gettime(CLOCK_MONOTONIC, {1721804, 764930227}) = 0
[...]

(9070 is ecasound, 9068 is the test case). You can get the full trace at [0].

So, if I read the trace correctly, it appears that the poll timeout used in
eci_impl_fd_read() expires before ecasound is ready, which in turn makes
eci_impl_read_return_value() fail.

So, a possible solution would be to retry the eci_impl_fd_read() even if the
timeout has expired. That part of the code is already run in a loop for, at
most, ECI_MAX_RESYNC_ATTEMPTS times, so there should be no risk in getting stuck
there.

See the attached patch (I already verified that it fixes the problem).

Cheers

[0] http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=76;filename=trace.xz;att=1;bug=736616

-- 
perl -E '$_=q;$/= @{[@_]};and s;\S+;<inidehG ordnasselA>;eg;say~~reverse'

------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable
security intelligence. It gives you real-time visual feedback on key
security issues and trends. Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk

_______________________________________________
Ecasound-list mailing list
Ecasound-list@email-addr-hidden
https://lists.sourceforge.net/lists/listinfo/ecasound-list

Received on Fri Jan 31 16:15:02 2014

This archive was generated by hypermail 2.1.8 : Fri Jan 31 2014 - 16:15:02 EET