mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-13 22:42:29 +03:00
build: close ssh_channel upon timeout
The build can get stuck when running into the timeout and paramiko not noticing it. This can be reproduced by setting a small build timeout for an app. I tried setting set_keepalive() but it did not help. This forcefully closes the ssh channel to the VM so the fdroid build will continue. As we destroy the VM in the next step anyhow I think this is fine.
This commit is contained in:
parent
5e08187567
commit
a6700e65ed
1 changed files with 4 additions and 1 deletions
|
@ -49,6 +49,7 @@ except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
buildserverid = None
|
buildserverid = None
|
||||||
|
ssh_channel = None
|
||||||
|
|
||||||
|
|
||||||
# Note that 'force' here also implies test mode.
|
# Note that 'force' here also implies test mode.
|
||||||
|
@ -68,7 +69,7 @@ def build_server(app, build, vcs, build_dir, output_dir, log_dir, force):
|
||||||
target folder for the build result
|
target folder for the build result
|
||||||
force
|
force
|
||||||
"""
|
"""
|
||||||
global buildserverid
|
global buildserverid, ssh_channel
|
||||||
|
|
||||||
try:
|
try:
|
||||||
paramiko
|
paramiko
|
||||||
|
@ -892,6 +893,8 @@ def force_halt_build(timeout):
|
||||||
"""Halt the currently running Vagrant VM, to be called from a Timer."""
|
"""Halt the currently running Vagrant VM, to be called from a Timer."""
|
||||||
logging.error(_('Force halting build after {0} sec timeout!').format(timeout))
|
logging.error(_('Force halting build after {0} sec timeout!').format(timeout))
|
||||||
timeout_event.set()
|
timeout_event.set()
|
||||||
|
if ssh_channel:
|
||||||
|
ssh_channel.close()
|
||||||
vm = vmtools.get_build_vm('builder')
|
vm = vmtools.get_build_vm('builder')
|
||||||
vm.destroy()
|
vm.destroy()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue