Univention Bugzilla – Attachment 9005 Details for
Bug 34648
Invalid pickle files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
34648-s4c-pickle-error-handling-421.patch
34648-s4c-pickle-error-handling-421.patch (text/plain), 2.56 KB, created by
Lukas Oyen
on 2017-07-10 08:57 CEST
(
hide
)
Description:
34648-s4c-pickle-error-handling-421.patch
Filename:
MIME Type:
Creator:
Lukas Oyen
Created:
2017-07-10 08:57 CEST
Size:
2.56 KB
patch
obsolete
>From 78b07506025c71c2cffcd7032961973798ea9690 Mon Sep 17 00:00:00 2001 >From: Lukas Oyen <oyen@univention.de> >Date: Thu, 6 Jul 2017 14:13:09 +0200 >Subject: [PATCH] Bug #34648: s4c: ignore corrupted pickle files > >--- > .../modules/univention/s4connector/__init__.py | 31 +++++++++++++++------- > 1 file changed, 22 insertions(+), 9 deletions(-) > >diff --git a/services/univention-s4-connector/modules/univention/s4connector/__init__.py b/services/univention-s4-connector/modules/univention/s4connector/__init__.py >index 8eb38c4..51e19d8 100644 >--- a/services/univention-s4-connector/modules/univention/s4connector/__init__.py >+++ b/services/univention-s4-connector/modules/univention/s4connector/__init__.py >@@ -704,12 +704,19 @@ class ucs: > ''' > sync changes from UCS stored in given file > ''' >- try: >- f = file(filename, 'r') >- except IOError: # file not found so there's nothing to sync >- return True > >- dn, new, old, old_dn = cPickle.load(f) >+ try: >+ with open(filename) as fob: >+ (dn, new, old, old_dn) = cPickle.load(fob) >+ except IOError: >+ return True # file not found so there's nothing to sync >+ except (cPickle.UnpicklingError, EOFError) as e: >+ message = 'file emtpy' if isinstance(e, EOFError) else e.message >+ ud.debug(ud.LDAP, ud.WARN, >+ '__sync_file_from_ucs: invalid pickle file {}: {}'.format(filename, message)) >+ # ignore corrupted pickle file, but safe as rejected to not try again >+ self._save_rejected_ucs(filename, 'unknown') >+ return False > > if dn == 'cn=Subschema': > return True >@@ -1037,12 +1044,18 @@ class ucs: > if not filename == "%s/tmp" % self.baseConfig['%s/s4/listener/dir' % self.CONFIGBASENAME]: > if filename not in self.rejected_files: > try: >- f = file(filename, 'r') >- except IOError: # file not found so there's nothing to sync >+ with open(filename) as fob: >+ (dn, new, old, old_dn) = cPickle.load(fob) >+ except IOError: >+ continue # file not found so there's nothing to sync >+ except (cPickle.UnpicklingError, EOFError) as e: >+ message = 'file emtpy' if isinstance(e, EOFError) else e.message >+ ud.debug(ud.LDAP, ud.WARN, >+ 'poll_ucs: invalid pickle file {}: {}'.format(filename, message)) >+ # ignore corrupted pickle file, but safe as rejected to not try again >+ self._save_rejected_ucs(filename, 'unknown') > continue > >- dn, new, old, old_dn = cPickle.load(f) >- > for i in [0, 1]: # do it twice if the LDAP connection was closed > try: > sync_successfull = self.__sync_file_from_ucs(filename, traceback_level=traceback_level) >-- >2.7.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 34648
: 9005 |
9148
|
9166
|
9167