Bug 34234 - opening services module fails: race condition in service_info.py:pidof()
opening services module fails: race condition in service_info.py:pidof()
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UCR
UCS 3.2
Other Linux
: P5 normal (vote)
: UCS 4.2
Assigned To: Philipp Hahn
Florian Best
: interim-1
: 31030 36903 38209 40332 41789 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-03-04 09:53 CET by Florian Best
Modified: 2017-04-04 18:28 CEST (History)
5 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 3: Simply Wrong: The implementation doesn't match the docu
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.069
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Error handling, External feedback
Max CVSS v3 score:
best: Patch_Available+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2014-03-04 09:53:51 CET
Traceback reported by the UMC feedback:
Die Ausführung des Kommandos services/query ist fehlgeschlagen:

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/__init__.py",
line 204, in execute
    func( request )
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/decorators.py",
line 178, in _response
    return function(self, request)
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/decorators.py",
line 305, in _response
    result = _multi_response(self, request)
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/decorators.py",
line 432, in _response
    for res in function(self, iterator, *nones):
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/decorators.py",
line 271, in _fake_func
    yield function(self, *args)
  File
"/usr/lib/pymodules/python2.6/univention/management/console/modules/services/__init__.py",
line 62, in query
    srvs = usi.ServiceInfo()
  File "/usr/lib/pymodules/python2.6/univention/service_info.py", line 106, in __init__
    self.update_services()
  File "/usr/lib/pymodules/python2.6/univention/service_info.py", line 140, in
update_services
    self.__update_status( name, serv )
  File "/usr/lib/pymodules/python2.6/univention/service_info.py", line 132, in
__update_status
    if prog and not pidof( prog.strip() ):
  File "/usr/lib/pymodules/python2.6/univention/service_info.py", line 71, in pidof
    cmd = fd.readline()
IOError: [Errno 3] Kein passender Prozess gefunden

3.2-0 errata61 (Borgfeld)

The problem seems to be a race condition in pidof() in service_info.py line 71:
 70 »   »   fd = open( cmdline )
 71 »   »   cmd = fd.readline()

The function could maybe replaced by some function in psutil from the python stdlib.
This bug should not occur very often.
Comment 1 Florian Best univentionstaff 2014-03-27 09:26:10 CET
Again reported (at Ticket #2014031721003841).
Comment 2 Dirk Wiesenthal univentionstaff 2014-05-27 15:03:43 CEST
Reported again, so it does occur from time to time.

And there is another (probably related) traceback - next line:

 Traceback:
Die Ausführung des Kommandos services/query ist fehlgeschlagen:

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/__init__.py",
line 204, in execute
    func( request )
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/decorators.py",
line 178, in _response
    return function(self, request)
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/decorators.py",
line 305, in _response
    result = _multi_response(self, request)
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/decorators.py",
line 432, in _response
    for res in function(self, iterator, *nones):
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/decorators.py",
line 271, in _fake_func
    yield function(self, *args)
  File
"/usr/lib/pymodules/python2.6/univention/management/console/modules/services/__init__.py",
line 62, in query
    srvs = usi.ServiceInfo()
  File "/usr/lib/pymodules/python2.6/univention/service_info.py", line 106, in __init__
    self.update_services()
  File "/usr/lib/pymodules/python2.6/univention/service_info.py", line 140, in
update_services
    self.__update_status( name, serv )
  File "/usr/lib/pymodules/python2.6/univention/service_info.py", line 132, in
__update_status
    if prog and not pidof( prog.strip() ):
  File "/usr/lib/pymodules/python2.6/univention/service_info.py", line 70, in pidof
    fd = open( cmdline )
IOError: [Errno 2] Datei oder Verzeichnis nicht gefunden: '/proc/21327/cmdline'


3.2-1 errata111 (Borgfeld)
Comment 3 Florian Best univentionstaff 2014-12-15 10:04:28 CET
Reported again: 4.0-0 errata10 (Walle)
Comment 4 Florian Best univentionstaff 2015-05-05 14:53:18 CEST
Reported again, 4.0-1 errata163 (Walle)

  File "%PY2.7%/univention/service_info.py", line 132, in __update_status
    if prog and not pidof( prog.strip() ):
  File "%PY2.7%/univention/service_info.py", line 71, in pidof
    cmd = fd.readline()
IOError: [Errno 3] Kein passender Prozess gefunden
Comment 5 Florian Best univentionstaff 2015-11-30 13:24:14 CET
Reported again, 4.1-0 errata7 (Vahr)
Comment 6 Florian Best univentionstaff 2016-04-21 09:01:11 CEST
Reported again, 4.1-1 errata152 (Vahr)
Remark: Fehlermeldung erscheint nach dem Startversuch des Dienstes
Comment 8 Florian Best univentionstaff 2016-07-14 08:24:39 CEST
*** Bug 41789 has been marked as a duplicate of this bug. ***
Comment 10 Florian Best univentionstaff 2016-09-15 14:19:38 CEST
*** Bug 40332 has been marked as a duplicate of this bug. ***
Comment 11 Florian Best univentionstaff 2016-09-15 14:22:17 CEST
*** Bug 31030 has been marked as a duplicate of this bug. ***
Comment 12 Philipp Hahn univentionstaff 2016-09-16 15:10:16 CEST
r72654 | Bug #34234 ucr: Add comments
r72653 | Bug #34234 ucr: Add debug output
r72652 | Bug #34234 ucr: Move service check into Sevice class
r72651 | Bug #34234 ucr: Protect against concurrent process changes
r72650 | Bug #34234 ucr: Remove broken SysV init code
r72649 | Bug #34234 ucr: Return service
r72648 | Bug #34234 ucr: pyflakes
r72647 | Bug #34234 ucr: autopep8

Package: univention-config-registry
Version: 12.0.0-2A~4.2.0.201609161507
Branch: ucs_4.2-0
Comment 13 Florian Best univentionstaff 2016-09-20 18:16:28 CEST
OK: Code review
OK: exception is catched
OK: All services are still detected correctly (except for those which doesn't event start currently in UCS 4.2).
OK: Changelog
Comment 14 Florian Best univentionstaff 2016-11-08 09:33:22 CET
*** Bug 36903 has been marked as a duplicate of this bug. ***
Comment 15 Florian Best univentionstaff 2017-01-03 15:58:12 CET
*** Bug 38209 has been marked as a duplicate of this bug. ***
Comment 16 Stefan Gohmann univentionstaff 2017-04-04 18:28:11 CEST
UCS 4.2 has been released:
 https://docs.software-univention.de/release-notes-4.2-0-en.html
 https://docs.software-univention.de/release-notes-4.2-0-de.html

If this error occurs again, please use "Clone This Bug".