mod_pubsub error after upgrading to 2.1.0 from 2.0.3

After upgrading ejabberd from 2.0.3 to 2.1.0 everytime when starting ejabberd this error is in log and I don't know whats wrong :

=ERROR REPORT==== 2009-11-26 13:26:27 ===
E(<0.331.0>:mod_pubsub:3699) : transaction return internal error: {atomic,
{'EXIT',
{aborted,
{bad_type,
{pubsub_node,
{"pubsub.myserver",
<<"/home">>},
2,[],
"hometree",
[{[],
"pubsub.myserver",
[]}],
[{deliver_payloads,
true},
{notify_config,
false},
{notify_delete,
false},
{notify_retract,
true},
{persist_items,
true},
{max_items,
10},
{subscribe,
true},
{access_model,
open},
{roster_groups_allowed,
[]},
{publish_model,
publishers},
{notification_type,
headline},
{max_payload_size,
60000},
{send_last_published_item,
on_sub_and_presence},
{deliver_notifications,
true},
{presence_based_delivery,
false}]}}}}}

I haved followed instructions for upgrading.

Settings for mod_pubsub in ejabberd.cfg are :

{mod_caps, []},
{mod_pubsub, [
{access_createnode, pubsub_createnode},
{ignore_pep_from_offline, true},
{last_item_cache, false},
{plugins, ["flat", "hometree", "pep"]} % pep requires mod_caps

I installed ejabberd 2.0.5,

I installed ejabberd 2.0.5, started it a pair of times. Then installed 2.1.0, copied the mnesia spool files to the new directory and started it. Among many other stuff, ejabberd.log says:

=INFO REPORT==== 26-Nov-2009::20:18:36 ===
I(<0.353.0>:mod_pubsub:388) : Pubsub node tables updated correctly: ok

=INFO REPORT==== 26-Nov-2009::20:18:36 ===
I(<0.353.0>:mod_pubsub:437) : upgrade state pubsub tables

=INFO REPORT==== 26-Nov-2009::20:18:36 ===
I(<0.353.0>:mod_pubsub:463) : Pubsub state tables updated correctly: ok

If you have a backup copy of your 2.0.3 database, copy the files to 2.1.0 spool dir. Then start ejabberd and check if you get those messages, or some error.

I followed the upgrade

I followed the upgrade instructions ( everything is copied where it sholud be ) . My log contains this after starting ejabberd 2.1.0 for first time.

=INFO REPORT==== 2009-11-25 13:14:08 ===
I(<0.366.0>:mod_pubsub:388) : Pubsub node tables updated correctly: ok

=INFO REPORT==== 2009-11-25 13:14:08 ===
I(<0.366.0>:mod_pubsub:437) : upgrade state pubsub tables

=INFO REPORT==== 2009-11-25 13:14:08 ===
I(<0.366.0>:mod_pubsub:463) : Pubsub state tables updated correctly: ok

=ERROR REPORT==== 2009-11-25 13:14:08 ===
E(<0.366.0>:mod_pubsub:3699) : transaction return internal error:
 {atomic,
   {'EXIT',
    {aborted,
     {bad_type,
      {pubsub_node,
       {"pubsub.myserver", <<"/home">>},
       2,
       [],
       "hometree",
       [{[], "pubsub.myserver", []}],
       [{deliver_payloads, true},
	{notify_config, false},
	{notify_delete, false},
	{notify_retract, true},
	{persist_items, true},
	{max_items, 10},
	{subscribe, true},
	{access_model, open},
	{roster_groups_allowed, []},
	{publish_model, publishers},
	{notification_type, headline},
	{max_payload_size, 60000},
	{send_last_published_item, on_sub_and_presence},
	{deliver_notifications, true},
	{presence_based_delivery, false}]}}}}}

So, my tables have been updated, but everytime when restaring ejabberd the above error is displayed in log.

The format of the Mnesia

The format of the Mnesia table pubsub_node changed between ejabberd 2.0.x and 2.1.0. When ejabberd 2.1.0 is started, it checks the format of the table. If it's of old format, it updates it.

Example of old 2.0.x format:

{pubsub_node,{"pubsub.localhost",["home"]},
             {"pubsub.localhost",[]},
             "default",
             [{[],"pubsub.localhost",[]}],
             [{node_type,default},
              {deliver_payloads,true},
              {notify_config,false},
...

Example of new 2.1.0 format:

{pubsub_node,{"pubsub.localhost",<<"/home">>},
             0,
             [],
             "hometree",
             [{[],"pubsub.localhost",[]}],
             [{node_type,default},
              {deliver_payloads,true},
              {notify_config,false},
...

I tried an update from 2.0.3 to 2.1.0, and worked correctly. In your case, you get the three expected info reports, and a strange error report. The report is strange because the format looks similar to 2.1.0, so why does 2.1.0 report it as bad_type?

Make sure you don't have beam files from ejabberd 2.0.3 still installed in the system (like in /var/lib/ejabberd/ebin).

To investigate further, you can export the content of a Mnesia table from disk to a text file like this:

$ cd /var/lib/ejabberd/
$ erl -sname ejabberd@localhost -mnesia dir \"`pwd`\" -s mnesia
(ejabberd@localhost)1> {ok, Fd} = file:open("/tmp/ejatemp.txt", [write]),
 [io:format(Fd, "~p~n", [E]) || E <- ets:tab2list(pubsub_node)],
 file:close(Fd).

If you don't have valuable content in the old pubsub table, you can start ejabberd, delete the table (in WebAdmin -> Nodes -> your node -> Database -> pubsub_node Delete table), and restart ejabberd.

After upgrading ejabberd

After upgrading ejabberd 2.0.3 to 2.1.0 I have deleted the directory /var/lib/ejabberd/ebin. But after deleting pubsub_node table through Webmin , error is gone. The table has been recreated after restart. Thanks for help.

Forbidden errors

I am also receiving forbidden errors after upgrading from a subversion release of ejabberd 2.1. I don't see the same error as you in the log so it appears the tables updated smoothly. Unfortunately, I don't have the option of reseting the tables (I'm assuming I would lose all of my PubSub data if I did that). Does anyone have any other tips?

Syndicate content