Csound Csound-dev Csound-tekno Search About

[Cs-dev] segfault with FLTK opcodes on 5.16

Date2012-02-26 09:53
FromVictor Lazzarini
Subject[Cs-dev] segfault with FLTK opcodes on 5.16
Attachmentsmoog.csd  None  None  
This must have crept in on 5.16. I can't run the attached CSD anymore because of the FLTK code.


Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




Date2012-02-26 09:59
FromVictor Lazzarini
SubjectRe: [Cs-dev] segfault with FLTK opcodes on 5.16
Any FLTK-based will crash if we have the -d flag.  It appears we made a mess of that one and let a release go with a major bug.

Victor
On 26 Feb 2012, at 09:53, Victor Lazzarini wrote:

> 
> This must have crept in on 5.16. I can't run the attached CSD anymore because of the FLTK code.
> 
> 
> Dr Victor Lazzarini
> Senior Lecturer
> Dept. of Music
> NUI Maynooth Ireland
> tel.: +353 1 708 3545
> Victor dot Lazzarini AT nuim dot ie
> 
> 
> 
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing 
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/_______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2012-02-26 10:29
FromSteven Yi
SubjectRe: [Cs-dev] segfault with FLTK opcodes on 5.16
Hmm, sounds like it might be caused by changes I had done to fix
issues with running python examples with TCL that had that strange
interaction with FLTK.  I'll take a look at it shortly.

On Sun, Feb 26, 2012 at 9:59 AM, Victor Lazzarini
 wrote:
> Any FLTK-based will crash if we have the -d flag.  It appears we made a mess of that one and let a release go with a major bug.
>
> Victor
> On 26 Feb 2012, at 09:53, Victor Lazzarini wrote:
>
>>
>> This must have crept in on 5.16. I can't run the attached CSD anymore because of the FLTK code.
>>
>> 
>> Dr Victor Lazzarini
>> Senior Lecturer
>> Dept. of Music
>> NUI Maynooth Ireland
>> tel.: +353 1 708 3545
>> Victor dot Lazzarini AT nuim dot ie
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Virtualization & Cloud Management Using Capacity Planning
>> Cloud computing makes use of virtualization - but cloud computing
>> also focuses on allowing computing to be delivered as a service.
>> http://www.accelacomm.com/jaw/sfnl/114/51521223/_______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
> Dr Victor Lazzarini
> Senior Lecturer
> Dept. of Music
> NUI Maynooth Ireland
> tel.: +353 1 708 3545
> Victor dot Lazzarini AT nuim dot ie
>
>
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2012-02-26 10:34
FromVictor Lazzarini
SubjectRe: [Cs-dev] segfault with FLTK opcodes on 5.16
Thanks.
On 26 Feb 2012, at 10:29, Steven Yi wrote:

> Hmm, sounds like it might be caused by changes I had done to fix
> issues with running python examples with TCL that had that strange
> interaction with FLTK.  I'll take a look at it shortly.
> 
> On Sun, Feb 26, 2012 at 9:59 AM, Victor Lazzarini
>  wrote:
>> Any FLTK-based will crash if we have the -d flag.  It appears we made a mess of that one and let a release go with a major bug.
>> 
>> Victor
>> On 26 Feb 2012, at 09:53, Victor Lazzarini wrote:
>> 
>>> 
>>> This must have crept in on 5.16. I can't run the attached CSD anymore because of the FLTK code.
>>> 
>>> 
>>> Dr Victor Lazzarini
>>> Senior Lecturer
>>> Dept. of Music
>>> NUI Maynooth Ireland
>>> tel.: +353 1 708 3545
>>> Victor dot Lazzarini AT nuim dot ie
>>> 
>>> 
>>> 
>>> ------------------------------------------------------------------------------
>>> Virtualization & Cloud Management Using Capacity Planning
>>> Cloud computing makes use of virtualization - but cloud computing
>>> also focuses on allowing computing to be delivered as a service.
>>> http://www.accelacomm.com/jaw/sfnl/114/51521223/_______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>> 
>> Dr Victor Lazzarini
>> Senior Lecturer
>> Dept. of Music
>> NUI Maynooth Ireland
>> tel.: +353 1 708 3545
>> Victor dot Lazzarini AT nuim dot ie
>> 
>> 
>> 
>> 
>> ------------------------------------------------------------------------------
>> Virtualization & Cloud Management Using Capacity Planning
>> Cloud computing makes use of virtualization - but cloud computing
>> also focuses on allowing computing to be delivered as a service.
>> http://www.accelacomm.com/jaw/sfnl/114/51521223/
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing 
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2012-02-26 11:59
FromSteven Yi
SubjectRe: [Cs-dev] segfault with FLTK opcodes on 5.16
Okay, after spending some time on this I just reverted what I had
done.  It means we're back to where we were.  The problem though is
that the logic in InOut/winFLTK.c is faulty. It bad logic is:


    if (!(csound->oparms->graphsoff || csound->oparms->postscript))
      widget_init(csound);

It assumes if you turn of graphics or have postscript enabled that
it's alright to not initialize widgets.  Reverting the code I did in
argdecode.c returns us back to where we were.  However, that too
causes problems.  If you run Csound from python and use TK, at least
here on OSX it will cause a segfault.  There's some interaction
between the FLTK code and TK's internal code.

To run with python and TK, you have to use "-g" to turn off graphs in
your CSD or python code.  However, if you use "-g" and try to run a
Csound FLTK orchestra, you get a segfault.

This code is essentially bad, IMO.  Really, we shouldn't initialize
widgets unless you really need to, and we shouldn't depend on if
graphs are set or not, as it is the case that if your orchestra has no
ftables, nothing gets displayed anyways.  Plus, if you're not using
FLTK at all, you're still paying a penalty to have widgets initialize
just by having that opcode lib.

The solution I think is that everywhere that uses FLTK, whether in
displays or widget code, to check if FLTK has been initialized, and if
not, intiialize it.  A flag could be used here, though it'd have to be
protected for multi-threading.

I pushed the reverted code up to git.  We should probably tag and
re-release.  The python situation is not that common, and there's a
workaround by using -g. Sound like a plan?

Thanks and apologies for the bug!
steven


On Sun, Feb 26, 2012 at 10:34 AM, Victor Lazzarini
 wrote:
> Thanks.
> On 26 Feb 2012, at 10:29, Steven Yi wrote:
>
>> Hmm, sounds like it might be caused by changes I had done to fix
>> issues with running python examples with TCL that had that strange
>> interaction with FLTK.  I'll take a look at it shortly.
>>
>> On Sun, Feb 26, 2012 at 9:59 AM, Victor Lazzarini
>>  wrote:
>>> Any FLTK-based will crash if we have the -d flag.  It appears we made a mess of that one and let a release go with a major bug.
>>>
>>> Victor
>>> On 26 Feb 2012, at 09:53, Victor Lazzarini wrote:
>>>
>>>>
>>>> This must have crept in on 5.16. I can't run the attached CSD anymore because of the FLTK code.
>>>>
>>>> 
>>>> Dr Victor Lazzarini
>>>> Senior Lecturer
>>>> Dept. of Music
>>>> NUI Maynooth Ireland
>>>> tel.: +353 1 708 3545
>>>> Victor dot Lazzarini AT nuim dot ie
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Virtualization & Cloud Management Using Capacity Planning
>>>> Cloud computing makes use of virtualization - but cloud computing
>>>> also focuses on allowing computing to be delivered as a service.
>>>> http://www.accelacomm.com/jaw/sfnl/114/51521223/_______________________________________________
>>>> Csound-devel mailing list
>>>> Csound-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>>
>>> Dr Victor Lazzarini
>>> Senior Lecturer
>>> Dept. of Music
>>> NUI Maynooth Ireland
>>> tel.: +353 1 708 3545
>>> Victor dot Lazzarini AT nuim dot ie
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Virtualization & Cloud Management Using Capacity Planning
>>> Cloud computing makes use of virtualization - but cloud computing
>>> also focuses on allowing computing to be delivered as a service.
>>> http://www.accelacomm.com/jaw/sfnl/114/51521223/
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>>
>> ------------------------------------------------------------------------------
>> Virtualization & Cloud Management Using Capacity Planning
>> Cloud computing makes use of virtualization - but cloud computing
>> also focuses on allowing computing to be delivered as a service.
>> http://www.accelacomm.com/jaw/sfnl/114/51521223/
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
> Dr Victor Lazzarini
> Senior Lecturer
> Dept. of Music
> NUI Maynooth Ireland
> tel.: +353 1 708 3545
> Victor dot Lazzarini AT nuim dot ie
>
>
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2012-02-26 20:30
FromTito Latini
SubjectRe: [Cs-dev] segfault with FLTK opcodes on 5.16
AttachmentsNone  

Date2012-02-27 08:48
FromTito Latini
SubjectRe: [Cs-dev] segfault with FLTK opcodes on 5.16
AttachmentsNone  None  csound5_fltk_display.patch  None  None  

Date2012-02-27 15:21
FromSteven Yi
SubjectRe: [Cs-dev] segfault with FLTK opcodes on 5.16
Hi Tito,

I tried the patch and it seems to work with FLTK with -d and -g, but
python+tk fails now with any flag combination.  There error I get is
due to fl_wait

Tcl_ServiceModeHook: Notifier not initialized

Program received signal SIGABRT, Aborted.
[Switching to process 12308 thread 0x9203]
0x00007fff9a038ce2 in __pthread_kill ()
(gdb) bt
#0  0x00007fff9a038ce2 in __pthread_kill ()
#1  0x00007fff95fee7d2 in pthread_kill ()
#2  0x00007fff95fdfa7a in abort ()
#3  0x0000000101bbaf61 in Tcl_PanicVA ()
#4  0x0000000101bbafe3 in Tcl_Panic ()
#5  0x0000000101be8bdc in Tcl_ServiceModeHook ()
#6  0x0000000101bb80ed in Tcl_SetServiceMode ()
#7  0x0000000101cf7fca in Tk_MacOSXSetupTkNotifier ()
#8  0x00000001064b577f in fl_wait ()
#9  0x00000001064b581b in fl_mac_flush_and_wait ()
#10 0x0000000103f7e673 in CsoundYield_FLTK ()

Essentially, if that yield callback gets set, it kills python+tk.
It's an odd problem.  I don't have the full scope of the issue in my
head, but on the one hand, we don't need the callback if there is no
FLTK used, and yet, the logic currently just goes and sets it with the
assumption it could be used at some point.  Hence the mention about
lazy initialization I mentioned.  I'm thinking that may be the
solution, but I'm still open to other analyses.

On Mon, Feb 27, 2012 at 8:48 AM, Tito Latini  wrote:
> I have attached a better patch (I have not tried python+tk).
>
> The idea is to use `csound->widgetGlobals' as a switch
> for the fltk opcodes. If it is not-NULL, `csoundModuleInit'
> sets only dummy opcodes and `widget_init' is bypassed
> because the `widget_init' function (widgets.cpp) contains
>
>  if (csound->widgetGlobals == NULL) ...
>
> For example, to disable fltk, it is enough
>
>  csound->widgetGlobals = malloc(1);
>
> and
>
>  static int DummyExitGraph(CSOUND *csound)
>  {
>      IGN(csound);
>      return 0;
>  }
>
>  static int dummy_widget_reset(CSOUND *csound, void *pp)
>  {
>      IGN(pp);
>      free(csound->widgetGlobals);
>      return OK;
>  }
>
>  csound->SetExitGraphCallback(csound, DummyExitGraph);
>  csound->RegisterResetCallback(csound, NULL, dummy_widget_reset);
>
> tito
>
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2012-02-27 16:11
FromTito Latini
SubjectRe: [Cs-dev] segfault with FLTK opcodes on 5.16
AttachmentsNone  

Date2012-02-27 16:21
FromSteven Yi
SubjectRe: [Cs-dev] segfault with FLTK opcodes on 5.16
No, I was using Brian Carty's MultiBin program, available in Csound
Journal issue 16:

http://www.csounds.com/journal/issue16/multibin.html

That example works with the older csound because I used -d -g.  It's
what I was using for testing.

On Mon, Feb 27, 2012 at 4:11 PM, Tito Latini  wrote:
> Is the py/tk example in the examples/python directory ?
>
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2012-02-27 16:24
FromTito Latini
SubjectRe: [Cs-dev] segfault with FLTK opcodes on 5.16
AttachmentsNone  

Date2012-02-27 16:56
FromTito Latini
SubjectRe: [Cs-dev] segfault with FLTK opcodes on 5.16
AttachmentsNone  

Date2012-02-27 17:05
FromSteven Yi
SubjectRe: [Cs-dev] segfault with FLTK opcodes on 5.16
Yeah, I think it is only OSX, and Brian was unaware of any problems
with his project and was working on Windows and Linux I believe.

On Mon, Feb 27, 2012 at 4:56 PM, Tito Latini  wrote:
> Perhaps it is a problem only with osx or a different fltk version.
> MultiBin.py works here (gnu/linux), with or without -d -g,
> with or without the patch.
>
> python-2.6.4
> fltk-1.3.0
> tk-8.5.8
>
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2012-02-27 17:14
FromVictor Lazzarini
SubjectRe: [Cs-dev] segfault with FLTK opcodes on 5.16
Possibly also only problematic with the latest FLTK that does not use Carbon, as the thing run fine with an older Carbon-based fltk lib in OSX 10.5.
On 27 Feb 2012, at 17:05, Steven Yi wrote:

> Yeah, I think it is only OSX, and Brian was unaware of any problems
> with his project and was working on Windows and Linux I believe.
> 
> On Mon, Feb 27, 2012 at 4:56 PM, Tito Latini  wrote:
>> Perhaps it is a problem only with osx or a different fltk version.
>> MultiBin.py works here (gnu/linux), with or without -d -g,
>> with or without the patch.
>> 
>> python-2.6.4
>> fltk-1.3.0
>> tk-8.5.8
>> 
>> ------------------------------------------------------------------------------
>> Try before you buy = See our experts in action!
>> The most comprehensive online learning library for Microsoft developers
>> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
>> Metro Style Apps, more. Free future releases when you subscribe now!
>> http://p.sf.net/sfu/learndevnow-dev2
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2012-02-27 17:19
FromTito Latini
SubjectRe: [Cs-dev] segfault with FLTK opcodes on 5.16
AttachmentsNone