#292 Don't delete string_types on reimport again
Closed by mikem. Opened by tkopecek.
tkopecek/koji pgsql-double-import  into  master

Download 292.patch

It seems that difference in import koji.db versus import db inside can lead to code called twice and resulting in KeyError when deleting these values in some xmlrpc calls. Pasting as PR here to not forget solve it. I'll look more if I'm able to hunt it down as now it doesn't seem to be totally deterministic.

Looks fine as a workaround.

From the description, it sounds like there is more you want to do (perhaps fix the double import altogether). If so, we should file an issue for that

I've been looking to it more today. I'm not able to reproduce it on F25 anymore. So it could be related to python-requests/python-urllib3 upgrade issue mentioned on koji-devel. Not sure if we want to look for cause anymore. I'm adding original traceback (F24) + xmlrpc error just after that.

 [Thu Jan 19 13:07:20.485913 2017] [wsgi:error] [pid 3315] [client 192.168.122.71:56070] Traceback (most recent call last):
 [Thu Jan 19 13:07:20.485926 2017] [wsgi:error] [pid 3315] [client 192.168.122.71:56070]   File "/usr/share/koji-hub/kojixmlrpc.py", line 37, in <module>
 [Thu Jan 19 13:07:20.486060 2017] [wsgi:error] [pid 3315] [client 192.168.122.71:56070]     import koji.db
 [Thu Jan 19 13:07:20.486067 2017] [wsgi:error] [pid 3315] [client 192.168.122.71:56070]   File "/usr/lib/python2.7/site-packages/koji/db.py", line 29, in <module>
 [Thu Jan 19 13:07:20.486107 2017] [wsgi:error] [pid 3315] [client 192.168.122.71:56070]     del psycopg2.extensions.string_types[1114]
 [Thu Jan 19 13:07:20.486119 2017] [wsgi:error] [pid 3315] [client 192.168.122.71:56070] KeyError: 1114
 [Thu Jan 19 13:07:20.491021 2017] [wsgi:error] [pid 3103] 490 [ERROR] m=index u=None p=3103 r=192.168.122.1:44696 koji.web: Traceback (most recent call last):
 [Thu Jan 19 13:07:20.491037 2017] [wsgi:error] [pid 3103]   File "/usr/share/koji-web/scripts/wsgi_publisher.py", line 387, in handle_request
 [Thu Jan 19 13:07:20.491039 2017] [wsgi:error] [pid 3103]     result = func(environ, **data)
 [Thu Jan 19 13:07:20.491041 2017] [wsgi:error] [pid 3103]   File "/usr/share/koji-web/scripts/index.py", line 278, in index
 [Thu Jan 19 13:07:20.491042 2017] [wsgi:error] [pid 3103]     queryOpts={'order': '-build_id', 'limit': 10}
 [Thu Jan 19 13:07:20.491044 2017] [wsgi:error] [pid 3103]   File "/usr/lib/python2.7/site-packages/koji/__init__.py", line 1945, in __call__
 [Thu Jan 19 13:07:20.491050 2017] [wsgi:error] [pid 3103]     return self.__func(self.__name, args, opts)
 [Thu Jan 19 13:07:20.491051 2017] [wsgi:error] [pid 3103]   File "/usr/lib/python2.7/site-packages/koji/__init__.py", line 2364, in _callMethod
 [Thu Jan 19 13:07:20.491053 2017] [wsgi:error] [pid 3103]     return self._sendCall(handler, headers, request)
 [Thu Jan 19 13:07:20.491054 2017] [wsgi:error] [pid 3103]   File "/usr/lib/python2.7/site-packages/koji/__init__.py", line 2278, in _sendCall
 [Thu Jan 19 13:07:20.491055 2017] [wsgi:error] [pid 3103]     return self._sendOneCall(handler, headers, request)
 [Thu Jan 19 13:07:20.491057 2017] [wsgi:error] [pid 3103]   File "/usr/lib/python2.7/site-packages/koji/__init__.py", line 2325, in _sendOneCall
 [Thu Jan 19 13:07:20.491058 2017] [wsgi:error] [pid 3103]     ret = self._read_xmlrpc_response(r)
 [Thu Jan 19 13:07:20.491059 2017] [wsgi:error] [pid 3103]   File "/usr/lib/python2.7/site-packages/koji/__init__.py", line 2338, in _read_xmlrpc_response
 [Thu Jan 19 13:07:20.491060 2017] [wsgi:error] [pid 3103]     p.feed(chunk)
 [Thu Jan 19 13:07:20.491061 2017] [wsgi:error] [pid 3103]   File "/usr/lib64/python2.7/xmlrpclib.py", line 558, in feed
 [Thu Jan 19 13:07:20.491063 2017] [wsgi:error] [pid 3103]     self._parser.Parse(data, 0)
 [Thu Jan 19 13:07:20.491064 2017] [wsgi:error] [pid 3103] ExpatError: syntax error: line 1, column 49

I have just run into same issue on F25. As it seems to be only potentially problematic part in db.py I would merge it.

An alternate solution: PR #347

Pull-Request has been closed by mikem

Metadata