S. Massy | 10 May 2012 21:45
Picon
Favicon

Bug report: segfault, etd, time sensitive operations

Hello,

Context:
In the process of adding latency compensation to nama, we are employing
the etd chain-op to create artificial latency so that all tracks in a
chain-setup will be synchronised. The end result is that, once relative
latencies are calculated, we add etd ops where needed with the following
parameters: -etd:x,0,1,100,100, where x substitutes for the required
amount of added latency.

It seems, however, that aadding many such ops in a short period of time
causes ecasound to segfault. Here is the backtrace:
#0  0x0000000000566822 in SAMPLE_ITERATOR_CHANNEL::begin (this=0x7fffd8f60358,
    channel=0) at samplebuffer_iterators.cpp:68
#1  0x0000000000519f0c in EFFECT_DELAY::process (this=0x7fffd8f60330)
    at audiofx_timebased.cpp:209
#2  0x00000000004bebde in CHAIN::process (this=0x7fffd8002e30)
    at eca-chain.cpp:825
#3  0x000000000056082c in ECA_ENGINE::process_chains (this=0x7fffd8012c80)
    at eca-engine.cpp:1699
#4  0x00000000005653c2 in ECA_ENGINE::engine_iteration (this=0x7fffd8012c80)
    at eca-engine.cpp:688
#5  0x000000000053a5c4 in eca_jack_process_engine_iteration (nframes=128,
    arg=0x7fffd800cc40) at audioio_jack_manager.cpp:457
#6  0x000000000053b609 in eca_jack_process_timebase_slave (arg=0x7fffd800cc40,
    nframes=128) at audioio_jack_manager.cpp:565
#7  eca_jack_process_callback (arg=0x7fffd800cc40, nframes=128)
    at audioio_jack_manager.cpp:403
#8  eca_jack_process_callback (nframes=128, arg=0x7fffd800cc40)
    at audioio_jack_manager.cpp:362
(Continue reading)

S. Massy | 10 May 2012 23:44
Picon
Favicon

Re: Bug report: segfault, etd, time sensitive operations

On Thu, May 10, 2012 at 03:45:25PM -0400, S. Massy wrote:
> Hello,
> 
> Context:
> In the process of adding latency compensation to nama, we are employing
> the etd chain-op to create artificial latency so that all tracks in a
> chain-setup will be synchronised. The end result is that, once relative
> latencies are calculated, we add etd ops where needed with the following
> parameters: -etd:x,0,1,100,100, where x substitutes for the required
> amount of added latency.
> 
> It seems, however, that aadding many such ops in a short period of time
> causes ecasound to segfault. Here is the backtrace:
> #0  0x0000000000566822 in SAMPLE_ITERATOR_CHANNEL::begin (this=0x7fffd8f60358,
>     channel=0) at samplebuffer_iterators.cpp:68
> #1  0x0000000000519f0c in EFFECT_DELAY::process (this=0x7fffd8f60330)
>     at audiofx_timebased.cpp:209
> #2  0x00000000004bebde in CHAIN::process (this=0x7fffd8002e30)
>     at eca-chain.cpp:825
> #3  0x000000000056082c in ECA_ENGINE::process_chains (this=0x7fffd8012c80)
>     at eca-engine.cpp:1699
> #4  0x00000000005653c2 in ECA_ENGINE::engine_iteration (this=0x7fffd8012c80)
>     at eca-engine.cpp:688
> #5  0x000000000053a5c4 in eca_jack_process_engine_iteration (nframes=128,
>     arg=0x7fffd800cc40) at audioio_jack_manager.cpp:457
> #6  0x000000000053b609 in eca_jack_process_timebase_slave (arg=0x7fffd800cc40,
>     nframes=128) at audioio_jack_manager.cpp:565
> #7  eca_jack_process_callback (arg=0x7fffd800cc40, nframes=128)
>     at audioio_jack_manager.cpp:403
> #8  eca_jack_process_callback (nframes=128, arg=0x7fffd800cc40)
(Continue reading)

S. Massy | 12 May 2012 23:12
Picon
Favicon

Re: Bug report: segfault, etd: JACK support is to blame?

On Thu, May 10, 2012 at 03:45:25PM -0400, S. Massy wrote:
> It seems, however, that aadding many such ops in a short period of time
> causes ecasound to segfault. Here is the backtrace:
> #0  0x0000000000566822 in SAMPLE_ITERATOR_CHANNEL::begin (this=0x7fffd8f60358,
>     channel=0) at samplebuffer_iterators.cpp:68
> #1  0x0000000000519f0c in EFFECT_DELAY::process (this=0x7fffd8f60330)
>     at audiofx_timebased.cpp:209
> #2  0x00000000004bebde in CHAIN::process (this=0x7fffd8002e30)
>     at eca-chain.cpp:825
> #3  0x000000000056082c in ECA_ENGINE::process_chains (this=0x7fffd8012c80)
>     at eca-engine.cpp:1699
> #4  0x00000000005653c2 in ECA_ENGINE::engine_iteration (this=0x7fffd8012c80)
>     at eca-engine.cpp:688
> #5  0x000000000053a5c4 in eca_jack_process_engine_iteration (nframes=128,
>     arg=0x7fffd800cc40) at audioio_jack_manager.cpp:457
> #6  0x000000000053b609 in eca_jack_process_timebase_slave (arg=0x7fffd800cc40,
>     nframes=128) at audioio_jack_manager.cpp:565
> #7  eca_jack_process_callback (arg=0x7fffd800cc40, nframes=128)
>     at audioio_jack_manager.cpp:403
> #8  eca_jack_process_callback (nframes=128, arg=0x7fffd800cc40)
>     at audioio_jack_manager.cpp:362
This trace caused me to go back and try the same operations without
JACK (only alsa). This bug simply does *not* occur without the JACK
factor. I repeated the test several times. 

Cheers,
S.M.

------------------------------------------------------------------------------
Live Security Virtual Conference
(Continue reading)

Kai Vehmanen | 19 May 2012 22:15

Re: Bug report: segfault, etd, time sensitive operations

Hi,

On Thu, 10 May 2012, S. Massy wrote:

> It seems, however, that aadding many such ops in a short period of time
> causes ecasound to segfault. Here is the backtrace:

this looks a lot like something that could happen without the recent fix 
in git master (commit ca925a389154774ca7ff69d2f141f1c9000a2050 I pushed on 
Apr 17). Are you running the latest git?

The problem itself looks clear;

[OBJECTS ] (eca-control) processing cmd and arg: cop-add -etd:602.666666666667,0,1,100,100 <9087>
[SYSTEM  ] (eca-engine) wait_for_editlock <9088>
[SYSTEM  ] (eca-engine) Signaling editlock <9089>
[SYSTEM  ] (eca-engine) wait_for_editlock complete, ret -1 <9090>

.. that's not right, there should be a "Signaling stop" message there. But 
in your log, this does not happen and the -etd chainop gets added while 
engine is processing, and this will cause a crash. This also matches with 
the DBC_CHECK failure you posted in your later post.

But the problem is that this should be fixed in git already and the code 
looks correct. It could be some case is still missed, even with the latest 
code...

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
(Continue reading)

S. Massy | 20 May 2012 00:42
Picon
Favicon

Re: Bug report: segfault, etd, time sensitive operations

On Sat, May 19, 2012 at 11:15:17PM +0300, Kai Vehmanen wrote:
> Hi,
> 
> On Thu, 10 May 2012, S. Massy wrote:
> 
> >It seems, however, that aadding many such ops in a short period of time
> >causes ecasound to segfault. Here is the backtrace:
> 
> this looks a lot like something that could happen without the recent
> fix in git master (commit ca925a389154774ca7ff69d2f141f1c9000a2050 I
> pushed on Apr 17). Are you running the latest git?
Yes, this is reproductible with current (as of today) HEAD.

> But the problem is that this should be fixed in git already and the
> code looks correct. It could be some case is still missed, even with
> the latest code...
This does not occur if JACK output is not used. Could the JACK driver be
part of that sspecial case?

Cheers,
S.M.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ecasound-list mailing list
(Continue reading)

Kai Vehmanen | 26 May 2012 08:11

Re: Bug report: segfault, etd, time sensitive operations

Hi,

On Sat, 19 May 2012, S. Massy wrote:

>> But the problem is that this should be fixed in git already and the
>> code looks correct. It could be some case is still missed, even with
>> the latest code...
> This does not occur if JACK output is not used. Could the JACK driver be
> part of that sspecial case?

hmmm, which version of JACK are you using?

I've been trying with latest JACK1 (from JACK git) all morning to 
reproduce this, but no luck so far.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ecasound-list mailing list
Ecasound-list <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ecasound-list

S. Massy | 26 May 2012 08:16
Picon
Favicon

Re: Bug report: segfault, etd, time sensitive operations

On Sat, May 26, 2012 at 09:11:47AM +0300, Kai Vehmanen wrote:
> Hi,
> 
> On Sat, 19 May 2012, S. Massy wrote:
> 
> >>But the problem is that this should be fixed in git already and the
> >>code looks correct. It could be some case is still missed, even with
> >>the latest code...
> >This does not occur if JACK output is not used. Could the JACK driver be
> >part of that sspecial case?
> 
> hmmm, which version of JACK are you using?
> 
> I've been trying with latest JACK1 (from JACK git) all morning to
> reproduce this, but no luck so far.
This is with jack2 V 1.9.9.

Cheers,
S.M.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ecasound-list mailing list
Ecasound-list <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ecasound-list
(Continue reading)

Kai Vehmanen | 26 May 2012 08:58

Re: Bug report: segfault, etd, time sensitive operations

Hi,

On Sat, 26 May 2012, S. Massy wrote:

>> hmmm, which version of JACK are you using?
>>
>> I've been trying with latest JACK1 (from JACK git) all morning to
>> reproduce this, but no luck so far.
> This is with jack2 V 1.9.9.

thanks for the quick reply. I now updated my system to latest JACK2 
(from the jack2 git), and still no luck. :(

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ecasound-list mailing list
Ecasound-list <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ecasound-list

S. Massy | 26 May 2012 22:06
Picon
Favicon

Re: Bug report: segfault, etd, time sensitive operations

On Sat, May 26, 2012 at 09:58:05AM +0300, Kai Vehmanen wrote:
> Hi,
> 
> On Sat, 26 May 2012, S. Massy wrote:
> 
> >>hmmm, which version of JACK are you using?
> >>
> >>I've been trying with latest JACK1 (from JACK git) all morning to
> >>reproduce this, but no luck so far.
> >This is with jack2 V 1.9.9.
> 
> thanks for the quick reply. I now updated my system to latest JACK2
> (from the jack2 git), and still no luck. :(
I think it's pretty timing sensitive. With the latest changes in nama's
codebase, it isn't as easy to reproduce as it was, though someone
reported some problems with adding controllers (-klg, specifically) as
well. Right now, though, we make sure to stop-sync before performing
these operations and it works fairly reliably. If I find a reliable way
to reproduce the bug, I'll make sure and send the command log your way.

Cheers,
S.M.

--

-- 

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
(Continue reading)

Kai Vehmanen | 27 May 2012 22:03

Re: Bug report: segfault, etd, time sensitive operations

Hi,

On Sat, 26 May 2012, S. Massy wrote:

> I think it's pretty timing sensitive. With the latest changes in nama's
> codebase, it isn't as easy to reproduce as it was, though someone
> reported some problems with adding controllers (-klg, specifically) as

your original log was actually good enough, I just needed to spend enough 
time reading it (and again, and again). I now figured out what happens, 
could reproduce it myself with fairly high rate of occurence and finally 
make a fix -> in git and in the 2.9.0rc2 tarball.

I'm pretty sure I fixed it, but let me know if my self-confidence is 
unwarranted... :)

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ecasound-list mailing list
Ecasound-list <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ecasound-list

S. Massy | 27 May 2012 23:31
Picon
Favicon

Re: Bug report: segfault, etd, time sensitive operations

On Sun, May 27, 2012 at 11:03:16PM +0300, Kai Vehmanen wrote:
> I'm pretty sure I fixed it, but let me know if my self-confidence is
> unwarranted... :)
I'm sorry to say the bug still seems to be lurking. :( Find the trace
below and the last 250 lines of the most recent log attached. 

Thanks for all the work you put into ecasound; I'm sure I speak for many
when I say it is very much appreciated.

BACKTRACE:
#0  0x0000000000567312 in SAMPLE_ITERATOR_CHANNEL::begin (this=0x7fffd48c9038,
    channel=0) at samplebuffer_iterators.cpp:68
#1  0x000000000051a13c in EFFECT_DELAY::process (this=0x7fffd48c9010)
    at audiofx_timebased.cpp:214
#2  0x00000000004bec3e in CHAIN::process (this=0x7fffd40017c0)
    at eca-chain.cpp:825
#3  0x0000000000560fac in ECA_ENGINE::process_chains (this=0x7fffd48bf460)
    at eca-engine.cpp:1743
#4  0x0000000000565f62 in ECA_ENGINE::engine_iteration (this=0x7fffd48bf460)
    at eca-engine.cpp:708
#5  0x000000000053acc4 in eca_jack_process_engine_iteration (nframes=128,
    arg=0x7fffd42412a0) at audioio_jack_manager.cpp:457
#6  0x000000000053bc86 in eca_jack_process_callback (arg=0x7fffd42412a0,
    nframes=128) at audioio_jack_manager.cpp:391
#7  eca_jack_process_callback (nframes=128, arg=0x7fffd42412a0)
    at audioio_jack_manager.cpp:362
#8  0x00007ffff6812127 in ?? () from /usr/lib/x86_64-linux-gnu/libjack.so.0

Cheers,
S.M.
(Continue reading)

Kai Vehmanen | 31 May 2012 21:52

Re: Bug report: segfault, etd, time sensitive operations

Hi,

On Sun, 27 May 2012, S. Massy wrote:

> I'm sorry to say the bug still seems to be lurking. :( Find the trace
> below and the last 250 lines of the most recent log attached.

thanks. Not good news, but very good this was found now. It seems 
this method of changing the setup (while engine is active), is just too 
brittle. The track record of bugs with this functionality is a long and a 
sorry one, so it's probably time to face the truth and declare it a 
deadend.

The Debian deadline is looming close already and half of my home is 
already packed (and my stress levels match the packing status), so not 
really sure what to do with 2.9.0 now.

If I have time next weekend, I have a final try at this problem.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ecasound-list mailing list
Ecasound-list <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ecasound-list

(Continue reading)

S. Massy | 1 Jun 2012 00:44
Picon
Favicon

Re: Bug report: segfault, etd, time sensitive operations

On Thu, May 31, 2012 at 10:52:05PM +0300, Kai Vehmanen wrote:
> The Debian deadline is looming close already and half of my home is
> already packed (and my stress levels match the packing status), so
> not really sure what to do with 2.9.0 now.
> 
> If I have time next weekend, I have a final try at this problem.
Well, it's not my show, but here are my thoughts:
The bug is nasty but is probably likely to affect 1% of users and
applications. OTOH, features like LV2 and cop-bypass are likely to
benefit many users. So perhaps it would be best to release as it is with
something in the KNOWN BUGS section of the release notes. It might be
more important to fix the bug wherin ecasound starts by itself, as this
is likely to be problematic for users in general.

Just my two pennies' worth...

Above all, don't stress too much, it's bad for your health! :)

Cheers,
S.M.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ecasound-list mailing list
Ecasound-list <at> lists.sourceforge.net
(Continue reading)

Kai Vehmanen | 25 Oct 2012 22:31

back! (was: Re: Bug report: segfault, etd, time sensitive operations)

Hello everybody,

On Thu, 31 May 2012, Kai Vehmanen wrote:
> The Debian deadline is looming close already and half of my home is
> already packed (and my stress levels match the packing status), so not
> really sure what to do with 2.9.0 now.
>
> If I have time next weekend, I have a final try at this problem.

thank goodness that worked out and 2.9.0 was released, or otherwise it 
seems there'd have been an additional 5 month delay. :) I'm still halfway 
through the process of setting up all my audio+computer stuff at our new
place, but looking better every day.

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Ecasound-list mailing list
Ecasound-list <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ecasound-list

Kai Vehmanen | 3 Jun 2012 00:59

Re: Bug report: segfault, etd, time sensitive operations

Hi,

On Sun, 27 May 2012, S. Massy wrote:

> I'm sorry to say the bug still seems to be lurking. :( Find the trace
> below and the last 250 lines of the most recent log attached.

refactoring attempt 3...thousand, pushed to git master. Tarball at:

http://ecasound.seul.org/download/snapshots/ecasound-2.8.1+dev-20120603.tar.gz

I now did what I should have done years ago. The "convenience" feature to 
allow cop-add/ctrl-add on connected chainsetups, by stopping the engine 
briefly for the edits (and trying to hide this), was a horrible mistake in 
retrospect, and keeping it around with increasing layers of hacks, was 
just really bad sw engineering from my part -- I should have known better.

With today's patch, "cop-add" and "ctrl-add" can actually be routed via 
engine, so that the engine actually does the modifications in its own 
context, as atomic operations with regards to engine's own state. While 
still not fully real-time safe (you can have gaps in real-time output when 
you add a chainop still), but a lot faster than earlier, less code overall 
than before, easier to read code and in theory race-free. So just like 
"cop-set", "c-bypass" et al have always been.

This does have one big compromise: cop-remove and ctrl-remove no longer 
work on connected chainsetups (you can use them, but a disconnect plus 
reconnect will happen, e.g. JACK client will deactivate and reactivate, so 
a fairly big break). In theory they can be supported in the future as 
well, but I just run out of time today,
(Continue reading)


Gmane