Bug 39604 - Check for already allocated ports
Check for already allocated ports
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: App Center
UCS 4.1
Other Linux
: P5 normal (vote)
: UCS 4.1
Assigned To: Arvid Requate
Stefan Gohmann
: interim-2
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2015-10-21 06:03 CEST by Stefan Gohmann
Modified: 2015-11-17 12:12 CET (History)
1 user (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Gohmann univentionstaff 2015-10-21 06:03:04 CEST
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.
Comment 1 Arvid Requate univentionstaff 2015-10-21 21:27:37 CEST
The Code now scans for the next free port dynamically.
Changelog entry not required.
Comment 2 Dirk Wiesenthal univentionstaff 2015-10-22 23:49:39 CEST
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
Comment 4 Arvid Requate univentionstaff 2015-10-23 10:39:12 CEST
Fixed.
Comment 5 Stefan Gohmann univentionstaff 2015-10-28 09:30:29 CET
OK, it works in my tests. I've added a simple test case: 80_docker/79_app_ports_already_used
Comment 6 Stefan Gohmann univentionstaff 2015-11-17 12:12:38 CET
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".