Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when changing meta messages on community upgrade #536

Open
devos50 opened this issue Apr 9, 2017 · 1 comment
Open

Error when changing meta messages on community upgrade #536

devos50 opened this issue Apr 9, 2017 · 1 comment
Labels

Comments

@devos50
Copy link
Contributor

devos50 commented Apr 9, 2017

When changing the name of meta messages when modifying an existing community, Dispersy throws an error when initializing this community. I found this out when I was working on the TradeChainCommunity, used in the decentralized market: this TradeChain first used the 'old' MultiChain code but I changed this to the true halves implementation of @Captain-Coder. Between these implementations, several meta messages were removed, however these meta messages were still available in the meta_messages table in the Dispersy database:

2017-04-09T20:19:11+0200 [-] Unhandled Error
	Traceback (most recent call last):
	  File "/Library/Python/2.7/site-packages/twisted/internet/base.py", line 420, in fireEvent
	    DeferredList(beforeResults).addCallback(self._continueFiring)
	  File "/Library/Python/2.7/site-packages/twisted/internet/defer.py", line 319, in addCallback
	    callbackKeywords=kw)
	  File "/Library/Python/2.7/site-packages/twisted/internet/defer.py", line 308, in addCallbacks
	    self._runCallbacks()
	  File "/Library/Python/2.7/site-packages/twisted/internet/defer.py", line 651, in _runCallbacks
	    current.result = callback(current.result, *args, **kw)
	--- <exception caught here> ---
	  File "/Library/Python/2.7/site-packages/twisted/internet/base.py", line 433, in _continueFiring
	    callable(*args, **kwargs)
	  File "/Users/martijndevos/Documents/tribler/twisted/plugins/tribler_plugin.py", line 108, in start_tribler
	    self.session.start().addErrback(lambda failure: self.shutdown_process(failure.getErrorMessage()))
	  File "/Users/martijndevos/Documents/tribler/Tribler/dispersy/util.py", line 46, in helper
	    return blockingCallFromThread(reactor, func, *args, **kargs)
	  File "/Users/martijndevos/Documents/tribler/Tribler/dispersy/util.py", line 225, in blockingCallFromThread
	    return f(*args, **kwargs)
	  File "/Users/martijndevos/Documents/tribler/Tribler/Core/Session.py", line 573, in start
	    startup_deferred = self.lm.register(self, self.sesslock)
	  File "/Users/martijndevos/Documents/tribler/Tribler/Core/APIImplementation/LaunchManyCore.py", line 178, in register
	    self.init()
	  File "/Users/martijndevos/Documents/tribler/Tribler/Core/APIImplementation/LaunchManyCore.py", line 309, in init
	    self.load_communities()
	  File "/Users/martijndevos/Documents/tribler/Tribler/dispersy/util.py", line 46, in helper
	    return blockingCallFromThread(reactor, func, *args, **kargs)
	  File "/Users/martijndevos/Documents/tribler/Tribler/dispersy/util.py", line 225, in blockingCallFromThread
	    return f(*args, **kwargs)
	  File "/Users/martijndevos/Documents/tribler/Tribler/Core/APIImplementation/LaunchManyCore.py", line 267, in load_communities
	    kargs=default_kwargs)
	  File "/Users/martijndevos/Documents/tribler/Tribler/dispersy/dispersy.py", line 413, in define_auto_load
	    community = community_cls.init_community(self, master, my_member, *args, **kargs)
	  File "/Users/martijndevos/Documents/tribler/Tribler/dispersy/community.py", line 226, in init_community
	    community.initialize(*args, **kargs)
	  File "/Users/martijndevos/Documents/tribler/Tribler/community/tradechain/community.py", line 56, in initialize
	    super(TradeChainCommunity, self).initialize()
	  File "/Users/martijndevos/Documents/tribler/Tribler/dispersy/community.py", line 376, in initialize
	    self._meta_messages[name]._database_id = database_id  # cleanup pre-fetched values
	exceptions.KeyError: u'crawl_resume'

It works when I manually remove these messages from the Dispersy database.

I think this can be fixed easily :)

@Captain-Coder
Copy link
Contributor

I'm unsure if I would qualify this as a bug. I would say that it is not expected that future versions of a community ever remove message types. In such cases of incompatibillity, it would have to update the community master member. When you made your trade community from the multichain community, you should have updated the master member key. Even if you inherit from the multichain community, i'd advise a new master member to keep them separated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants