Ah, silly me. After + iter->offset = 0;
you need: + iter->values = NULL; On Fri, Nov 12, 2010 at 2:07 AM, nozawat <noza...@gmail.com> wrote: > Hi Andrew, > > I show below a result of print. > > 1)print *iter > (gdb) print *iter > $1 = {offset = 2, hash = 0x12aa7ec0, values = 0x7fff1568e580} > ----- > > 2)print *values > (gdb) print *values > $2 = {data = 0x7fff1568e5c0, next = 0x2b247ebb85a1, prev = 0x1} > ----- > > Regards, > Tomo > > 2010/11/12 Andrew Beekhof <and...@beekhof.net> >> >> On Thu, Nov 11, 2010 at 3:50 PM, nozawat <noza...@gmail.com> wrote: >> > Hi Andrew >> > >> > Sorry,pengine output a core. >> >> could you go up to frame #1 and run: >> print *iter >> print *values >> >> > >> > ----- >> > gdb) where >> > #0 0x00002b247fa8b53a in g_list_nth_data () from >> > /lib64/libglib-2.0.so.0 >> > #1 0x00002b247ebc5027 in g_hash_table_iter_next (iter=0x7fff1568e4c0, >> > key=0x0, value=0x7fff1568e4e0) >> > at ../include/crm/common/util.h: >> > 348 >> > #2 0x00002b247ebc9301 in native_rsc_location (rsc=0x12aa9cc0, >> > constraint=0x12af5480) at native.c:1215 >> > #3 0x00002b247ebcf56c in group_rsc_location (rsc=0x12aa9cc0, >> > constraint=0x12af5480) at group.c:421 >> > #4 0x00002b247ebb85a1 in apply_placement_constraints >> > (data_set=0x7fff1568e6b0) at allocate.c:523 >> > #5 0x00002b247ebb96f6 in stage2 (data_set=0x7fff1568e6b0) at >> > allocate.c:872 >> > #6 0x00002b247ebb6754 in do_calculations (data_set=0x7fff1568e6b0, >> > xml_input=0x1295ec90, now=0x0) >> > at pengine.c:262 >> > #7 0x00002b247ebb5d3e in process_pe_message (msg=0x12941e60, >> > xml_data=0x1295a610, sender=0x12940ac0) >> > at pengine.c:124 >> > #8 0x0000000000401265 in pe_msg_callback (client=0x12940ac0, >> > user_data=0x0) >> > at main.c:60 >> > #9 0x00002b247f634b97 in G_CH_dispatch_int (source=0x1293fd80, >> > callback=0, >> > user_data=0x0) at GSource.c:637 >> > #10 0x00002b247fa8ddb4 in g_main_context_dispatch () from >> > /lib64/libglib-2.0.so.0 >> > #11 0x00002b247fa90c0d in ?? () from /lib64/libglib-2.0.so.0 >> > #12 0x00002b247fa90f1a in g_main_loop_run () from >> > /lib64/libglib-2.0.so.0 >> > #13 0x000000000040186f in main (argc=1, argv=0x7fff1568eb48) at >> > main.c:177 >> > (gdb) >> > >> > ------ >> > >> > Regards, >> > Tomo >> > >> > >> > >> > >> > 2010/11/11 Andrew Beekhof <and...@beekhof.net> >> >> >> >> On Thu, Nov 11, 2010 at 12:31 PM, nozawat <noza...@gmail.com> wrote: >> >> > Hi Andrew, >> >> > >> >> > I ran it. However, an error has been output. >> >> > Probably I have a feeling that glib does not move well. >> >> > I attached ha-log. >> >> > >> >> > I feel like cannot read a library well. >> >> > It is contents of core as follows. >> >> >> >> you'll need the debuginfo package installed >> >> >> >> > ---- >> >> > $ gdb /usr/sbin/corosync core.27920 >> >> > GNU gdb Fedora (6.8-37.el5) >> >> > Copyright (C) 2008 Free Software Foundation, Inc. >> >> > License GPLv3+: GNU GPL version 3 or later >> >> > <http://gnu.org/licenses/gpl.html> >> >> > This is free software: you are free to change and redistribute it. >> >> > There is NO WARRANTY, to the extent permitted by law. Type "show >> >> > copying" >> >> > and "show warranty" for details. >> >> > This GDB was configured as "x86_64-redhat-linux-gnu"... >> >> > >> >> > warning: core file may not match specified executable file. >> >> > Core was generated by `/usr/lib64/heartbeat/pengine'. >> >> > Program terminated with signal 11, Segmentation fault. >> >> > [New process 27920] >> >> > #0 0x00002b247fa8b53a in ?? () >> >> > (gdb) where >> >> > #0 0x00002b247fa8b53a in ?? () >> >> > #1 0x00002b247ebc5027 in ?? () >> >> > #2 0x0000000000000000 in ?? () >> >> > ------ >> >> > >> >> > Regards, >> >> > Tomo >> >> > >> >> > 2010/11/11 Andrew Beekhof <and...@beekhof.net> >> >> >> >> >> >> On Thu, Nov 11, 2010 at 10:26 AM, nozawat <noza...@gmail.com> wrote: >> >> >> > Hi Andrew, >> >> >> > >> >> >> > Thanks for a revision. >> >> >> > I confirmed completion of compiling it. >> >> >> > I revised it a little, I attach a patch. >> >> >> >> >> >> Thanks! Did you try running it? >> >> >> >> >> >> > >> >> >> > Regards, >> >> >> > Tomo >> >> >> > >> >> >> > >> >> >> > 2010/11/11 Andrew Beekhof <and...@beekhof.net> >> >> >> >> >> >> >> >> This might be a little better: >> >> >> >> >> >> >> >> diff -r dd75da218e4f configure.ac >> >> >> >> --- a/configure.ac Fri Oct 29 12:12:45 2010 +0200 >> >> >> >> +++ b/configure.ac Tue Nov 09 13:20:55 2010 +0100 >> >> >> >> @@ -654,7 +654,7 @@ AC_MSG_RESULT(using $GLIBCONFIG) >> >> >> >> >> >> >> >> AC_CHECK_LIB(glib-2.0, g_hash_table_get_values) >> >> >> >> if test "x$ac_cv_lib_glib_2_0_g_hash_table_get_values" != >> >> >> >> x""yes; >> >> >> >> then >> >> >> >> - AC_MSG_ERROR(Your version of Glib is too old, you need at >> >> >> >> least >> >> >> >> 2.14) >> >> >> >> + AC_MSG_WARN(Your version of Glib is too old, you should have >> >> >> >> at >> >> >> >> least >> >> >> >> 2.14) >> >> >> >> fi >> >> >> >> >> >> >> >> # >> >> >> >> diff -r dd75da218e4f include/crm/common/util.h >> >> >> >> --- a/include/crm/common/util.h Fri Oct 29 12:12:45 2010 +0200 >> >> >> >> +++ b/include/crm/common/util.h Tue Nov 09 13:20:55 2010 +0100 >> >> >> >> @@ -298,4 +298,59 @@ extern int node_score_infinity; >> >> >> >> extern xmlNode *create_operation_update(xmlNode *parent, >> >> >> >> lrm_op_t >> >> >> >> *op, const char *caller_version, int target_rc, const char >> >> >> >> *origin, >> >> >> >> int level); >> >> >> >> extern void free_lrm_op(lrm_op_t *op); >> >> >> >> >> >> >> >> +#if HAVE_LIBGLIB_2_0 >> >> >> >> + >> >> >> >> +#else >> >> >> >> + >> >> >> >> +typedef struct fake_ghi >> >> >> >> +{ >> >> >> >> + int offset; >> >> >> >> + GHashTable *hash; >> >> >> >> + GList *values; >> >> >> >> + >> >> >> >> +} GHashTableIter; >> >> >> >> + >> >> >> >> +static inline void g_hash_append_value(gpointer key, gpointer >> >> >> >> value, >> >> >> >> gpointer user_data) >> >> >> >> +{ >> >> >> >> + GList **values = (GList **)user_data; >> >> >> >> + *values = g_list_append(*values, value); >> >> >> >> +} >> >> >> >> + >> >> >> >> +static inline GList *g_hash_table_get_values(GHashTable >> >> >> >> *hash_table); >> >> >> >> +{ >> >> >> >> + GList *values = NULL; >> >> >> >> + g_hash_table_foreach(hash_table, g_hash_append_value, >> >> >> >> &values); >> >> >> >> +} >> >> >> >> + >> >> >> >> +static inline void g_hash_table_iter_init(GHashTableIter *iter, >> >> >> >> GHashTable *hash_table) >> >> >> >> +{ >> >> >> >> + iter->offset = 0; >> >> >> >> + iter->hash = hash_table; >> >> >> >> + >> >> >> >> + /* iter->values = g_hash_table_get_values(hash_table); */ >> >> >> >> + >> >> >> >> + /* We could cache the values, but then we need to clean up >> >> >> >> the >> >> >> >> list >> >> >> >> + * later which doesn't fit the glib2 API >> >> >> >> + * So instead we calculate it in _next() every time its >> >> >> >> needed >> >> >> >> + */ >> >> >> >> +} >> >> >> >> + >> >> >> >> + >> >> >> >> +static inline gboolean g_hash_table_iter_next(GHashTableIter >> >> >> >> *iter, >> >> >> >> gpointer *key, gpointer *value) >> >> >> >> +{ >> >> >> >> + GList *values = iter->values; >> >> >> >> + if(iter->values == NULL) { >> >> >> >> + values = g_hash_table_get_values(iter->hash_table); >> >> >> >> + } >> >> >> >> + >> >> >> >> + iter->offset++; >> >> >> >> + *value = g_list_nth_data(values, iter->offset); >> >> >> >> + >> >> >> >> + if(iter->values == NULL) { >> >> >> >> + g_list_free(values); >> >> >> >> + } >> >> >> >> + return (*value) != NULL; >> >> >> >> +} >> >> >> >> + >> >> >> >> #endif >> >> >> >> + >> >> >> >> +#endif >> >> >> >> >> >> >> >> _______________________________________________ >> >> >> >> Pacemaker mailing list: Pacemaker@oss.clusterlabs.org >> >> >> >> http://oss.clusterlabs.org/mailman/listinfo/pacemaker >> >> >> >> >> >> >> >> Project Home: http://www.clusterlabs.org >> >> >> >> Getting started: >> >> >> >> http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf >> >> >> >> Bugs: >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker >> >> >> > >> >> >> > >> >> >> > _______________________________________________ >> >> >> > Pacemaker mailing list: Pacemaker@oss.clusterlabs.org >> >> >> > http://oss.clusterlabs.org/mailman/listinfo/pacemaker >> >> >> > >> >> >> > Project Home: http://www.clusterlabs.org >> >> >> > Getting started: >> >> >> > http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf >> >> >> > Bugs: >> >> >> > >> >> >> > >> >> >> > >> >> >> > http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker >> >> >> > >> >> >> > >> >> >> >> >> >> _______________________________________________ >> >> >> Pacemaker mailing list: Pacemaker@oss.clusterlabs.org >> >> >> http://oss.clusterlabs.org/mailman/listinfo/pacemaker >> >> >> >> >> >> Project Home: http://www.clusterlabs.org >> >> >> Getting started: >> >> >> http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf >> >> >> Bugs: >> >> >> >> >> >> >> >> >> http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker >> >> > >> >> > >> >> > _______________________________________________ >> >> > Pacemaker mailing list: Pacemaker@oss.clusterlabs.org >> >> > http://oss.clusterlabs.org/mailman/listinfo/pacemaker >> >> > >> >> > Project Home: http://www.clusterlabs.org >> >> > Getting started: >> >> > http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf >> >> > Bugs: >> >> > >> >> > >> >> > http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker >> >> > >> >> > >> >> >> >> _______________________________________________ >> >> Pacemaker mailing list: Pacemaker@oss.clusterlabs.org >> >> http://oss.clusterlabs.org/mailman/listinfo/pacemaker >> >> >> >> Project Home: http://www.clusterlabs.org >> >> Getting started: >> >> http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf >> >> Bugs: >> >> >> >> http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker >> > >> > >> > _______________________________________________ >> > Pacemaker mailing list: Pacemaker@oss.clusterlabs.org >> > http://oss.clusterlabs.org/mailman/listinfo/pacemaker >> > >> > Project Home: http://www.clusterlabs.org >> > Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf >> > Bugs: >> > >> > http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker >> > >> > >> >> _______________________________________________ >> Pacemaker mailing list: Pacemaker@oss.clusterlabs.org >> http://oss.clusterlabs.org/mailman/listinfo/pacemaker >> >> Project Home: http://www.clusterlabs.org >> Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf >> Bugs: >> http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker > > > _______________________________________________ > Pacemaker mailing list: Pacemaker@oss.clusterlabs.org > http://oss.clusterlabs.org/mailman/listinfo/pacemaker > > Project Home: http://www.clusterlabs.org > Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf > Bugs: > http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker > > _______________________________________________ Pacemaker mailing list: Pacemaker@oss.clusterlabs.org http://oss.clusterlabs.org/mailman/listinfo/pacemaker Project Home: http://www.clusterlabs.org Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf Bugs: http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker