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
Memory corruption with 6.10.0 on Ubuntu 18.04 #948
Comments
|
Hard to say without a csd file
Have you tried valgrind?
Sent from TypeApp
…On Apr 21, 2018, 01:27, at 01:27, James Cameron ***@***.***> wrote:
G'day, I'm with One Laptop per Child. I'm working a problem on the
Sugar Labs activity [Music
Keyboard](https://github.com/godiard/music-keyboard-activity), and
would like some Csound expert eyes. Music Keyboard uses Csound from
Python, as well as GStreamer and GTK+. With the upgrade to CSound
6.10.0 from 6.09, the program fails with a reproducible segmentation
fault.
```
/usr/lib/libcsound64.so.6.0(+0x3f7e3) [0x7f70d65d77e3]
/lib/x86_64-linux-gnu/libc.so.6(+0x3ef20) [0x7f70e9767f20]
/usr/lib/libcsound64.so.6.0(+0x258014) [0x7f70d67f0014]
/usr/lib/libcsound64.so.6.0(+0x272601) [0x7f70d680a601]
/usr/lib/libcsound64.so.6.0(+0x26ee34) [0x7f70d6806e34]
/usr/lib/libcsound64.so.6.0(+0x26eecb) [0x7f70d6806ecb]
/usr/lib/libcsound64.so.6.0(csoundParseOrc+0x2d7) [0x7f70d68126b7]
/usr/lib/libcsound64.so.6.0(+0x27a087) [0x7f70d6812087]
/usr/lib/libcsound64.so.6.0(csoundCompileCsdText+0x5f) [0x7f70d673e37f]
/usr/lib/libcsound64.so.6.0(csoundCompileCsd+0x3b) [0x7f70d673e47b]
/usr/lib/python2.7/dist-packages/_csnd6.x86_64-linux-gnu.so(+0x4bc6e)
[0x7f70d6d43c6e]
...
Csound tidy up: Segmentation fault
```
and `gdb` backtrace
```
gdb `which python`
(gdb) run /usr/bin/sugar-activity
(gdb) bt
#0 0x00007fffe8b5c014 in make_label
***@***.***=0x55555669f800, ***@***.***=0x5555569f0680
"__synthetic_300") at ./Engine/csound_orc.lex:586
#1 0x00007fffe8b76601 in create_synthetic_label (count=300,
csound=0x55555669f800)
at ../Engine/csound_orc_expressions.c:848
#2 0x00007fffe8b76601 in expand_if_statement
***@***.***=0x55555669f800,
***@***.***=0x5555568b2410,
***@***.***=0x55555680e470)
at ../Engine/csound_orc_expressions.c:1156
#3 0x00007fffe8b72e34 in verify_tree
***@***.***=0x55555669f800, root=<optimised out>,
***@***.***=0x55555680e470) at
../Engine/csound_orc_semantics.c:1813
#4 0x00007fffe8b72ecb in verify_tree
***@***.***=0x55555669f800, root=<optimised out>,
***@***.***=0x55555680e470) at
../Engine/csound_orc_semantics.c:1787
#5 0x00007fffe8b7e6b7 in csoundParseOrc
***@***.***=0x55555669f800, ***@***.***=0x0) at
../Engine/new_orc_parser.c:258
#6 0x00007fffe8b7e087 in csoundCompileOrcInternal
***@***.***=0x55555669f800, ***@***.***=0x0,
***@***.***=0) at ../Engine/csound_orc_compile.c:1827
#7 0x00007fffe8aaa37f in csoundCompileCsdText
***@***.***=0x55555669f800, csd_text=<optimised out>) at
../Top/main.c:530
#8 0x00007fffe8aaa47b in csoundCompileCsd (csound=0x55555669f800,
str=<optimised out>)
at ../Top/main.c:516
#9 0x00007fffe90afc6e in Csound::CompileCsd(char const*)
(csd=<optimised out>, this=0x5555564fbb80) at
.././include/csound.hpp:259
#10 0x00007fffe90afc6e in _wrap_Csound_CompileCsd(PyObject*, PyObject*)
(args=<optimised out>) at python_interfacePYTHON_wrap.cxx:25886
#11 0x000055555564901a in PyEval_EvalFrameEx ()
...
```
Other segmentation faults are easily reproduced using python, with the
simplest reproducer being
```python
import csnd6
a = csnd6.Csound()
a.Start()
b = csnd6.CsoundPerformanceThread(a)
b.Play()
```
which generates this repeatable `gdb` backtrace
```
#0 0x00007ffff5a36c04 in spoutsf (csound=0x555555c4c3c0) at
../InOut/libsnd.c:79
#1 0x00007ffff5a066fb in kperf_nodebug (csound=0x555555c4c3c0) at
../Top/csound.c:1761
#2 0x00007ffff5a07f2e in csoundPerformKsmps (csound=0x555555c4c3c0)
at ../Top/csound.c:2113
#3 0x00007ffff5f124b6 in CsoundPerformanceThread::Perform
(this=0x555555e3bf40)
at ../interfaces/csPerfThread.cpp:434
#4 0x00007ffff5f12778 in CsPerfThread_PerformScore::Perform
(this=<synthetic pointer>)
at ../interfaces/csPerfThread.cpp:483
#5 csoundPerformanceThread_ (userData=<optimised out>)
at ../interfaces/csPerfThread.cpp:500
#6 0x00007ffff77cc6db in start_thread (arg=0x7fffe8505700) at
pthread_create.c:463
#7 0x00007ffff7b0588f in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:95
```
So my questions;
* is the reproducer above a correct use of your API? i.e. is it
something I shall fix?
* does anyone else reproduce a similar segmentation fault on Ubuntu
18.04? i.e. is this really a distribution, library or compiler
problem?
* what has been corrupted and why?
Thanks!
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#948
|
|
What's the CPU arcitecture? Csound is now mostly built for 64 bit CPU
architecture. In any event the arcitecture of Python and Csound must match.
In addition you may wish to switch to the ctcsound interface to Csound,
which is at this time probably better maintained.
Regards,
Mike
…On Fri, Apr 20, 2018, 20:32 John ffitch ***@***.***> wrote:
Hard to say without a csd file
Have you tried valgrind?
Sent from TypeApp
On Apr 21, 2018, 01:27, at 01:27, James Cameron ***@***.***>
wrote:
>G'day, I'm with One Laptop per Child. I'm working a problem on the
>Sugar Labs activity [Music
>Keyboard](https://github.com/godiard/music-keyboard-activity), and
>would like some Csound expert eyes. Music Keyboard uses Csound from
>Python, as well as GStreamer and GTK+. With the upgrade to CSound
>6.10.0 from 6.09, the program fails with a reproducible segmentation
>fault.
>
>```
>/usr/lib/libcsound64.so.6.0(+0x3f7e3) [0x7f70d65d77e3]
>/lib/x86_64-linux-gnu/libc.so.6(+0x3ef20) [0x7f70e9767f20]
>/usr/lib/libcsound64.so.6.0(+0x258014) [0x7f70d67f0014]
>/usr/lib/libcsound64.so.6.0(+0x272601) [0x7f70d680a601]
>/usr/lib/libcsound64.so.6.0(+0x26ee34) [0x7f70d6806e34]
>/usr/lib/libcsound64.so.6.0(+0x26eecb) [0x7f70d6806ecb]
>/usr/lib/libcsound64.so.6.0(csoundParseOrc+0x2d7) [0x7f70d68126b7]
>/usr/lib/libcsound64.so.6.0(+0x27a087) [0x7f70d6812087]
>/usr/lib/libcsound64.so.6.0(csoundCompileCsdText+0x5f) [0x7f70d673e37f]
>/usr/lib/libcsound64.so.6.0(csoundCompileCsd+0x3b) [0x7f70d673e47b]
>/usr/lib/python2.7/dist-packages/_csnd6.x86_64-linux-gnu.so(+0x4bc6e)
>[0x7f70d6d43c6e]
>...
>Csound tidy up: Segmentation fault
>```
>
>and `gdb` backtrace
>
>```
>gdb `which python`
>(gdb) run /usr/bin/sugar-activity
>(gdb) bt
>#0 0x00007fffe8b5c014 in make_label
***@***.***=0x55555669f800, ***@***.***=0x5555569f0680
>"__synthetic_300") at ./Engine/csound_orc.lex:586
>#1 0x00007fffe8b76601 in create_synthetic_label (count=300,
>csound=0x55555669f800)
> at ../Engine/csound_orc_expressions.c:848
>#2 0x00007fffe8b76601 in expand_if_statement
***@***.***=0x55555669f800,
***@***.***=0x5555568b2410,
***@***.***=0x55555680e470)
> at ../Engine/csound_orc_expressions.c:1156
>#3 0x00007fffe8b72e34 in verify_tree
***@***.***=0x55555669f800, root=<optimised out>,
***@***.***=0x55555680e470) at
>../Engine/csound_orc_semantics.c:1813
>#4 0x00007fffe8b72ecb in verify_tree
***@***.***=0x55555669f800, root=<optimised out>,
***@***.***=0x55555680e470) at
>../Engine/csound_orc_semantics.c:1787
>#5 0x00007fffe8b7e6b7 in csoundParseOrc
***@***.***=0x55555669f800, ***@***.***=0x0) at
>../Engine/new_orc_parser.c:258
>#6 0x00007fffe8b7e087 in csoundCompileOrcInternal
***@***.***=0x55555669f800, ***@***.***=0x0,
***@***.***=0) at ../Engine/csound_orc_compile.c:1827
>#7 0x00007fffe8aaa37f in csoundCompileCsdText
***@***.***=0x55555669f800, csd_text=<optimised out>) at
>../Top/main.c:530
>#8 0x00007fffe8aaa47b in csoundCompileCsd (csound=0x55555669f800,
>str=<optimised out>)
> at ../Top/main.c:516
>#9 0x00007fffe90afc6e in Csound::CompileCsd(char const*)
>(csd=<optimised out>, this=0x5555564fbb80) at
>.././include/csound.hpp:259
>#10 0x00007fffe90afc6e in _wrap_Csound_CompileCsd(PyObject*, PyObject*)
>(args=<optimised out>) at python_interfacePYTHON_wrap.cxx:25886
>#11 0x000055555564901a in PyEval_EvalFrameEx ()
>...
>```
>
>Other segmentation faults are easily reproduced using python, with the
>simplest reproducer being
>
>```python
>import csnd6
>a = csnd6.Csound()
>a.Start()
>b = csnd6.CsoundPerformanceThread(a)
>b.Play()
>```
>
>which generates this repeatable `gdb` backtrace
>
>```
>#0 0x00007ffff5a36c04 in spoutsf (csound=0x555555c4c3c0) at
>../InOut/libsnd.c:79
>#1 0x00007ffff5a066fb in kperf_nodebug (csound=0x555555c4c3c0) at
>../Top/csound.c:1761
>#2 0x00007ffff5a07f2e in csoundPerformKsmps (csound=0x555555c4c3c0)
> at ../Top/csound.c:2113
>#3 0x00007ffff5f124b6 in CsoundPerformanceThread::Perform
>(this=0x555555e3bf40)
> at ../interfaces/csPerfThread.cpp:434
>#4 0x00007ffff5f12778 in CsPerfThread_PerformScore::Perform
>(this=<synthetic pointer>)
> at ../interfaces/csPerfThread.cpp:483
>#5 csoundPerformanceThread_ (userData=<optimised out>)
> at ../interfaces/csPerfThread.cpp:500
>#6 0x00007ffff77cc6db in start_thread (arg=0x7fffe8505700) at
>pthread_create.c:463
>#7 0x00007ffff7b0588f in clone () at
>../sysdeps/unix/sysv/linux/x86_64/clone.S:95
>```
>
>So my questions;
>
>* is the reproducer above a correct use of your API? i.e. is it
>something I shall fix?
>* does anyone else reproduce a similar segmentation fault on Ubuntu
>18.04? i.e. is this really a distribution, library or compiler
>problem?
>* what has been corrupted and why?
>
>Thanks!
>
>--
>You are receiving this because you are subscribed to this thread.
>Reply to this email directly or view it on GitHub:
>#948
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#948 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AGCDJcUGqR-9sC4In-TC1UZ-KMsOLVpuks5tqn4BgaJpZM4TePTM>
.
|
|
Thanks for replies.
For the first backtrace, there are three csd files. But as a segmentation fault can also be reproduced by For the second backtrace, there's no csd file used. A null performance. File I'll call that the third backtrace. A writable directory does not solve the first backtrace.
No, good idea. It has a lot to say. For the first backtrace, wrapping it with For the third backtrace during cleanup; see invalid reads inside blocks freed by CsoundPerformanceThread.
x86_64. Both Csound and Python are the distributed versions from Ubuntu, so they match architecture.
Thanks. As I don't know the size of the work to fix this problem compared to the size of the work to port to the new interface, I'll keep looking at it. |
|
Judging by the valgrind report, it does look like something in the Python interface (not in Csound per se). Changing to ctcsound might fix that.
Note that, from Csound 7.00 we plan not to distribute the swig-based Python interface,
so it might be worth migrating in the long run.
However, we can try fixing this, but would need some code (py, csd) to test it. A minimal example demonstrating the problem
would be ideal.
Victor Lazzarini
On 21 Apr 2018, at 04:54, James Cameron <notifications@github.com<mailto:notifications@github.com>> wrote:
Thanks for replies.
@jpffitch<https://github.com/jpffitch>;
Hard to say without a csd file
For the first backtrace, there are three csd files<https://github.com/godiard/music-keyboard-activity/tree/master/ttcommon/Resources>. But as a segmentation fault can also be reproduced by CsoundPerformanceThread.Play() when single stepped under pdb, before the csd files are opened, I don't think the csd files are part of the problem.
For the second backtrace, there's no csd file used. A null performance. File test.wav could not be opened. Changing the current directory to be writable (it is normally not) allows Play() to proceed, and does instead segmentation fault during cleanup from Python REPL;
>> ^D
/usr/lib/libcsound64.so.6.0(+0x3f7e3) [0x7fe254c3d7e3]
/lib/x86_64-linux-gnu/libc.so.6(+0x3ef20) [0x7fe256c5bf20]
Csound tidy up: Segmentation fault
I'll call that the third backtrace.
A writable directory does not solve the first backtrace.
Have you tried valgrind?
No, good idea. It has a lot to say.
For the first backtrace, wrapping it with valgrind ceases to reproduce, and the program starts without segmentation fault. Here's the log<http://dev.laptop.org/%7Equozl/z/1f9ikQ.txt>. It doesn't have much in the Csound call stacks.
For the third backtrace during cleanup; see invalid reads inside blocks freed by CsoundPerformanceThread<http://dev.laptop.org/%7Equozl/z/1f9iee.txt>.
@gogins<https://github.com/gogins>:
What's the CPU architecture?
x86_64. Both Csound and Python are the distributed versions from Ubuntu, so they match architecture.
may wish to switch to the ctcsound interface ... better maintained.
Thanks. As I don't know the size of the work to fix this problem compared to the size of the work to port to the new interface, I'll keep looking at it.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#948 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AFwRl9HwUbUpvNH25HJAuSVdh_j14ACLks5tqq18gaJpZM4TePTM>.
|
|
My first traceback;
When I try to replicate at the Python prompt without GTK+, or with valgrind, there are problems reported with the csd file; I don't know enough about the syntax to figure out what is wrong. Any clues? The file is inherited from a much older activity, TamTam. My second traceback is solved; it was caused by non-writable directory. My third traceback is solved; it was probably violation of API, fixed by calling Incidentally, to use Also incidentally, @vlazzarini's book Computer Musical Instruments, foundations, design and development, 2017, was very useful for learning the ctcsound API. I wasn't able to find a better documentation source. Listing 2.2 "Using a performance thread" has a small error; |
|
Ok, it's much clearer now. We need to look into the CSD to see what is going on, but it is the case that the CSD is failing to compile. I think it is something in the parser that is not quite right. I see in valgrind that it is point to the places where we are parsing if statements, and generating labels. However, on 6.11 (beta), which we're just about to release, it does not seem to fail (at least on MacOs) So it might be the case that there was something wrong in 6.10 which we have fixed. @jpffitch @kunstmusik ring any bells? I seem to recall something only vaguely. |
|
By the way, it is great to see you are updating the OLPC work. We're very happy to support it in any way we can. |
|
Oh, good. Might I build from git and iterate with git bisect? I'll look for build instructions. |
|
Building on Linux should be straightforward (see BUILD.md). However, I just tried csound 6.10 on MacOs and it did not fail either. So I am wondering about this. In any case, if you can build on Linux at least we would know for sure. |
|
Thanks. Tried to git bisect, but both f5bcd83 (head) and 71eedf0 (6.10.0) work fine. 9c6a1ec is the point of failure; one of the Debian packaging patches. Yet to find the commit that fixes it; will do an upside-down bisect next. By the way, the build doesn't install the Python API, or rather it installs in wrong place; /root/.local . After |
|
I have a vague memory of changing that area, which is the generation of a
label. Cannot remember why! It relates to if-then-else-endif and
while-until loops. We could see better if run with the -v option;
generates a lot of output but I can rad it to see what code was generated
etc.
…On Mon, 23 Apr 2018, vlazzarini wrote:
Ok, it's much clearer now. We need to look into the CSD to see what is going
on, but it is the case that the CSD is failing to compile.
However, on 6.11 (beta), which we're just about to release, it does not seem
to fail (at least on MacOs)
MacBook-Pro:debug victor$ python
Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 26 2016, 12:10:39)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctcsound
>>> a = ctcsound.Csound()
time resolution is 1000.000 ns
0dBFS level = 32768.0
--Csound version 6.11 beta (double samples) Mar 30 2018
[commit: ee09543]
libsndfile-1.0.28
>>> a.compileCsd("tamtamorc.csd")
STARTING FILE
Creating options
Creating orchestra
closing tag
Creating score
0
So it might be the case that there was something wrong in 6.10 which we have
fixed.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the
thread.[AELNQlbj2N70K9uTGjYoCDR4-fjMufjGks5trY3hgaJpZM4TePTM.gif]
|
|
I tied the crop.csd example on Linux and 6.11 -- runs until tries to read
missing file
…On Mon, 23 Apr 2018, vlazzarini wrote:
Building on Linux should be straightforward (see BUILD.md). However, I just
tried csound 6.10 on MacOs and it did not fail either. So I am wondering about
this. In any case, if you can build on Linux at least we would know for sure.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the
thread.[AELNQrL_iNCbGus-12t9f4_OgnWs6wxBks5trZV0gaJpZM4TePTM.gif]
|
|
do you mean tamtamorc.csd? |
|
@quozl could you log the installer issue separately? thx |
|
I guess we ought to release 6.11 soon so that the olpc code can work with it. |
|
Could not work out how to get a copy of tamtamorc.csd
…On Mon, 23 Apr 2018, vlazzarini wrote:
do you mean tamtamorc.csd!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the
thread.[AELNQmFiGpif3EMx3NqXUqi_L0uTGhL-ks5trb6-gaJpZM4TePTM.gif]
|
|
I just copied off the browser screen into the editor.
Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland
On 23 Apr 2018, at 12:52, John ffitch <notifications@github.com<mailto:notifications@github.com>> wrote:
Could not work out how to get a copy of tamtamorc.csd
On Mon, 23 Apr 2018, vlazzarini wrote:
do you mean tamtamorc.csd!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the
thread.[AELNQmFiGpif3EMx3NqXUqi_L0uTGhL-ks5trb6-gaJpZM4TePTM.gif]
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#948 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AFwRl-IAVDb0az2gh4YiaxTdo-RL2Qq7ks5trcCEgaJpZM4TePTM>.
|
|
Thanks everyone, I've figured it out. My traceback is solved by df5658c on the @fsateler, the Debian package has 9c6a1ec ("Fix format string attributes and usages to allow -Wformat"), and needs df5658c ("fixed crashing due to colon that was left out in PR 880"). I'll solve this with a custom package for my Ubuntu build, so I've no need to raise a Debian bug. There's no Debian package that reproduces the problem; it depends on specific syntax in the csd file. |
|
@quozl could you please file a downstream debian bug? Otherwise I might forget. Even better if you post a proper patch Btw, I would be very happy to get other people looking at the debian package. If you are looking after csound in Ubuntu it may be beneficial to join efforts. |
|
@fsateler, thanks for the offer. No, I'm not looking after Csound in Ubuntu. I'm deriving a distribution from Debian and Ubuntu. See Derivatives Census - OLPC. Let me know how I can help. I'll look into filing a downstream Debian bug, but I too might forget;
I could also file a downstream Ubuntu bug, but roughly the same reasoning applies. The proper patch is df5658c and can be directly applied to the Debian package. I used then I built the package on the target distribution, and used |
|
Filed Debian bug #896848. |
G'day, I'm with One Laptop per Child. I'm working a problem on the Sugar Labs activity Music Keyboard, and would like some Csound expert eyes. Music Keyboard uses Csound from Python, as well as GStreamer and GTK+. With the upgrade to CSound 6.10.0 from 6.09, the program fails with a reproducible segmentation fault.
and
gdbbacktraceOther segmentation faults are easily reproduced using python, with the simplest reproducer being
which generates this repeatable
gdbbacktraceSo my questions;
Thanks!
The text was updated successfully, but these errors were encountered: