[00:05] whoah [00:05] now I've hit a segfault that looks like mr pointer went west [00:08] Thought flow: West. Go west. Someone should feed Go West to Songsmith and post it to Youtube. [00:08] huh? [00:09] You haven’t seen the numerous Songsmith versions of songs on Youtube? [00:09] nope [00:09] exampel? [00:14] http://www.youtube.com/watch?v=YSWmh9ZTLOY http://www.youtube.com/watch?v=_V1DuHUs22Q http://www.youtube.com/watch?v=itsT9zgWRoM http://www.youtube.com/watch?v=ypycpKQxXR0 http://www.youtube.com/watch?v=e1e_h1OJfS4 http://www.youtube.com/watch?v=6iCJHTzH5DY http://www.youtube.com/watch?v=WmC28cXWqLc http://www.youtube.com/watch?v=Um6WeRFC934 [00:19] wonderfully bad [00:20] Yeah [00:21] So, what was the segfault problem? [00:23] not sure yet [00:24] it's uninitialised data [00:24] which is surprising [00:24] I was expecting write to freed memory [00:31] it _is_ happening inside a destructor though [00:34] (gdb) p source->files->bins[4] [00:34] $52 = {prev = 0x7fff2454a6f0, next = 0x7fff2454a6f0} [00:34] hah [00:36] now, how the hell does that happen? [00:36] ohhhhhhhhhhhhhhhhhhhhh [00:36] I know what that is [00:36] that's a list iterator! [00:37] this is the bug I knew there was with cursors in NIH_LIST_FOREACH_SAFE [00:37] that makes me happy [00:37] How is the bug triggered? [00:38] iterating a linked list while iterating a linked list with NIH_LIST_FOREACH_SAFE [00:38] honestly, the real problem here is that the ConfFile destructor is bogus [00:38] it does all sorts of heavy work, which really isn't appropriate [00:39] destructors are for cleaning up a structure, not for going around and restarting other jobs ;) [00:39] Yeah... [00:42] 2009-01-26 22:38:22 < ion_> Note to self: ask Keybuk why: * nih_config_parse() now reads the file into memory, instead of using mmap(). [00:42] truncate a file while it's mmapped and try reading from it ;) [00:43] Ok [00:43] Keybuk: take file lock? [00:43] sadmac: how does that help? [00:43] file locks only work if everyone co-operates [00:43] Keybuk: never mind [00:44] you can core the process with just :> filename [00:44] At least the command is happy. [00:47] /* Mark the job to be deleted when it stops, in case [00:47] * it cannot be deleted here. [00:47] */ [00:47] file->job->deleted = TRUE; [00:47] ... [00:47] what does _that_ do? [00:48] this whole job deletion stuff always scares me [00:48] it's just a bag or corner cases [00:49] Heh [01:04] aha [01:04] this makes sense [01:04] conf_file_new () doesn't do anything with a job [01:05] so the destructor bloody well shouldn't either [01:05] code gets easier to understand by being less clever [01:06] Keybuk: can you make the alloc system error when someone tries to code this way? [01:09] I don't see how [02:02] sweet [02:02] nih and upstart are now valgrind-clean [02:07] nice [02:15] fixed the issue where test_job_process sometimes locks up too [02:23] ah. don't remember that one [02:31] damn [02:31] grepping for usage of nih_free() and many of these are quite valid [02:31] 1) clean-up in case of function error [02:32] but most importantly [02:32] Keybuk: shouldn't that be an nih_local thing now? [02:32] 2) hanging workers [02:32] sadmac: not really, since the parent is passed in [02:33] here's an example of #2 [02:34] nih_io_reopen (job, ...) [02:34] ie. create an nih_io structure that's a child of job, but never actually make job know about it [02:34] it's just doing something on job's behalf [02:34] nih_timer_new (job, ...) [02:34] in fact, I do this for just about everything [02:34] if you free job, the io or timer are automatically cancelled and cleaned up [02:34] but they're only doing work on its behalf [02:35] many of them are handled from the main loop and self-free [02:35] timer's a good example, the main loop frees timers [02:35] hm [02:40] also NihError relies on its quite heavily ;) [02:40] but then NihError is an aberration since it's the only part of libnih you can't reference [02:40] (except you can now - but don't ) [02:43] Keybuk: ...I have complete working code in another project for try{}catch{} [02:44] using setjmp? [02:44] yeah [02:45] its amazing what it does to clean up code. especially with the wrapper macros. [02:45] usually try looks something like [02:45] setjmp, if (! error) [02:45] and catch something like [02:46] if (error) [02:46] not quite [02:46] its if (! error) [02:46] and else if (error == foo) [02:46] and a bunch of for loops which don't loop but throw code after the block. [02:47] but once all the bits are in place [02:47] if (! bytes = read(...)) { /* handle error in 2 or 3 lines */ } [02:47] becomes bytes = e_(read(...)) [02:51] why read? [02:51] Keybuk: just an example. [02:51] Keybuk: I have 2 or 3 character wrappers to turn all the varying POSIX errno-based semantics into exception throws [02:57] ah [02:57] why e_? [02:57] oh, I see [02:57] dpkg has something a bit different [02:57] you push cleanup handler functions with push_cleanup() [02:57] and you set checkpoints [02:57] if an error occurs, you call ohshit() or ohshite() [02:58] that rolls back to the last checkpoint, calling up cleanup handlers on the way [02:58] Keybuk: I do memory management that way :) [02:58] Keybuk: Memory is allocated on obstacks, and then simply forgotten about, like it had been malloc'd and there was a garbage collector [02:59] Keybuk: and then at a few points in the program, particular obstacks are simply dumped out completely [02:59] it was one of my original ideas for nih_alloc [02:59] that the contexts would match the error handling contexts [02:59] there's a few cases it doesn't work for. but I'm ok with it varying [03:29] Keybuk: have you looked at the way lisp does exceptions? [03:40] no? [03:41] Keybuk: its something like this: [03:42] on_error("fooerror") do { /*closure*/ } [03:42] /* stuff that might trigger error */ [03:42] restore_handler("fooerror") [03:44] we could do it in C, but to do it right we'd need nested functions and pointers thereto (read: trampolines (read: executable stack (read: in pid 1 (read: cancer)))) [03:44] err [03:44] ?? [03:44] Keybuk: they call it signals, and it works a bit like unix signals. [03:45] Keybuk: you install a function to handle a particular type of error. [03:45] Keybuk: but its lisp, so this can be done for very granular short-term cases [03:45] (because defining a function in lisp is simple) [03:46] and the function lasts for the inner scope? [03:48] Keybuk: in most cases. If it makes sense to install a global function as an error handler you do it [03:48] Keybuk: but the big technical difference is you don't rewind the stack when you get an error. You execute the handler in place. meaning its more likely that you can get at state info and see what happened [03:49] You then have the /option/ to rewind the stack. [03:49] yeah, I often wish you could do that with exceptions in Python [03:49] except KeyboardInterrupt: [03:49] bank [03:50] bank? [03:50] any language that has a "pass" keyboard should have a "bank" keyword ;) [03:51] ...I get the sense there's a language barrier here. [03:51] is this a British pun? [03:51] you have "Weakest Link" in the US, right? [03:52] we did for a bit [03:52] don't think we do anymore [03:52] which is sad [03:52] ahh [03:52] because it was awesome [03:52] Keybuk: in this system it would look like (in python [03:52] on_error("KeyboardInterrupt", lambda: pass) [03:53] # go about your business [04:08] Keybuk: http://www.gigamonkeys.com/book/beyond-exception-handling-conditions-and-restarts.html [04:11] I love my test suite [04:13] I like it too [04:14] I feel nice and safe about making far sweeping changes [04:24] what far sweeping changes are you making now? [04:26] I was just thinking in terms of rewriting the fundamental function call that manages memory [04:32] what will you change? [04:32] right now isn't it just a realloc? [04:32] no, I mean what I've changed [04:32] ie. the switch to multi-reference nih_alloc [04:33] ah. [05:18] gnargh [05:18] I wish gcc could understand the TEST_ALLOC_FAIL loop [05:19] what's it doing wrong? [05:20] it thinks variables can be unused [05:20] err, used unused I mean [05:20] used uninitialized [05:20] :) [05:21] we got there eventually [05:24] damn. every time I commit a 2-line change to a Fedora Infrastructure project, they give me commit access, and it comes with a mailing list that emails me every time someone changes something [05:24] heh [05:24] we have similar problems [05:24] customer bugs as generally private at first, since they often involve NDA hardware [05:25] so if you want to read the bug (or have to), they join you to the team working on that hardware [05:25] which usually means you get flooded with all the bug traffic, commits,e tc. [05:25] heh [05:25] Our IT system at work has public and private comments. [05:26] Public are... public. Private can be seen by me (the engineer), and either an L2 or a TAM [05:27] If its an L2, you give your usual nerdy harshing-shit-up spiel about the problem, and the L2 tells the customer in much more polite terms [05:27] TAMs get you in trouble. [05:27] rh.com email, but they live, work, and eat with the people having the issue. [05:27] You try to whisper through them and then realize they're on the other side. [05:33] Yeah I've heard about that [05:33] Its all good, I mean, we're all "on the same side" [05:33] its just a tone selection. [06:04] Keybuk: what error should I raise if the reply hasn't been received somehow within the callback? [06:04] Keybuk: I almost think it should be an nih_assert, since why would dbus have called us if there was no reply? [06:05] hmm [06:05] if the reply is corrupt you mean? [06:06] or missing entirely? [06:06] Keybuk: dbus_pending_call_steal_reply returns the reply or NULL if none received. [06:06] ah, yeah, I'd assert on that one() [06:06] ok [06:06] a more interesting question is what do you do when the arguments in the reply don't match what you're expecting [06:06] (call the error handling with the NIH_DBUS_INVALID_ARGS error) [06:08] the current type error raises ENOMEM. I don't know how that works out... [06:08] * sadmac was pretty sure that part of the code was copypasta... [06:09] also neither of the error conditions for the marshaller unref anything before returning [06:10] they all get attached to the message object, I think [06:10] which gets unref'd [06:10] mem_error unrefs reply but type_error doesn't [06:11] I'm in ur black box, bein white? [06:11] dunno, I'd have to read the code again ;) [06:32] Keybuk: nih_free is type void and takes one type void* right? [06:36] returns an int [06:36] and takes void * [06:36] ah, that explains that [06:36] oh? [06:37] Keybuk: why it wasn't a valid DBusFreeFunction [06:39] heh [06:39] yeah [06:40] of course, shouldn't that be nih_discard? :) [06:41] Keybuk: I hate you >:( [06:43] why? [06:43] stupid discard is for poopy-heads [06:44] heh [06:51] Keybuk: go look at that async branch again [06:51] bzr+ssh://bazaar.launchpad.net/~cjdahlin/libnih/async/ === sadmac_ is now known as sadmac [06:58] Keybuk: did you get that? === Keybuk changed the topic of #upstart to: Upstart 0.5.1 "Unexpected item in bagging area" [07:00] sadmac: I got your branch URL === Keybuk changed the topic of #upstart to: Upstart 0.5.1 "Unexpected item in bagging area" | http://upstart.ubuntu.com/ [07:01] Keybuk: ok, there was nothing after that [07:01] Nice release name [07:02] * sadmac hits McDonalds [07:02] bbs [07:15] I return [07:19] * Keybuk shall just brain dump review again [07:20] you still have the extra names() functions, what are those about? [07:20] Keybuk: for bulk-passing a group of variables to a function [07:21] Keybuk: where using vars would yield foofunc(int foo, int bar)' [07:21] do you use it anyway? [07:21] using names would yield foofunc(foo, bar) [07:21] oh, I see [07:21] I use it [07:23] mem_error/type_error [07:23] you raise the errors then return [07:23] which means the errors will get eaten somewhere inside libnih-dbus [07:23] I expect you meant to call the error handler there? [07:23] style, errno = ENOMEM, nih_error_raise_system () - instead of doing it by hand [07:23] Keybuk: line number? [07:23] 1363.. [07:24] also missing _() around NIH_DBUS_INVALID_ARGS_STR on 1369 [07:24] Keybuk: copypasta. That should be your code [07:24] Keybuk: I don't think it gets it. its defined with N_ already [07:25] N_ just marks for translation [07:25] N_ stuff needs _() called on it later [07:25] userdata -> data [07:26] NihAsyncNotifyData -> NihDBusPendingCall ? [07:26] Keybuk: I dunno about that one [07:26] I don't think those are the same thing [07:26] NihDBusCallback_%s -> YourFunctionNameInCapsCallback [07:26] NihDBusErrback_%s -> YourFunctionNameInCapsErrorHandler [07:27] is there a underscore-to-camel converter in this already? [07:27] probably not [07:27] one liner [07:29] wouldn't bother with the async_notify_data_free function [07:29] just cast it [07:29] cf. nih-dbus/dbus_connection.c [07:29] Keybuk: cf. ? [07:30] compare to [07:30] ok [07:31] can you stick a changelog entry on that, and I'll merge it [07:32] Keybuk: I had just casted nih_free before, and then I moved to the function. If you pop off the top commit you get that one fixed. [07:32] I'll do a revert commit and then add the changelog and push [07:33] if you can be reasonable detailed (at least describe each new function, etc.) that would be muchly appreciated [07:53] Keybuk: pull [08:06] and now sleep [08:38] morning [11:54] Keybuk: http://repository.maemo.org/pool/fremantle/free/u/upstart/ [12:01] suihkulokki: doing maemo stuff? [12:34] keesj: yes [12:40] as maemo platform developer? [12:41] Nokia is both cool and extremely evil. [12:43] suihkulokki: I also work on upstart for an embedded platform. [12:46] ion_: it greatly depends at what side of Nokia you look. [12:57] suihkulokki: are you also going to fosdem? [13:20] keesj: unfortunately not this year [13:46] alright [13:49] I am looking into the problems faced while creating as state machine inside upstart [13:52] I currently implmented as upstart job but that gives a few problems [13:57] first of all I can't recieve all events becasue the events don't get send while my state machine is running. for example I did start on event_a or event_b and if emit event_a and event_b one after the oder I can miss the second event [14:03] I have problem with upstart on armv4 machine (Neo Freerunner) [14:03] what kind? [14:03] as far as I can see the code works up to line 308 here: http://pastebin.com/d6558c132 [14:03] then it jumps here: http://pastebin.com/d7dbb1990 [14:04] on screen I can see everything up to last "return!" [14:04] and it stops [14:05] any idea how to debug it? [14:06] (the code if from: http://upstart.ubuntu.com/download/0.5/upstart-0.5.0.tar.bz2, compiled with "--exec-prefix=/ --enable-compat=sysv") [14:09] hiciu: does "make check" pass? [14:10] I will check that now [14:13] does that mean that event is NULL? [14:14] hiciu: given the arguments I guess you must be using sbox or compiling on the target? [14:14] yes [14:16] the only configure magic I have going is adding export ac_cv_func_malloc_0_nonnull="yes" [14:17] but I can't remember why.. [14:18] but the configure doesn't use it [14:29] suihkulokki: acting dead mode is battry charging? [14:31] I mean, under 'sbox2' :) [14:31] in event_new, on return event != null [14:32] but it does not pass tests: http://pastebin.com/d2154bba0 [14:33] you might need to do some porting [14:33] ./.libs/libnih.a: could not read symbols: File in wrong format?? [14:33] keesj has Upstart working on ARM, I believe? [14:34] yes, I have it running without modifs on qemu-arm and arm11 [14:34] http://pastebin.com/d5b909a81 [14:35] keesj: da [14:35] maemo also has upstart workin on arm (obviously) [14:35] but that still 0.3.x [14:55] hiciu: how do you run upstart anyway under qemu? [14:56] (I run a full system including a kernel) [14:56] i'm running it on freerunner [15:30] ok, I will try to build it on freerunner (on device, not crosscompiling) later (when I manage to boot freerunner ;]). [15:31] in meantime, simple bash script should work [15:31] thanks for help! :) [15:35] :P [15:36] Keybuk: would it be possible to listen to /(and consume) to all the events perfomed by upstart? [15:37] much like 0.3.9 had "initctl events" but with the addition that the event only get probatated once the "jobs" consumed the event [16:10] why can't I gdb --pid 1 ? [16:11] keesj: kernel too old? [16:11] keesj: (its veeery recent that they made that actually work) [16:11] like, during the end of the 0.5.0 dev cycle that started working for me [16:12] thanks for the tip . so .28 or something? [16:12] keesj: not quite that recent [16:13] 27, maybe late 26 [16:13] alright === sadmac2_ is now known as sadmac2 [21:56] hi [21:56] Will upstart 0.5 be in Jaunty? [22:35] KDesk: I don't think so [22:36] hi sadmac, isn't it ready, is the version 0.3 better? [22:38] KDesk: its proven a bit shaky so far (0.5.1 should fix a /lot/ of that). Keybuk could tell you more if he were around [22:40] sadmac oh, hopefully the new upstart will be in ubuntu some time in the future. Thanks for your explanation. === sadmac_ is now known as sadmac [23:39] Keybuk: hi