[PATCH] libecasoundc: retry eci_impl_fd_read() even if poll timeout (was: Re: eci_init() fails on MIPS)
Alessandro Ghedini <[email protected]> Fri, 31 Jan 2014 12:33:28 +0100
| Newsgroups | gmane.comp.audio.ecasound.general |
|---|---|
| Message-ID | <20140131113328.GA2103@kronk> |
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ecasound-list
0001-libecasoundc-retry-eci_impl_fd_read-even-if-poll-tim.patch
(text/x-diff, 824 B)
From e78b87b59b5e8b9a40843fc726e7ee7059a7134e Mon Sep 17 00:00:00 2001 From: Alessandro Ghedini <[email protected]> Date: Fri, 31 Jan 2014 00:22:21 +0100 Subject: [PATCH] libecasoundc: retry eci_impl_fd_read() even if poll timeout has expired --- libecasoundc/ecasoundc_sa.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libecasoundc/ecasoundc_sa.c b/libecasoundc/ecasoundc_sa.c index 7692cae..bbe736b 100644 --- a/libecasoundc/ecasoundc_sa.c +++ b/libecasoundc/ecasoundc_sa.c @@ -1041,8 +1041,6 @@ static void eci_impl_read_return_value(struct eci_internal* eci_rep, int timeout else { if (res < 0) { ECI_DEBUG_1("(ecasoundc_sa) timeout when reading return values (attempts=%d)!\n", attempts); - eci_rep->parser_repp->sync_lost_rep = true; - break; } } ++attempts; -- 1.9.rc1
signature.asc
(application/pgp-signature, 819 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJS64oFAAoJEK+lG9bN5XPLqtwP/iWEf+4ietxhcL+7MYqi05UA 9OGGMo78r7dYw1E2WcGvZTJ1ByGo51C9uUapwXS3SvMzOfY620E8SVIczvcdplgn GcXAgEv3zKBTGJ+4a58DCYofyVRw4lOIV+Qp2MdSK/3g+1eGTMfarbOF++ln9bSE ByExtQIFrKd70GXY+21G3NY4bYyD5XfqugFAEYhOvNJU3yYLXs6ptLSUEdJGZcHG AaAkqPd0lCxLfhxivt6mlFiz0VIXcE4rCLfLkMcFD5C5XX+Jol2Lx1ZdC5yKaJCu xw4U7vY8GYvKw9blp4j2IZJTwf8SPAymNOQyAHL91kipUDX2p5BMOk3Ysy0oWaaa JOy42Kn5gQflOPF6LSruSitKZk7erAGjH0+1DhKleZfsZBVXGFsYcipP7YV4RyoU RzyBU98wV99KV8toOZ1lcM+GK4iyOm4FGDvk2ZwCX9UJ4STy7/5s9fb91Ht7nbVg wFLxHInu9mQ8aPz4JXc6dgAK1x/HNEdRIKaQeNEM0eTpjhjA/D7AoEXiTI9u2Yju sInmpc2mlOXTClKvZS6iFE5Q7MCPlPyTfvzwFQVXhaMUGrDF0Jih3+hQ6kyc0z3o LyQrrfCB3O5DHtRz5lUwEQvm5NkVaZXcHJr5e2xthmlKEZzCsCyYukecN0a+xlxL xVcrW0nxuFVyg7VUpEfJ =qau9 -----END PGP SIGNATURE-----