[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH:di-autobuild] buildscript: Detect running sessions to avoid spawning a new one



An apt hang was spotted during d-i's build (through daily build crontab
entries), and even if the immediate issue is going away (I killed all
schroot sessions manually, and apt now returns an issue instead of
hanging forever), it might be nice to try and detect when a session
already exists, to avoid starting too many of them. The following patch,
tested on barriere, seems to do the trick.

---
 buildscript | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/buildscript b/buildscript
index f787db4..8166bb3 100755
--- a/buildscript
+++ b/buildscript
@@ -87,6 +87,12 @@ cleanup () {
 }
 
 create_session() {
+  echo "INFO: checking for running sessions"
+  if schroot-list-sessions | grep "^sid_${ARCH}-dchroot"; then
+    echo "ERROR: Existing sessions found, aborting"
+    exit 1
+  fi
+
   echo "INFO: creating schroot"
   SID="$(schroot -b -c chroot:sid_${ARCH}-dchroot)"
   echo "INFO: session $SID created"
-- 
2.1.4


Reply to: