Camelia, the Perl 6 bug

IRC log for #openframeworks, 2013-09-20

| Channels | #openframeworks index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
02:11 piksi joined #openframeworks
03:46 DrCode joined #openframeworks
03:55 robot joined #openframeworks
04:58 dantheman joined #openframeworks
06:51 DrCode joined #openframeworks
08:38 GuidovanPossum joined #openframeworks
10:53 kritzikratzi joined #openframeworks
11:52 jvcleave joined #openframeworks
12:37 jacres joined #openframeworks
12:41 superFluid joined #openframeworks
12:52 davidnunez joined #openframeworks
13:46 roxlu joined #openframeworks
13:48 dantheman joined #openframeworks
13:55 dantheman joined #openframeworks
14:21 gb_away joined #openframeworks
14:26 jacres joined #openframeworks
14:41 workergnome joined #openframeworks
15:13 GuidovanPossum joined #openframeworks
15:39 Dorald joined #openframeworks
15:43 lzmmrmn joined #openframeworks
16:03 jacres joined #openframeworks
16:04 Dorald joined #openframeworks
16:10 goodman joined #openframeworks
16:43 jacres joined #openframeworks
16:48 kritzikratzi joined #openframeworks
17:24 piksi joined #openframeworks
17:25 piksi left #openframeworks
17:40 pizthewiz joined #openframeworks
18:14 workergnome joined #openframeworks
18:29 vade joined #openframeworks
19:48 jvcleave anyone happen to deal with Signal Handling  (OF or otherwise….)
19:50 roxlu jvcleave: I use signals
19:51 jvcleave oh nice - this is driving me crazy….
19:51 jvcleave basically I can close my class, reopen it, etc but on exit it locks up
19:52 roxlu close  your class?
19:52 jvcleave yeah - its the OMX video player
19:52 roxlu you mean free/delete ?
19:52 roxlu or close your app?
19:53 jvcleave i'll start over to explain more clearly
19:53 jvcleave :)
19:53 jvcleave so I have the ofxOMXVideoPlayer class
19:54 jvcleave it works fine by itself - can be freed, deleted
19:54 jvcleave I am incorporating playlist functionality which gets a bit tricky
19:56 jvcleave so I am at the point to where I have my videoplayer and I can feed it videos, they all play - all is good
19:56 jvcleave the weird part is
19:56 jvcleave if I hit Ctrl+C sometimes the apps locks up
19:56 jvcleave However if I do
19:57 tigbot joined #openframeworks
19:58 jvcleave onKeyPressed(int key) { if(key =='c') videoplayer.close(); ofExit(); };
19:58 jvcleave that works every time
19:58 roxlu I guess you indeed "when I close my app" : )
19:58 roxlu it's buggish OF .. it has a very troublesome shutdown sequence
19:59 roxlu I think the trick is, to dealloc/destruct everything before (or at the moment) onExit is called
19:59 jvcleave yeah - it's important I free the EGLImage (if the videoplayer is using textures) or it will leak on the board
20:00 jvcleave yeah - I tried adding an ofEvents().exit handler but it is too late
20:00 jvcleave I tried some of this
20:00 jvcleave http://www.gnu.org/software/libc/man​ual/html_node/Blocking-Signals.html
20:00 roxlu i think there is a function you can override
20:01 * roxlu googling
20:02 roxlu did you try to extend exit() ?
20:03 jvcleave I messed with atexit() exit() and _Exit(0)
20:03 roxlu none worked?
20:03 jvcleave not for me
20:03 jvcleave well _Exit(0) works :)
20:04 jvcleave that is pretty brute force tho
20:04 roxlu and now you want to add a signal handler so you can shutdown quickly?
20:04 jvcleave optimally the best thing would be
20:04 jvcleave I catch Ctrl+C (SIGINT)
20:04 jvcleave Shutdown my class
20:04 jvcleave and then let OF do the rest
20:05 roxlu didn't that work?
20:06 jvcleave not as well as the keypress - truly bizarre
20:06 jvcleave this is what I do now which is reliable
20:06 roxlu sigint is called later
20:06 jvcleave signal(SIGINT,  &onExitHandler);
20:06 roxlu the keypress gives you time to cleanup; the signal handler not
20:06 roxlu I assume OF is calling some d'tors already
20:07 roxlu can you paste a backtrace maybe?
20:09 jvcleave yeah - looking for this signal that of handles
20:09 jvcleave ok
20:10 jvcleave my signal call above stops this
20:10 jvcleave https://github.com/openframeworks/o​penFrameworks/blob/master/libs/open​Frameworks/app/ofAppRunner.cpp#L67
20:10 jvcleave that is good
20:10 roxlu there is already a signal handler?
20:11 jvcleave yeah - in apprunner
20:12 jvcleave so I thought - ok - i blocked that
20:12 roxlu and is the d'tor ofBaseApp called? (is it possible to dump a back trace?)
20:13 jvcleave good question - not sure at this point - let me stash
20:15 jvcleave ok - you want a backtrace of when it hangs?
20:15 roxlu yes please
20:16 jvcleave cool  - compiling
20:18 jvcleave takes a min to complile Debug :)
20:19 roxlu you have to compile on the rpi?
20:19 jvcleave i use distcc so it's fairly quick
20:20 jvcleave running gdb now
20:23 jvcleave hmm  SIGINT is used by the debugger
20:24 jvcleave so if I hit Ctrl+C gdb catches it
20:24 jvcleave trying
20:24 jvcleave handle SIGINT nostop
20:25 roxlu but it also crashed if you closed your app so maybe you can just close it?
20:25 jvcleave yeah - will try that
20:28 jvcleave what is the command to stop the app in gdb (the opposite of r)?
20:28 roxlu hmm dunno, I normaly add breakpoints with lldb
20:30 jvcleave ok i can try that
20:34 jvcleave well gdb just catches SIGINT when I press Ctrl+C so it never gets to the app
20:35 jvcleave (or the breakpoint)
20:35 roxlu hmm so you cannot exit the application?
20:35 roxlu w/o ctrl+c
20:35 jvcleave i can try to add a keypress
20:35 jacres joined #openframeworks
20:35 roxlu isn't it a graphical app?
20:35 roxlu with a window
20:36 jvcleave no
20:36 jvcleave its on the RPI
20:36 roxlu just wondering.. but do you need OF ?
20:37 LCID_Fire joined #openframeworks
20:37 LCID_Fire joined #openframeworks
20:38 LCID_Fire anyone here who tried compiling for emscripten?
20:40 jvcleave well - with the keypress it works fine :/
20:40 roxlu haha
20:40 jvcleave same as my other one
20:41 roxlu so it only crashs when you press ctrl+c from command line
20:41 jvcleave yep
20:41 jvcleave which is the way I always work on the RPI
20:42 roxlu yeah
20:42 roxlu so you just see a sigterm error?
20:42 roxlu nothings else?
20:42 jvcleave when it hangs?
20:42 roxlu yes
20:43 jvcleave no - it will hang the process - has to be killed from another window
20:43 jvcleave and it will leak GPU memory
20:43 jvcleave until it eventually locks up the PI
20:44 roxlu I thought it just crashed
20:44 roxlu now I get what you meant with 'hangs'
20:44 roxlu can you paste some code?
20:44 jvcleave ah - sorry - yeah
20:47 jvcleave here is the current class that can exit - you can see what I have tried
20:47 jvcleave https://github.com/jvcleave/ofxOMXPlaye​r/blob/develop-ofPixels-exiting/addons/​ofxOMXPlayer/src/ofxOMXPlayer.cpp#L23
20:47 jvcleave there it catches the SIGINT and kills itself
20:47 roxlu and sorry, but was it in onExitHandler where it hangs?
20:48 jvcleave no it hangs much deeper when trying to release OMX components
20:48 roxlu (just checking, but is the EGL context still there at line 25? )
20:48 roxlu it might be that the egl context has been released already
20:49 jvcleave yeah - that will happen if I don't catch the signal
20:49 roxlu ok, so it exists in 25
20:49 jvcleave yes - here it does
20:51 roxlu I'm trying to figure out why it hangs
20:52 roxlu how do you know it hangs much deeper?
20:52 jvcleave my guess was that this happened before my addon is done with the resources
20:53 jvcleave https://github.com/openframeworks/op​enFrameworks/blob/master/libs/openFr​ameworks/app/ofAppEGLWindow.cpp#L369
20:54 jvcleave but I returned early there and it didn't make a difference
20:54 roxlu hmm
20:55 roxlu I would look into a way to figure out to get a backtrace
20:55 roxlu +how
20:55 roxlu it has to do with the order of destructing things I would say from what you've told
20:56 jvcleave yeah - it's just bizzare to me how the keypress works every time
20:57 roxlu that's because then no other d'tors have been called
20:57 roxlu that totally makes sense
20:57 roxlu on mac/win OF shuts down all kinds of stuff when closing; e.g. often when you add a custom d'tor to ofTestApp it will give similar errors
20:58 jvcleave that is what I thought would be the "easiest" is to replicate that keypress inside my class
20:58 jvcleave so that is where I got into signal blocking
20:59 roxlu yeah, though that isn't really simulating the same thing
20:59 roxlu when you press a key and then close, you kinda specify the order of dtors
20:59 roxlu where was that code again? (with the key press)
21:00 jvcleave https://github.com/jvcleave/ofxOMXPlayer/blob/de​velop-ofPixels-exiting/src/playlistApp.cpp#L143
21:00 jvcleave below that actually
21:00 jvcleave https://github.com/jvcleave/ofxOMXPlayer/blob/de​velop-ofPixels-exiting/src/playlistApp.cpp#L148
21:01 roxlu just a whild guess, but can you try to move "ofxOMXPlayer omxPlayer" to line 27, below "ConsoleListener consoleListener"
21:02 dantheman joined #openframeworks
21:03 jvcleave yeah
21:03 jvcleave should I remove my signal handler then too I guess?
21:03 roxlu yes
21:04 jvcleave yeah - hangs still
21:05 roxlu damn
21:05 jvcleave that would have been awesome tho :)
21:05 roxlu it has to do with the order of d'tors so it could have been the problem
21:05 roxlu but when it "hangs" I would assume it's still doing something
21:06 roxlu maybe it's a good thing to figure out how to simulate the same error while running a debugger
21:06 jvcleave yeah - it is trying to clean up the OMX components
21:06 roxlu but how to do you know that for sure w/o a debugger?
21:06 jvcleave i have a lot of logging
21:07 roxlu ah :P do you know the exact line where it stops?
21:07 jvcleave https://gist.github.com/jvcleave/6643921
21:07 jvcleave yeah
21:07 roxlu this looks wrong to me: https://gist.github.com/jvcleave/​6643921#file-gistfile1-txt-L5-L6
21:08 roxlu the surface if destroyed first .. shouldn't that be the last ting?
21:08 jvcleave yeah - that is because of
21:08 jvcleave : https://github.com/openframeworks/op​enFrameworks/blob/master/libs/openFr​ameworks/app/ofAppEGLWindow.cpp#L369
21:08 jvcleave that is why I am hijacking the signal
21:09 roxlu ok sorry, I haven't looked at this code for quite a while (I don't know what stuff goes on when shutting down of)
21:09 jvcleave no problem - it's probably all new as well
21:09 roxlu when you add a printf() in testapp::exit(), where is called when looking at the log?
21:12 jvcleave I actually don't implement exit but I can
21:12 roxlu you tried it before right?
21:13 jvcleave yeah
21:13 jvcleave i'll try it again real quick
21:14 roxlu you need to find a way to call exit() before the surface is destroyed; maybe hack a custom function into it as a test
21:14 roxlu just to see if that works
21:14 jvcleave i tried similar by doing ofAdddListener(ofEvents().exit, this, &ofxOMXPlayer::exit); but that was too late as well
21:15 roxlu I would use a plain c callback so you're sure nothing funny is going on in the event system
21:16 superFluid joined #openframeworks
21:17 workergnome joined #openframeworks
21:17 jvcleave ok - this is where it exits cleanly (and you can see the app exit call) but where the GPU leak is still happening
21:17 jvcleave https://gist.github.com/jvc​leave/ce0caf4dbdf54c49fc9f
21:18 roxlu so if you use exit() is cleans w/o hanging?
21:18 roxlu uhh, it exists w/o hanging
21:19 jvcleave ha - and it will eventually hang - here is that
21:19 jvcleave https://gist.github.com/jvc​leave/a9ec06ffbb2540372098
21:19 roxlu what about line 17, shouldn't that be at line 24?
21:20 jvcleave oh you mean if I close the player on testApp::exit?
21:20 roxlu yes
21:21 roxlu so the same code as you call when you press 'c'
21:21 jvcleave that may work but I was trying to keep the player encapsulated
21:21 jvcleave but may be the compromise i have to make
21:22 jvcleave trying it now
21:24 jvcleave ha - doesn't work either
21:24 jvcleave https://gist.github.com/jvc​leave/885dafeaaa7aebca919e
21:25 jvcleave but here is what happens with the keypressed event shutdown
21:25 jvcleave https://gist.github.com/jvc​leave/7fb143b953ebe2324d1a
21:26 roxlu looks similar
21:26 roxlu (at least the top lines)
21:27 jvcleave yeah - the keypress works every time
21:27 jvcleave and is what happens it allow the opening/reopening of the player
21:27 roxlu I would still think something is destroyed, then probably before exit() is called
21:29 jvcleave yeah - I am probably not going to be able to get around not changing core or requiring my own extension of ofAppEGLWindow
21:30 roxlu hmm
21:30 roxlu I would try to get a backtrace somehow
21:31 dantheman joined #openframeworks
21:31 jvcleave yeah - maybe I can set a timer to raise(SIGINT)
21:32 jvcleave and then break on where it hangs
21:38 jvcleave trying that
21:42 jvcleave wow - this is exiting cleanly every time
21:43 jacres joined #openframeworks
21:43 jvcleave I put this in update() and change it via keypress
21:43 jvcleave if (doSimulatedHang) {
21:43 jvcleave doSimulatedHang = false;
21:43 jvcleave raise(SIGINT);
21:43 jvcleave }
22:19 roxlu jvcleave: did you figure it out?
22:19 jvcleave not yet - i think i am getting close to the right order tho
22:21 roxlu awesome!
22:46 pizthewiz joined #openframeworks
23:21 jacres joined #openframeworks
23:38 jacres joined #openframeworks
23:46 vade joined #openframeworks

| Channels | #openframeworks index | Today | | Search | Google Search | Plain-Text | summary