Change in osmo-trx[master]: UHDDevice: catch LookupError/IndexError in set{Rx, Tx}Antenna()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

fixeria gerrit-no-reply at lists.osmocom.org
Mon Jun 29 10:44:06 UTC 2020


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-trx/+/19040 )


Change subject: UHDDevice: catch LookupError/IndexError in set{Rx,Tx}Antenna()
......................................................................

UHDDevice: catch LookupError/IndexError in set{Rx,Tx}Antenna()

Currently configuring 3 channels in multi-ARFCN mode makes the
process crash during the Rx/Tx antenna configuration due to
uncaught UHD specific LookupError/IndexError exceptions:

  terminate called after throwing an instance of 'uhd::index_error'
    what():  LookupError: IndexError: multi_usrp:
      TX channel 2 out of range for configured TX frontends

Let's catch them and terminate gracefully.

Change-Id: If66305f2787c6292375e4bfbd60c1d3d764cffd4
Related: OS#4636
---
M Transceiver52M/device/uhd/UHDDevice.cpp
1 file changed, 16 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/40/19040/1

diff --git a/Transceiver52M/device/uhd/UHDDevice.cpp b/Transceiver52M/device/uhd/UHDDevice.cpp
index d1f61d3..57ac0ce 100644
--- a/Transceiver52M/device/uhd/UHDDevice.cpp
+++ b/Transceiver52M/device/uhd/UHDDevice.cpp
@@ -1094,7 +1094,14 @@
 		return false;
 	}
 
-	avail = usrp_dev->get_rx_antennas(chan);
+	/* UHD may throw a LookupError/IndexError here (see OS#4636) */
+	try {
+		avail = usrp_dev->get_rx_antennas(chan);
+	} catch (const uhd::index_error &e) {
+		LOGC(DDEV, ALERT) << "UHD Error: " << e.what();
+		return false;
+	}
+
 	if (std::find(avail.begin(), avail.end(), ant) == avail.end()) {
 		LOGC(DDEV, ALERT) << "Requested non-existent Rx antenna " << ant << " on channel " << chan;
 		LOGC(DDEV, INFO) << "Available Rx antennas: ";
@@ -1130,7 +1137,14 @@
 		return false;
 	}
 
-	avail = usrp_dev->get_tx_antennas(chan);
+	/* UHD may throw a LookupError/IndexError here (see OS#4636) */
+	try {
+		avail = usrp_dev->get_tx_antennas(chan);
+	} catch (const uhd::index_error &e) {
+		LOGC(DDEV, ALERT) << "UHD Error: " << e.what();
+		return false;
+	}
+
 	if (std::find(avail.begin(), avail.end(), ant) == avail.end()) {
 		LOGC(DDEV, ALERT) << "Requested non-existent Tx antenna " << ant << " on channel " << chan;
 		LOGC(DDEV, INFO) << "Available Tx antennas: ";

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/19040
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: If66305f2787c6292375e4bfbd60c1d3d764cffd4
Gerrit-Change-Number: 19040
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200629/15bf0551/attachment.htm>


More information about the gerrit-log mailing list