Bug 30611 - PackageManager may break by UMC Timeout
PackageManager may break by UMC Timeout
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC - App-Center
UCS 3.1
Other Linux
: P3 normal (vote)
: UCS 3.1-1-errata
Assigned To: Dirk Wiesenthal
Felix Botner
:
: 30155 (view as bug list)
Depends on:
Blocks: 31382
  Show dependency treegraph
 
Reported: 2013-02-28 11:46 CET by Dirk Wiesenthal
Modified: 2013-05-22 16:09 CEST (History)
3 users (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 Dirk Wiesenthal univentionstaff 2013-02-28 11:46:03 CET
I installed agorum, which takes some time (read: ages) to install:
"Optimizing: http://localhost:81/roiwebui/**.jsp"

I accidentally closed the browser tab (and did not reconnect). After ten minutes UMC killed the not used (in terms of frontend requests) appcenter module. Agorum was not completely installed at that time.

root@slave92:~# dpkg -l *agorum*
un  agorumcore-open
iF  agorumcore-pro
iU  agorumcore-ucs
iU  univention-management-console-module-agorum

More serious, this behaviour seems to not free dpkg lock:
root@slave92:~# apt-get install 
E: Konnte Sperre /var/lib/dpkg/lock nicht bekommen - open (11: Die Ressource ist zur Zeit nicht verfügbar)
E: Sperren des Administrationsverzeichnisses (/var/lib/dpkg/) nicht möglich, wird es von einem anderen Prozess verwendet?

I did not test it but this may also happen with the long-running UCC download while normally 10 minutes should be sufficient to complete an installation. Nonetheless, this is critical.
Comment 1 Dirk Wiesenthal univentionstaff 2013-02-28 11:48:53 CET
After some time this is possible:

root@slave92:~# dpkg -l *agorum*
un  agorumcore-open
iF  agorumcore-pro
iU  agorumcore-ucs
iU  univention-management-console-module-agorum

root@slave92:~# apt-get install
E: Der dpkg-Prozess wurde unterbrochen; Sie müssen manuell »dpkg --configure -a« ausführen, um das Problem zu beheben.

root@slave92:~# dpkg --configure -a
agorumcore-pro (7.0.3-6) wird eingerichtet ...
[...]

root@slave92:~# dpkg -l *agorum*
un  agorumcore-open
ii  agorumcore-pro
ii  agorumcore-ucs
ii  univention-management-console-module-agorum

Phew. But quite some bug anyway.
Comment 2 Alexander Kläser univentionstaff 2013-03-04 13:54:21 CET
Maybe a solution as suggested in Bug 30155 would make sense here?
Comment 3 Dirk Wiesenthal univentionstaff 2013-03-04 14:09:45 CET
(In reply to comment #2)
> Maybe a solution as suggested in Bug 30155 would make sense here?

Would not fix the underlying problem: If you really log out because you get bored staring at a progress bar the module will get killed by UMC itself.

I would suggest: Either we add a "please_dont_kill_me" flag for each module and the app center sets it while it is installing. Or the PackageManager becomes just an interface for a inter-process communication and a "PackageManagerDaemon" runs all the time accepting queues like installation. This would also fix Bug#30155 if you meant it this way.
Comment 4 Alexander Kläser univentionstaff 2013-03-04 14:27:33 CET
(In reply to comment #3)
> (In reply to comment #2)
> > Maybe a solution as suggested in Bug 30155 would make sense here?
> 
> Would not fix the underlying problem: If you really log out because you get
> bored staring at a progress bar the module will get killed by UMC itself.
> 
> I would suggest: Either we add a "please_dont_kill_me" flag for each module and
> the app center sets it while it is installing. Or the PackageManager becomes
> just an interface for a inter-process communication and a
> "PackageManagerDaemon" runs all the time accepting queues like installation.
> This would also fix Bug#30155 if you meant it this way.

Well, I meant using an AT job (similar to the updater) to start the installation in the background. dont_kill_me flag does not seem to be a reasonable option, it is necessary that the UMC server can eventually kill zombie module processes.
Comment 5 Alexander Kläser univentionstaff 2013-03-18 09:49:25 CET
*** Bug 30155 has been marked as a duplicate of this bug. ***
Comment 6 Alexander Kläser univentionstaff 2013-03-18 09:50:59 CET
From Bug 30155:
> Upon opening the module, the module should check for an ongoing installation,
> and a progressbar should be prompted in that case.

This should be addressed via this bug, as well.
Comment 7 Alexander Kläser univentionstaff 2013-04-05 10:29:25 CEST
Simple workaround: The module process will not be killed (even not after a timeout) if at least one request is still open (c.f. Bug 21888). Therefore, one could leave the initial request open which triggers the installation. If the request is then answered after the installation, this should be fine, then. That means then, as well, that the initial request will probably run in a timeout on the client side.
Comment 8 Dirk Wiesenthal univentionstaff 2013-04-05 11:19:03 CEST
(In reply to comment #7)
> Simple workaround: The module process will not be killed (even not after a
> timeout) if at least one request is still open (c.f. Bug 21888). Therefore, one
> could leave the initial request open which triggers the installation. If the
> request is then answered after the installation, this should be fine, then.
> That means then, as well, that the initial request will probably run in a
> timeout on the client side.

Good point. Although it will probably be more hacky. The initial request is important and has to return something meaningful ("can_continue", "broken", etc). We would need to send another request to, say, appcenter/keep_alive, which does something like that:

def keep_alive(self, request):
  # and all this in a thread because otherwise the module will be blocked
  while not self.package_manager.progress_state._finished:
    time.sleep(1)
  self.finished(request.id, True)

But maybe this can be simplified (initial request does not have to return if can_continue is True) together with Bug#30798
Comment 9 Dirk Wiesenthal univentionstaff 2013-04-08 14:47:24 CEST
(In reply to comment #8)
> def keep_alive(self, request):
>   # and all this in a thread because otherwise the module will be blocked
>   while not self.package_manager.progress_state._finished:
>     time.sleep(1)
>   self.finished(request.id, True)

Done exactly that in (3.1-2):
  univention-management-console-module-appcenter 2.0.142-1.119.201304081444
Comment 10 Dirk Wiesenthal univentionstaff 2013-04-10 20:18:14 CEST
Built for 3.1-1:
  univention-management-console-module-appcenter 2.0.139-2.120.201304102007

Changelog updated, YAML created
Comment 11 Felix Botner univentionstaff 2013-05-16 15:47:58 CEST
(In reply to comment #6)
> From Bug 30155:
> > Upon opening the module, the module should check for an ongoing installation,
> > and a progressbar should be prompted in that case.
> 
> This should be addressed via this bug, as well.

This needs to be done, 
if i start the agorum app installation and then close the browser, open the  browser and logon to the UMC, i can open the appcenter module and start the installation of another app (or agorum again), then weird things happen and i end up with

-> apt-get -f install
E: dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem.
Comment 12 Dirk Wiesenthal univentionstaff 2013-05-16 23:42:53 CEST
(In reply to comment #11)
> This needs to be done, 

Yes, but it is out of scope of this bug. These are two separate problems and I did not find a good sentence for the changelog that covers both issues. Moreover it is easier for QA to verify the bug fix.
Comment 13 Felix Botner univentionstaff 2013-05-17 12:19:07 CEST
OK - set umc/module/timeout=10, started agorum app installation and closed the browser, app was successfully installed

OK - errata3.1-1
OK - YAML

OK - ucs3.1-2
OK - changelog
Comment 14 Moritz Muehlenhoff univentionstaff 2013-05-22 16:09:50 CEST
http://errata.univention.de/ucs/3.1/102.html