Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recompiling or re-evaluateing an udo causes error and fills memory #1023

Closed
hlolli opened this issue Sep 22, 2018 · 4 comments
Closed

recompiling or re-evaluateing an udo causes error and fills memory #1023

hlolli opened this issue Sep 22, 2018 · 4 comments

Comments

@hlolli
Copy link
Member

hlolli commented Sep 22, 2018

I'm glad I was able to reproduce this with the c-api. I got this from nwhetsell's csound-api on node.js, with different instrument and different udo, but same symptoms, I'm only seeing the error messages here in c, because in nodejs everything froze, and it was a 50/50 if node threw heap error or I had to unplug the computer.

#include <stdio.h>
#include <csound.h>

const char* orc =
  "sr=44100\n"
  "ksmps=32\n"
  "nchnls=2\n"
  "0dbfs=1\n\n";


const char* udo =
  "opcode declick, a, a\n"
  "ain     xin\n"
  "aenv    linseg 0, 0.02, 1, p3 - 0.05, 1, 0.02, 0, 0.01, 0\n"
  "xout ain * aenv\n"
  "endop\n";


const char* instr1 =
  "instr 1\n"
  "asig poscil 0.1, 200\n"
  "asig declick asig\n"
  "outs asig,asig\n"
  "endin";


const char* sco = "i1 0 20";

int main(int arg, char** argv) {

  csoundInitialize(CSOUNDINIT_NO_ATEXIT);

  CSOUND* csound = csoundCreate(NULL);
  csoundSetOption(csound, "-odac");
  csoundCompileOrc(csound, orc);
  csoundCompileOrc(csound, udo);
  csoundCompileOrc(csound, instr1);
  csoundReadScore(csound, (char*)sco);

  csoundStart(csound);

  int cnt = 0;
  
  while (csoundPerformKsmps(csound) == 0) {
    cnt++;
    if (cnt == round(44100/32*2)) {
      csoundCompileOrc(csound, udo);
    }
  }

  csoundStop(csound);

  return 0;
}

I'm building csound from develop on revision 9bf43d212db5e0de5cf46302e0b7687857fdd003 (week old I guess), the version number 6.11.0 is just my incorrect name I gave the modified build script. I'm on NixOs.

Error and some stacktrace

error:  invalid input type for opcode  
error:  invalid input type for opcode  
error:  invalid input type for opcode  
error:  invalid input type for opcode  
error:  invalid input type for opcode  
error:  invalid input type for opcode  
error:  invalid input type for opcode  
error:  invalid input type for opcode  
error:  invalid input type for opcode  
error:  invalid input type for opcode  
^Cbacktrace() returned 15 addresses
/nix/store/rcks7p3m1s4fmgawfw430gwsspnyksq5-csound-6.11.0/lib/libcsound64.so.6.0(+0x43ef3) [0x7fcb20ec2ef3]
/nix/store/2qgjpsn1zkf0clvrrjympwf6ar2dx83r-glibc-2.27/lib/libc.so.6(+0x34c50) [0x7fcb213d6c50]
/nix/store/2qgjpsn1zkf0clvrrjympwf6ar2dx83r-glibc-2.27/lib/libc.so.6(__write+0x5d) [0x7fcb2148639d]
/nix/store/2qgjpsn1zkf0clvrrjympwf6ar2dx83r-glibc-2.27/lib/libc.so.6(_IO_file_write+0x2d) [0x7fcb21419ddd]
/nix/store/2qgjpsn1zkf0clvrrjympwf6ar2dx83r-glibc-2.27/lib/libc.so.6(+0x77181) [0x7fcb21419181]
/nix/store/2qgjpsn1zkf0clvrrjympwf6ar2dx83r-glibc-2.27/lib/libc.so.6(_IO_file_xsputn+0x16e) [0x7fcb2141a4de]
/nix/store/2qgjpsn1zkf0clvrrjympwf6ar2dx83r-glibc-2.27/lib/libc.so.6(fwrite+0x10f) [0x7fcb2140f3ff]
/nix/store/rcks7p3m1s4fmgawfw430gwsspnyksq5-csound-6.11.0/lib/libcsound64.so.6.0(+0x272b1d) [0x7fcb210f1b1d]
/nix/store/rcks7p3m1s4fmgawfw430gwsspnyksq5-csound-6.11.0/lib/libcsound64.so.6.0(+0x27335c) [0x7fcb210f235c]
/nix/store/rcks7p3m1s4fmgawfw430gwsspnyksq5-csound-6.11.0/lib/libcsound64.so.6.0(+0x255871) [0x7fcb210d4871]
/nix/store/rcks7p3m1s4fmgawfw430gwsspnyksq5-csound-6.11.0/lib/libcsound64.so.6.0(csoundParseOrc+0x240) [0x7fcb210f0d60]
/nix/store/rcks7p3m1s4fmgawfw430gwsspnyksq5-csound-6.11.0/lib/libcsound64.so.6.0(+0x2717c7) [0x7fcb210f07c7]
./bug() [0x400999]
/nix/store/2qgjpsn1zkf0clvrrjympwf6ar2dx83r-glibc-2.27/lib/libc.so.6(__libc_start_main+0xee) [0x7fcb213c3b8e]
./bug() [0x4009ea]
Csound tidy up: Interrupt
@hlolli
Copy link
Member Author

hlolli commented Sep 22, 2018

On my computer, revision 1hlkrnv3gghx4v382nl6v6k2k1dzm5ddk35m5g3q6pzc959726s7 (6.11.0 release), works fine, just a warning about redefined udo.

@kunstmusik
Copy link
Member

kunstmusik commented Sep 22, 2018 via email

@hlolli
Copy link
Member Author

hlolli commented Sep 23, 2018

Ok nice :) no stress.

@jpffitch
Copy link
Contributor

The crash as been removed and other improvements made. Not the final solution but that will have to wait as it is deep in the system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants