Bug 1189082 - tail_messages: No such file or directory: '/var/run/fedmsg/crl.pem'
Summary: tail_messages: No such file or directory: '/var/run/fedmsg/crl.pem'
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: fedmsg
Version: 22
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ralph Bean
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-02-04 12:19 UTC by Mikolaj Izdebski
Modified: 2015-03-10 00:54 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-03-09 18:01:47 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Mikolaj Izdebski 2015-02-04 12:19:15 UTC
Description of problem:
koschei-watcher.service has recently died with the following error:

Traceback (most recent call last):
File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/lib/python2.7/site-packages/koschei/main.py", line 41, in <module>
service().run_service()
File "/usr/lib/python2.7/site-packages/koschei/service.py", line 61, in run_service
self.main()
File "/usr/lib/python2.7/site-packages/koschei/watcher.py", line 91, in main
for _, _, topic, msg in self.fedmsg.tail_messages():
File "/usr/lib/python2.7/site-packages/fedmsg/core.py", line 374, in tail_messages
if not validate or fedmsg.crypto.validate(msg, **self.c):
File "/usr/lib/python2.7/site-packages/fedmsg/crypto/__init__.py", line 245, in validate
return backend.validate(message, **cfg)
File "/usr/lib/python2.7/site-packages/fedmsg/crypto/x509.py", line 144, in validate
crl = M2Crypto.X509.load_crl(crl)
File "/usr/lib64/python2.7/site-packages/M2Crypto/X509.py", line 1097, in load_crl
f=BIO.openfile(file)
File "/usr/lib64/python2.7/site-packages/M2Crypto/BIO.py", line 186, in openfile
return File(open(filename, mode))
IOError: [Errno 2] No such file or directory: '/var/run/fedmsg/crl.pem'

Comment 1 Michael Simacek 2015-02-10 10:10:11 UTC
Can you provide more detail when it happened?
at startup or after some time?
which koschei version?
on fedora cloud machine or locally?
is it reproducible?

Koschei just calls fedmsg's public API. It doesn't provide it any configuration, fedmsg loads it's global configration in /etc/fedmsg.d. Such error seems to be caused by misconfigured fedmsg, which is outside of koschei's scope.
I just tried it with default configuration that's in fedora 21 and it seems to work properly.

Comment 2 Mikolaj Izdebski 2015-02-10 10:13:34 UTC
(In reply to Michael Simacek from comment #1)
> Can you provide more detail when it happened?
> at startup or after some time?

After some time koschei-watcher.service just died.

> which koschei version?
> on fedora cloud machine or locally?

It was in production on koschei.cloud.fedoraproject.org. I think it was latest upstream version.

> is it reproducible?

No, I didn't see it again.

Comment 3 Michael Simacek 2015-02-10 13:46:14 UTC
I found the problem in fedmsg, reassingnig.
Description of the problem:
In fedmsg.crypt._load_remote_certs, when there is a network failure and the certificate hasn't been downloaded yet, it ignores the error and returns the path as if it was there. This causes the failure later, because the file doesn't exist and raises IOError. IOErrors cannot be reliably handled by the client application, because it has no idea what kind of error it is, therefore cannot simply restart itself.

Expected result:
If there is a network error and there's no cached version of a certificate, it should raise more specific exception, so that the application can determine it was a network failure and act appropriately.

Additional question:
If it's been running for longer time as the original report says, why there wasn't a cached file already?

Comment 4 Ralph Bean 2015-02-10 14:29:28 UTC
How about this for a solution?  Have fedmsg re-raise the original `requests.exceptions.ConnectionError` during the call to `fedmsg.crypto.validate(msg, **config)`:


diff --git a/fedmsg/crypto/x509.py b/fedmsg/crypto/x509.py
index f15f183..4d02f5f 100644
--- a/fedmsg/crypto/x509.py
+++ b/fedmsg/crypto/x509.py
@@ -246,7 +246,8 @@ def _load_remote_cert(location, cache, cache_expiry, **config):
             with open(cache, 'w') as f:
                 f.write(response.content)
         except requests.exceptions.ConnectionError:
-            log.warn("Could not access %r" % location)
+            log.error("Could not access %r" % location)
+            raise
         except IOError as e:
             # If we couldn't write to the specified cache location, try a
             # similar place but inside our home directory instead.


I'll wait for feedback before committing and preparing a release.

Comment 5 Michael Simacek 2015-02-10 15:00:27 UTC
(In reply to Ralph Bean from comment #4)
> How about this for a solution?  Have fedmsg re-raise the original
> `requests.exceptions.ConnectionError` during the call to
> `fedmsg.crypto.validate(msg, **config)

ConnectionError should be fine.

> 
> 
> diff --git a/fedmsg/crypto/x509.py b/fedmsg/crypto/x509.py
> index f15f183..4d02f5f 100644
> --- a/fedmsg/crypto/x509.py
> +++ b/fedmsg/crypto/x509.py
> @@ -246,7 +246,8 @@ def _load_remote_cert(location, cache, cache_expiry,
> **config):
>              with open(cache, 'w') as f:
>                  f.write(response.content)
>          except requests.exceptions.ConnectionError:
> -            log.warn("Could not access %r" % location)
> +            log.error("Could not access %r" % location)
> +            raise
>          except IOError as e:
>              # If we couldn't write to the specified cache location, try a
>              # similar place but inside our home directory instead.
> 
> 
> I'll wait for feedback before committing and preparing a release.

Comment 6 Ralph Bean 2015-02-10 16:34:45 UTC
Upstream:  https://github.com/fedora-infra/fedmsg/pull/316

Comment 7 Fedora Update System 2015-02-10 17:54:33 UTC
fedmsg-0.12.0-1.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/fedmsg-0.12.0-1.fc21

Comment 8 Fedora Update System 2015-02-10 17:54:46 UTC
fedmsg-0.12.0-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/fedmsg-0.12.0-1.fc20

Comment 9 Fedora Update System 2015-02-10 17:54:57 UTC
fedmsg-0.12.0-1.el7 has been submitted as an update for Fedora EPEL 7.
https://admin.fedoraproject.org/updates/fedmsg-0.12.0-1.el7

Comment 10 Fedora Update System 2015-02-10 17:55:09 UTC
fedmsg-0.12.0-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/fedmsg-0.12.0-1.el6

Comment 11 Ralph Bean 2015-02-10 19:07:25 UTC
And.. it's in the infra repo now, too.

Comment 12 Fedora Update System 2015-02-19 19:59:53 UTC
fedmsg-0.12.1-1.el7 has been submitted as an update for Fedora EPEL 7.
https://admin.fedoraproject.org/updates/fedmsg-0.12.1-1.el7

Comment 13 Fedora Update System 2015-02-19 20:01:13 UTC
fedmsg-0.12.1-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/fedmsg-0.12.1-1.el6

Comment 14 Fedora Update System 2015-02-19 20:01:31 UTC
fedmsg-0.12.1-1.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/fedmsg-0.12.1-1.fc21

Comment 15 Fedora Update System 2015-02-19 20:01:47 UTC
fedmsg-0.12.1-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/fedmsg-0.12.1-1.fc20

Comment 16 Fedora Update System 2015-02-19 21:03:50 UTC
fedmsg-0.12.2-1.el7 has been submitted as an update for Fedora EPEL 7.
https://admin.fedoraproject.org/updates/fedmsg-0.12.2-1.el7

Comment 17 Fedora Update System 2015-02-19 21:04:04 UTC
fedmsg-0.12.2-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/fedmsg-0.12.2-1.el6

Comment 18 Jaroslav Reznik 2015-03-03 17:17:51 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle.
Changing version to '22'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora22

Comment 19 Fedora Update System 2015-03-09 16:59:43 UTC
fedmsg-0.12.2-1.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 20 Fedora Update System 2015-03-09 16:59:57 UTC
fedmsg-0.12.2-1.el7 has been pushed to the Fedora EPEL 7 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 21 Fedora Update System 2015-03-10 00:54:23 UTC
fedmsg-0.12.1-1.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 22 Fedora Update System 2015-03-10 00:54:49 UTC
fedmsg-0.12.1-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.