Csound Csound-dev Csound-tekno Search About

[Cs-dev] Another bug in 5.17

Date2012-03-22 16:32
FromMichael Gogins
Subject[Cs-dev] Another bug in 5.17
Segmentation fault on line 340 of signalflowgraph.cpp following a
complete clean and rebuild. Possibly some change in how instruments or
opcodes are deactivated and/or their memory is managed? The
implication is that h is not valid.

        // Loop over the source connection instances...
        std::vector *instances = sourceOutlets->at(sourceI);
        for (size_t instanceI = 0, instanceN = instances->size();
             instanceI < instanceN;
             instanceI++) {
          Outleta *sourceOutlet = instances->at(instanceI);
          // Skip inactive instances.
340          if (sourceOutlet->h.insdshead->actflg) {
            // Loop over the samples in the inlet buffer.
            for (int sampleI = 0;
                 sampleI < sampleN;
                 sampleI++) {
              asignal[sampleI] += sourceOutlet->asignal[sampleI];
            }
          }
        }
      }

Help!

Regards,
Mike
-- 
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2012-03-22 20:13
FromTito Latini
SubjectRe: [Cs-dev] Another bug in 5.17
AttachmentsNone  

Date2012-03-24 01:26
FromMichael Gogins
SubjectRe: [Cs-dev] Another bug in 5.17
Attachmentstest.orc  test.sco  None  None  
I have attached test files that reproduce this. In the debugger it
seems to be the inleta opcode pointer that is not valid. I suspect
that alwayson instruments are being deallocated before the score is
truly, finally, completely finished.

Regards,
Mike

On Thu, Mar 22, 2012 at 12:32 PM, Michael Gogins
 wrote:
> Segmentation fault on line 340 of signalflowgraph.cpp following a
> complete clean and rebuild. Possibly some change in how instruments or
> opcodes are deactivated and/or their memory is managed? The
> implication is that h is not valid.
>
>        // Loop over the source connection instances...
>        std::vector *instances = sourceOutlets->at(sourceI);
>        for (size_t instanceI = 0, instanceN = instances->size();
>             instanceI < instanceN;
>             instanceI++) {
>          Outleta *sourceOutlet = instances->at(instanceI);
>          // Skip inactive instances.
> 340          if (sourceOutlet->h.insdshead->actflg) {
>            // Loop over the samples in the inlet buffer.
>            for (int sampleI = 0;
>                 sampleI < sampleN;
>                 sampleI++) {
>              asignal[sampleI] += sourceOutlet->asignal[sampleI];
>            }
>          }
>        }
>      }
>
> Help!
>
> Regards,
> Mike
> --
> Michael Gogins
> Irreducible Productions
> http://www.michael-gogins.com
> Michael dot Gogins at gmail dot com



-- 
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com

Date2012-03-24 01:40
FromSteven Yi
SubjectRe: [Cs-dev] Another bug in 5.17
Hi Michael,

I just ran this here on OSX with commandline csound. I did not see any
problems or segfaults, and let it run all the way through. Using
5.17.3, compiled March 21st.

Is this on Windows or Linux?  Have you tested on another platform?

steven

On Sat, Mar 24, 2012 at 1:26 AM, Michael Gogins
 wrote:
> I have attached test files that reproduce this. In the debugger it
> seems to be the inleta opcode pointer that is not valid. I suspect
> that alwayson instruments are being deallocated before the score is
> truly, finally, completely finished.
>
> Regards,
> Mike
>
> On Thu, Mar 22, 2012 at 12:32 PM, Michael Gogins
>  wrote:
>> Segmentation fault on line 340 of signalflowgraph.cpp following a
>> complete clean and rebuild. Possibly some change in how instruments or
>> opcodes are deactivated and/or their memory is managed? The
>> implication is that h is not valid.
>>
>>        // Loop over the source connection instances...
>>        std::vector *instances = sourceOutlets->at(sourceI);
>>        for (size_t instanceI = 0, instanceN = instances->size();
>>             instanceI < instanceN;
>>             instanceI++) {
>>          Outleta *sourceOutlet = instances->at(instanceI);
>>          // Skip inactive instances.
>> 340          if (sourceOutlet->h.insdshead->actflg) {
>>            // Loop over the samples in the inlet buffer.
>>            for (int sampleI = 0;
>>                 sampleI < sampleN;
>>                 sampleI++) {
>>              asignal[sampleI] += sourceOutlet->asignal[sampleI];
>>            }
>>          }
>>        }
>>      }
>>
>> Help!
>>
>> Regards,
>> Mike
>> --
>> Michael Gogins
>> Irreducible Productions
>> http://www.michael-gogins.com
>> Michael dot Gogins at gmail dot com
>
>
>
> --
> Michael Gogins
> Irreducible Productions
> http://www.michael-gogins.com
> Michael dot Gogins at gmail dot com
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2012-03-24 07:11
FromTito Latini
SubjectRe: [Cs-dev] Another bug in 5.17
AttachmentsNone  

Date2012-03-24 12:04
FromTito Latini
SubjectRe: [Cs-dev] Another bug in 5.17
AttachmentsNone  

Date2012-03-24 16:32
FromTito Latini
SubjectRe: [Cs-dev] Another bug in 5.17
AttachmentsNone  

Date2012-03-24 22:11
FromTito Latini
SubjectRe: [Cs-dev] Another bug in 5.17
AttachmentsNone  

Date2012-03-25 00:31
FromMichael Gogins
SubjectRe: [Cs-dev] Another bug in 5.17
How does that affect the case here, where "alwayson" effect
instruments are running in the s or e section of the score? I suspect
that is the cause of the problem. I wonder if instances are being
deallocated at the start of an s or e event (intead of after the
indicated time), or if alwayson instruments are treated differently
now (I don't think this used to be a problem).

Regards,
Mike

On Sat, Mar 24, 2012 at 6:11 PM, Tito Latini  wrote:
> A possible solution is to free all inactive instr spaces
> except `csound->curip'. It is safe and without memory leaks.
>
> diff -ur csound5~/Engine/insert.c csound5/Engine/insert.c
> --- csound5~/Engine/insert.c    2012-03-24 22:15:55.000000000 +0100
> +++ csound5/Engine/insert.c     2012-03-24 22:16:51.000000000 +0100
> @@ -676,7 +676,7 @@
>         prvip = NULL;
>         prvnxtloc = &txtp->instance;
>         do {
> -          if (!ip->actflg) {
> +          if (!ip->actflg && ip != csound->curip) {
>             cnt++;
>             if (ip->opcod_iobufs && ip->insno > csound->maxinsno)
>               mfree(csound, ip->opcod_iobufs);          /* IV - Nov 10 2002 */
>
>
> tito
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel



-- 
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2012-03-25 12:01
FromTito Latini
SubjectRe: [Cs-dev] Another bug in 5.17
AttachmentsNone  

Date2012-03-25 13:10
FromMichael Gogins
SubjectRe: [Cs-dev] Another bug in 5.17
The signal flow graph opcodes manage their own memory to some extent.
The collections of nodes are deallocated in a csoundModuleDestroy
call. If this came before the freeing of the instrument instances,
while some sort of performance was still under way, that would cause
this segmentation fault.

On Sun, Mar 25, 2012 at 7:01 AM, Tito Latini  wrote:
> Here is my complete debug of `orcompact', after `s' in your example.
>
> ...
> end of section 1         sect peak amps:   436.24   492.22
> DEBUG: [act] insno 0
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: free insno 1
> DEBUG: [act] insno 3
> DEBUG: [act] insno 4
> DEBUG: [act] insno 5
> DEBUG: [act] insno 6
> DEBUG: [act] insno 7
> inactive allocs returned to freespace
> SECTION 2:
> ...
>
>
> where `DEBUG: [act] insno N' are the active instances that are not freed,
> so the instruments 3, 4, 5, 6 and 7 are *really* always on.
>
> The instrument 1 (Harpsichord) contains `outleta'. The last freed `insno 1'
> is `csound->curip'. Perhaps it is a problem with the threads, therefore
> I have proposed the prior patch.
>
> Another info: your example works without `Reverberation' (not alwayson).
>
> tito
>
> On Sat, Mar 24, 2012 at 08:31:14PM -0400, Michael Gogins wrote:
>> How does that affect the case here, where "alwayson" effect
>> instruments are running in the s or e section of the score? I suspect
>> that is the cause of the problem. I wonder if instances are being
>> deallocated at the start of an s or e event (intead of after the
>> indicated time), or if alwayson instruments are treated differently
>> now (I don't think this used to be a problem).
>>
>> Regards,
>> Mike
>>
>> On Sat, Mar 24, 2012 at 6:11 PM, Tito Latini  wrote:
>> > A possible solution is to free all inactive instr spaces
>> > except `csound->curip'. It is safe and without memory leaks.
>> >
>> > diff -ur csound5~/Engine/insert.c csound5/Engine/insert.c
>> > --- csound5~/Engine/insert.c    2012-03-24 22:15:55.000000000 +0100
>> > +++ csound5/Engine/insert.c     2012-03-24 22:16:51.000000000 +0100
>> > @@ -676,7 +676,7 @@
>> >         prvip = NULL;
>> >         prvnxtloc = &txtp->instance;
>> >         do {
>> > -          if (!ip->actflg) {
>> > +          if (!ip->actflg && ip != csound->curip) {
>> >             cnt++;
>> >             if (ip->opcod_iobufs && ip->insno > csound->maxinsno)
>> >               mfree(csound, ip->opcod_iobufs);          /* IV - Nov 10 2002 */
>> >
>> >
>> > tito
>> >
>> > ------------------------------------------------------------------------------
>> > This SF email is sponsosred by:
>> > Try Windows Azure free for 90 days Click Here
>> > http://p.sf.net/sfu/sfd2d-msazure
>> > _______________________________________________
>> > Csound-devel mailing list
>> > Csound-devel@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>>
>>
>> --
>> Michael Gogins
>> Irreducible Productions
>> http://www.michael-gogins.com
>> Michael dot Gogins at gmail dot com
>>
>> ------------------------------------------------------------------------------
>> This SF email is sponsosred by:
>> Try Windows Azure free for 90 days Click Here
>> http://p.sf.net/sfu/sfd2d-msazure
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel



-- 
Michael Gogins
Irreducible Productions
http://www.michael-gogins.com
Michael dot Gogins at gmail dot com

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2012-03-25 13:40
FromTito Latini
SubjectRe: [Cs-dev] Another bug in 5.17
AttachmentsNone