[Cs-dev] FLTK graphs, reentrancy issues, etc
Date | 2011-05-31 13:32 |
From | Victor Lazzarini |
Subject | [Cs-dev] FLTK graphs, reentrancy issues, etc |
Hi everyone, I've spent yesterday afternoon, then late into the night and tomorrow morning trying to fix a reentrancy issue with FLTK graphs. There was a static variable still remaining in the FLTK graph code, which I have now removed and committed to GIT. However, problems still exist. It appears that if we run a second compilation on an existing, reset/ cleaned up, instance, a FLTK method call seems to mess up the memory and we get a crash. I isolated one call that does that (other calls might also do the same, I have not checked all the possibilities). Line 292 of InOut/ FL_graph.cpp: ST(form)->show(); After this call, the pointers to ST(form) (the main window) and other graph widgets on that window get screwed up. Next time code tries access it, we get a crash. This happens on the second compilation of an existing instance. If we destroy the instance and compile again on a new instance, all is well. This has been discovered on OSX. Since this is in FLTK library code, there is nothing we can do. I am wondering whether we should make "no graphs" or even "ascii graphs" as defaults instead of FLTK, so we can sidestep this problem for the moment. Any other suggestions? Regards Dr Victor Lazzarini Senior Lecturer Dept. of Music NUI Maynooth Ireland tel.: +353 1 708 3545 Victor dot Lazzarini AT nuim dot ie ------------------------------------------------------------------------------ Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2011-05-31 13:36 |
From | Alex Weiss |
Subject | Re: [Cs-dev] FLTK graphs, reentrancy issues, etc |
Attachments | None None |
Even though I'm not a csound developer, I like the suggestion of making ASCII graphs or no graphs the default, as the default FLTK display also crashes Cocoa hosts (reentrancy issues aside). Alex
On Tue, May 31, 2011 at 2:32 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote: Hi everyone, |
Date | 2011-05-31 14:21 |
From | jpff@cs.bath.ac.uk |
Subject | Re: [Cs-dev] FLTK graphs, reentrancy issues, etc |
I understand the issue but thi sdoes seem like a large step backwards. ASCII graphs are not really useful for annimation Time to look at th efltk code? > Even though I'm not a csound developer, I like the suggestion of making > ASCII graphs or no graphs the default, as the default FLTK display also > crashes Cocoa hosts (reentrancy issues aside). > > Alex > > On Tue, May 31, 2011 at 2:32 PM, Victor Lazzarini > |
Date | 2011-05-31 14:22 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] FLTK graphs, reentrancy issues, etc |
Attachments | None None |
You can set the callbacks or set the -d flag to control this, by the way, so you don't get crashes. Victor On 31 May 2011, at 13:36, Alex Weiss wrote: Even though I'm not a csound developer, I like the suggestion of making ASCII graphs or no graphs the default, as the default FLTK display also crashes Cocoa hosts (reentrancy issues aside). Dr Victor Lazzarini Senior Lecturer Dept. of Music NUI Maynooth Ireland tel.: +353 1 708 3545 Victor dot Lazzarini AT nuim dot ie |
Date | 2011-05-31 14:26 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] FLTK graphs, reentrancy issues, etc |
We can look at the fltk code again, but from what I understand of this, having looked closely, the problem is with the FLTK library. I see no problem removing graphs as default. Users can enable graphs if they want to display. I also think that in general graphics should be managed the frontend/ host, whenever possible. Victor On 31 May 2011, at 14:21, jpff@cs.bath.ac.uk wrote: > I understand the issue but thi sdoes seem like a large step backwards. > ASCII graphs are not really useful for annimation > > Time to look at th efltk code? > > >> Even though I'm not a csound developer, I like the suggestion of >> making >> ASCII graphs or no graphs the default, as the default FLTK display >> also >> crashes Cocoa hosts (reentrancy issues aside). >> >> Alex >> >> On Tue, May 31, 2011 at 2:32 PM, Victor Lazzarini >> |
Date | 2011-05-31 14:49 |
From | Alex Weiss |
Subject | Re: [Cs-dev] FLTK graphs, reentrancy issues, etc |
Attachments | None None |
Sure, I know, just wanted to throw in my 0.02 ;) On Tue, May 31, 2011 at 3:22 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
|
Date | 2011-05-31 16:06 |
From | Andres Cabrera |
Subject | Re: [Cs-dev] FLTK graphs, reentrancy issues, etc |
Yes, this is one more reason to try to flesh out: http://sourceforge.net/apps/mediawiki/csound/index.php?title=RFC_2-Widget_API Cheers, Andres On Tue, May 31, 2011 at 2:26 PM, Victor Lazzarini |
Date | 2011-05-31 16:42 |
From | Steven Yi |
Subject | Re: [Cs-dev] FLTK graphs, reentrancy issues, etc |
Ah, but this thread is regarding graphs, not widgets. :) Personally, I've turned off graphs pretty much since I started using csound. However, I guess for those who use graphs, using FLTK by default is tricky. For those who use the commandline, using FLTK will not be a problem as they'll always run one instance at a time. Also, on thing I don't understand is that this isn't a problem if you use a new instance of Csound versus reusing a current instance. That to me seems to point to some issue with Csound cleanup code and not FLTK. Do we know if the widget_reset code is being called after the end of the first run? On Tue, May 31, 2011 at 11:06 AM, Andres Cabrera |
Date | 2011-05-31 17:15 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] FLTK graphs, reentrancy issues, etc |
yes, you're right, graphs not widgets. I spent a good time with this and it does not seem to be a cleanup code problem, but a FLTK issue. The problem only appears after a FLTK method call. Widget_reset seems to be called OK, but it does not concern graphs at all (maybe it should?) Victor On 31 May 2011, at 16:42, Steven Yi wrote: > Ah, but this thread is regarding graphs, not widgets. :) > > Personally, I've turned off graphs pretty much since I started using > csound. However, I guess for those who use graphs, using FLTK by > default is tricky. For those who use the commandline, using FLTK will > not be a problem as they'll always run one instance at a time. > > Also, on thing I don't understand is that this isn't a problem if you > use a new instance of Csound versus reusing a current instance. That > to me seems to point to some issue with Csound cleanup code and not > FLTK. Do we know if the widget_reset code is being called after the > end of the first run? > > > > On Tue, May 31, 2011 at 11:06 AM, Andres Cabrera |
Date | 2011-05-31 17:37 |
From | Andres Cabrera |
Subject | Re: [Cs-dev] FLTK graphs, reentrancy issues, etc |
Yes! You're right. But maybe these calls could also be implemented only in the front end whenever FLTK is removed from the Csound engine. You can already do graphing in the front end with the current API, by rerouting the callbacks. Cheers, Andres On Tue, May 31, 2011 at 4:42 PM, Steven Yi |
Date | 2011-05-31 17:39 |
From | Steven Yi |
Subject | Re: [Cs-dev] FLTK graphs, reentrancy issues, etc |
Well the logic I'm following that if the issue doesn't happen with a new instance of csound, something must be kept around that is causing that FLTK method call to fail. I'm looking at FL_graph.cpp, and notice we have this: if (csound->flgraphGlobals==NULL) { csound->flgraphGlobals = (FLGRAPH_GLOBALS*) csound->Malloc(csound,sizeof(FLGRAPH_GLOBALS)); in the fl_graph_init function. I can imagine there being problems if after a reset, that flgraphGlobals could have been freed but that test would keep it as not NULL. Could you try removing the check for NULL altogether and just always allocing a new FLGRAPH_GLOBALS to see if that fixes anything? On Tue, May 31, 2011 at 12:15 PM, Victor Lazzarini |
Date | 2011-05-31 20:13 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] FLTK graphs, reentrancy issues, etc |
No, I have tried that and it doesn't fix anything. The globals only holds a handful of pointers and these are released after each performance/compilation. I checked and the memory for the globals remains consistent. However the memory for the FLTK objects get messed up after the call to the FLTK FLWindow::show() method. I have spent hours on this before I finally traced it to that specific call. Victor On 31 May 2011, at 17:39, Steven Yi wrote: > Well the logic I'm following that if the issue doesn't happen with a > new instance of csound, something must be kept around that is causing > that FLTK method call to fail. > > I'm looking at FL_graph.cpp, and notice we have this: > > if (csound->flgraphGlobals==NULL) { > csound->flgraphGlobals = > (FLGRAPH_GLOBALS*) csound- > >Malloc(csound,sizeof(FLGRAPH_GLOBALS)); > > > in the fl_graph_init function. I can imagine there being problems if > after a reset, that flgraphGlobals could have been freed but that test > would keep it as not NULL. Could you try removing the check for NULL > altogether and just always allocing a new FLGRAPH_GLOBALS to see if > that fixes anything? > > On Tue, May 31, 2011 at 12:15 PM, Victor Lazzarini > |