Opened 11 years ago

Last modified 11 years ago

#244 new defect

core dump in ZRetrieveSubscriptions when starting without zhm

Reported by: jhutz@mit.edu Owned by:
Priority: major Milestone:
Component: zephyr Keywords:
Cc: jgross@mit.edu

Description

Originally reported by kaduk as as zephyr:ticket:82

When starting without zhm running, barnowl may crash in ZRetrieveSubscriptions, apparently due to Z_krb5_ctx (the Zephyr library's global krb5 library context) being NULL.

This variable is normally initialized by ZInitialize(). However, AFAIK barnowl doesn't call ZInitialize(), in order to avoid the possible delay if there is no zhm. I'm not sure what it does instead, but I suspect that lacking a zhm, Z_krb5_ctx is never initialized.

Change History (2)

comment:1 Changed 11 years ago by jgross@mit.edu

  • Cc jgross@mit.edu added

BarnOwl calls ZInitialize in owl_zephyr_finish_initialization. It calls owl_zephyr_finish_initialization by

channel = g_io_channel_unix_new(ZGetFD());
g_io_add_watch(channel, G_IO_IN | G_IO_ERR | G_IO_HUP,
               &owl_zephyr_finish_initialization, NULL);
g_io_channel_unref(channel);

in owl_zephyr_initialize. I'm not quite sure how this works. Also BarnOwl seems to only call ZRetrieveSubscriptions when you run getsubs? Unless I'm reading the code wrong. So maybe there's some other call that's out of order?

comment:2 Changed 11 years ago by jhutz@mit.edu

So, what's going on here is that owl_zephyr_initialize sends a status request to zhm, the same way that 'zstat -h' does, which can be done without fully initializing the Zephyr library. However, instead of sitting around waiting for a reply, it creates the IO channel you show above. If/when a reply ever comes from zhm, owl_zephyr_finish_initialization ignores it, closes the fd that was used to send the original status request, and then initializes zephyr for real (which involves the library doing another round trip to zhm). In this way, "real" zephyr initialization, including waiting for a reply from zhm, doesn't happen unless there is actually a hostmanager to talk to.

Unfortunately, this means that BarnOwl can run indefinitely in a state where Zephyr has not been initialized. I expect you're correct that BarnOwl doesn't call ZRetrieveSubscriptions unless you run getsubs. However, if one starts BarnOwl without a zhm and then runs getsubs, it will crash.

I think the "right" answer to this is to avoid making any calls to the zephyr library, other than those in owl_zephyr_initialize(), until owl_zephyr_finish_initialization() has run.

Note: See TracTickets for help on using tickets.