> I'm playing with my own emperor plugin, and managed to segfault it > pretty fast :) > > The segfault was on line 501 of core/emperor.c, here's the gdb output: > > Program received signal SIGSEGV, Segmentation fault. > emperor_add (ues=ues@entry=0x80ef6b8, name=0x80f03a0 > "http://127.0.0.1:5984/uwsgi/test.json", born=1352778515, > config=config@entry=0x0, config_size=config_size@entry=0, > uid=uid@entry=0, gid=gid@entry=0) at core/emperor.c:501 > 501 while (c_ui->ui_next) { > > > digging around the problem I've found out that c_ui is initialized to > the global ui pointer, but since I was calling emperor_add in the _init > function of my plugin, ui was still not set to point to ui_base. > > Moving the line ui = &ui_base; several lines up, just under > memset(&ui_base, 0... but certainly before emperor_build_scanners() > solves the segfault. > > Am I wrongly assuming something with that change? > >
To best plugin for starting is plugins/emperor_pg (the postgresql one). Basically you "register" an "imperial monitor" and it will be triggered at the right moment. Only the emperor process has access to the "ui" pointer, while the init() hook is called on startup (before it is available as you have already noted) -- Roberto De Ioris http://unbit.it _______________________________________________ uWSGI mailing list [email protected] http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
