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/.

pespin gerrit-no-reply at lists.osmocom.org
Mon Jun 29 12:43:06 UTC 2020


pespin has submitted this change. ( 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(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/Transceiver52M/device/uhd/UHDDevice.cpp b/Transceiver52M/device/uhd/UHDDevice.cpp
index 0eb79fc..854ed2e 100644
--- a/Transceiver52M/device/uhd/UHDDevice.cpp
+++ b/Transceiver52M/device/uhd/UHDDevice.cpp
@@ -1097,7 +1097,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: ";
@@ -1133,7 +1140,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: 2
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200629/9912ef54/attachment.htm>


More information about the gerrit-log mailing list