From 1c92b5d2ea5cc10e85c8fd304b330f0a43030ef9 Mon Sep 17 00:00:00 2001 From: jobevers Date: Thu, 26 Jan 2017 10:01:03 -0600 Subject: [PATCH 1/4] retry startup --- lbrynet/lbrynet_daemon/DaemonControl.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/lbrynet/lbrynet_daemon/DaemonControl.py b/lbrynet/lbrynet_daemon/DaemonControl.py index 89535fe3d..db36b6687 100644 --- a/lbrynet/lbrynet_daemon/DaemonControl.py +++ b/lbrynet/lbrynet_daemon/DaemonControl.py @@ -114,7 +114,7 @@ def update_settings_from_args(args): @defer.inlineCallbacks -def start_server_and_listen(launchui, use_auth, analytics_manager): +def start_server_and_listen(launchui, use_auth, analytics_manager, max_tries=5): """The primary entry point for launching the daemon. Args: @@ -124,13 +124,19 @@ def start_server_and_listen(launchui, use_auth, analytics_manager): """ analytics_manager.send_server_startup() log_support.configure_analytics_handler(analytics_manager) - try: - daemon_server = DaemonServer(analytics_manager) - yield daemon_server.start(use_auth, launchui) - analytics_manager.send_server_startup_success() - except Exception as e: - log.exception('Failed to startup') - analytics_manager.send_server_startup_error(str(e)) + tries = 1 + while tries < max_tries: + log.info('Making attempt %s / %s to startup', tries, max_tries) + try: + daemon_server = DaemonServer(analytics_manager) + yield daemon_server.start(use_auth, launchui) + analytics_manager.send_server_startup_success() + break + except Exception as e: + log.exception('Failed to startup') + analytics_manager.send_server_startup_error(str(e)) + tries += 1 + else: reactor.callFromThread(reactor.stop) From f989814e696af3d93776c616ff27ecba5428d0c3 Mon Sep 17 00:00:00 2001 From: jobevers Date: Sat, 11 Feb 2017 09:33:06 -0600 Subject: [PATCH 2/4] catch Unknownnameerror for resolve_name Its expected behavior that a name won't resolve so this more gracefully handles that case --- CHANGELOG.md | 3 ++- lbrynet/lbrynet_daemon/Daemon.py | 33 ++++++++++++++++++-------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eade334dc..6449808b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ at anytime. ## [Unreleased] ### Fixed * Add better logging to help track down [#478](https://github.com/lbryio/lbry/issues/478) - + * Catch UnknownNameErrors when resolving a name. [#479](https://github.com/lbryio/lbry/issues/479) ## [0.8.3rc3] - 2017-02-14 @@ -25,6 +25,7 @@ at anytime. * mark peers as down if it fails download protocol * Made hash reannounce time to be adjustable to fix [#432](https://github.com/lbryio/lbry/issues/432) + ## [0.8.3rc0] - 2017-02-10 ### Changed * Convert EncryptedFileDownloader to inlineCallbacks diff --git a/lbrynet/lbrynet_daemon/Daemon.py b/lbrynet/lbrynet_daemon/Daemon.py index fc1a34e58..d793456ec 100644 --- a/lbrynet/lbrynet_daemon/Daemon.py +++ b/lbrynet/lbrynet_daemon/Daemon.py @@ -45,7 +45,7 @@ from lbrynet.core.Wallet import LBRYumWallet, SqliteStorage from lbrynet.core.looping_call_manager import LoopingCallManager from lbrynet.core.server.BlobRequestHandler import BlobRequestHandlerFactory from lbrynet.core.server.ServerProtocol import ServerProtocolFactory -from lbrynet.core.Error import InsufficientFundsError +from lbrynet.core.Error import InsufficientFundsError, UnknownNameError log = logging.getLogger(__name__) @@ -938,14 +938,14 @@ class Daemon(AuthJSONRPCServer): fee_amount = 0.0 if fee is None else fee.amount return data_cost + fee_amount + @defer.inlineCallbacks def get_est_cost_from_name(self, name): """ Resolve a name and return the estimated stream cost """ - - d = self._resolve_name(name) - d.addCallback(self._get_est_cost_from_metadata, name) - return d + metadata = yield self._resolve_name(name) + cost = yield self._get_est_cost_from_metadata(metadata, name) + defer.returnValue(cost) def get_est_cost(self, name, size=None): """Get a cost estimate for a lbry stream, if size is not provided the @@ -1404,6 +1404,7 @@ class Daemon(AuthJSONRPCServer): else: return self._get_lbry_file(searchtype, value) + @defer.inlineCallbacks def jsonrpc_resolve_name(self, name, force=False): """ Resolve stream info from a LBRY uri @@ -1411,15 +1412,20 @@ class Daemon(AuthJSONRPCServer): Args: 'name': name to look up, string, do not include lbry:// prefix Returns: - metadata from name claim + metadata from name claim or None if the name is not known """ if not name: - return self._render_response(None) + # TODO: seems like we should raise an error here + defer.returnValue(None) - d = self._resolve_name(name, force_refresh=force) - d.addCallback(self._render_response) - return d + try: + metadata = yield self._resolve_name(name, force_refresh=force) + except UnknownNameError: + log.info('Name %s is not known', name) + defer.returnValue(None) + else: + defer.returnValue(metadata) def jsonrpc_get_claim_info(self, **kwargs): """ @@ -1619,6 +1625,7 @@ class Daemon(AuthJSONRPCServer): """ return self.jsonrpc_stream_cost_estimate(**kwargs) + @defer.inlineCallbacks def jsonrpc_stream_cost_estimate(self, name, size=None): """ Get estimated cost for a lbry stream @@ -1629,10 +1636,8 @@ class Daemon(AuthJSONRPCServer): Returns: estimated cost """ - - d = self.get_est_cost(name, size) - d.addCallback(lambda r: self._render_response(r)) - return d + cost = yield self.get_est_cost(name, size) + defer.returnValue(cost) @AuthJSONRPCServer.auth_required def jsonrpc_publish(self, name, bid, metadata, file_path=None, fee=None): From 287e62b71b8ad70969d032a3d42eceec41260930 Mon Sep 17 00:00:00 2001 From: jobevers Date: Wed, 15 Feb 2017 12:54:33 -0600 Subject: [PATCH 3/4] bump lbryum version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index bd705a7d9..f34a2e54a 100644 --- a/setup.py +++ b/setup.py @@ -43,7 +43,7 @@ requires = [ 'jsonrpc==1.2', 'jsonrpclib==0.1.7', 'jsonschema==2.5.1', - 'lbryum>=2.7.4', + 'lbryum>=2.7.5', 'loggly-python-handler==1.0.0', 'miniupnpc==1.9', 'pbkdf2==1.3', From 8452620f994fdf8df5dc54918f9b447cfa4bfcbd Mon Sep 17 00:00:00 2001 From: jobevers Date: Wed, 15 Feb 2017 16:29:40 -0600 Subject: [PATCH 4/4] =?UTF-8?q?Bump=20version:=200.8.3rc3=20=E2=86=92=200.?= =?UTF-8?q?8.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.cfg | 2 +- CHANGELOG.md | 2 ++ lbrynet/__init__.py | 2 +- packaging/ubuntu/lbry.desktop | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index fd98dd5fd..2ebd2237e 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.8.3rc3 +current_version = 0.8.3 commit = True tag = True parse = (?P\d+)\.(?P\d+)\.(?P\d+)((?P[a-z]+)(?P\d+))? diff --git a/CHANGELOG.md b/CHANGELOG.md index 6449808b4..4ca991821 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ can and probably will change functionality and break backwards compatability at anytime. ## [Unreleased] + +## [0.8.3] - 2017-02-15 ### Fixed * Add better logging to help track down [#478](https://github.com/lbryio/lbry/issues/478) * Catch UnknownNameErrors when resolving a name. [#479](https://github.com/lbryio/lbry/issues/479) diff --git a/lbrynet/__init__.py b/lbrynet/__init__.py index 90eae59b6..ff1864805 100644 --- a/lbrynet/__init__.py +++ b/lbrynet/__init__.py @@ -1,6 +1,6 @@ import logging -__version__ = "0.8.3rc3" +__version__ = "0.8.3" version = tuple(__version__.split('.')) logging.getLogger(__name__).addHandler(logging.NullHandler()) diff --git a/packaging/ubuntu/lbry.desktop b/packaging/ubuntu/lbry.desktop index a4336a57d..b91a27951 100644 --- a/packaging/ubuntu/lbry.desktop +++ b/packaging/ubuntu/lbry.desktop @@ -1,5 +1,5 @@ [Desktop Entry] -Version=0.8.3rc3 +Version=0.8.3 Name=LBRY Comment=The world's first user-owned content marketplace Icon=lbry