Univention Bugzilla – Bug 39604
Check for already allocated ports
Last modified: 2015-11-17 12:12:38 CET
In case of an problem, I often see subsequent faults like this: (2015-10-20 21:06:32.417956)Error response from daemon: Cannot restart container 1babd3c2c680dd6ccb941991d7afcc7550da31b496e93b6c120df36218cac577: Bind for 0.0.0.0:40023 failed: port is already allocated Maybe the App Center can check if the port is already used and use the next free port.
The Code now scans for the next free port dynamically. Changelog entry not required.
Saw this when opening the App Center 1248 actions.register 15-10-22 13:57:39 [ ERROR]: local variable 'next_port' referenced before assignment Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/__init__.py", line 182, in call_with_namespace result = self.main(namespace) File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/register.py", line 75, in main self._register_app_for_apps(apps, args) File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/register.py", line 246, in _register_app_for_apps updates.update(self._register_app(app, args, ucr, lo, pos, delay=True)) File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/register.py", line 265, in _register_app updates.update(self._register_docker_variables(app, ucr)) File "/usr/lib/pymodules/python2.7/univention/appcenter/actions/register.py", line 330, in _register_docker_variables ports_taken.add(next_port) UnboundLocalError: local variable 'next_port' referenced before assignment
See also here http://jenkins.knut.univention.de:8080/job/UCS-4.1/job/UCS-4.1-0/job/Autotest%20MultiEnv/73/SambaVersion=s4,Systemrolle=backup/testReport/80_docker/64_app_container_upgrade/test/
Fixed.
OK, it works in my tests. I've added a simple test case: 80_docker/79_app_ports_already_used
UCS 4.1 has been released: https://docs.software-univention.de/release-notes-4.1-0-en.html https://docs.software-univention.de/release-notes-4.1-0-de.html If this error occurs again, please use "Clone This Bug".