Bug 1066321 - exception raised in python callbacks are ignored
Summary: exception raised in python callbacks are ignored
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: librepo
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Tomas Mlcoch
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-02-18 09:09 UTC by Ales Kozumplik
Modified: 2014-09-30 23:42 UTC (History)
2 users (show)

Fixed In Version: librepo-1.6.0-1.fc20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-03-06 08:19:08 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Ales Kozumplik 2014-02-18 09:09:01 UTC
hi, plaese see the sample below. the RuntimeError is never observed. I would expect it to be (as soon as possible) propagated outside of the download_packages() call. We don't want to have failing code silently rotting somewhere.

#! /usr/bin/python

import librepo

URL = 'http://mirrors.fedoraproject.org/metalink?repo=updates-released-f19&arch=x86_64'

def progress(*args):
    print(args)
    raise RuntimeError('some')

def main():
    h = librepo.Handle()
    h.setopt(librepo.LRO_MIRRORLIST, URL)
    h.repotype = librepo.LR_YUMREPO
    h.destdir = './'
    r = librepo.Result()
    h.interruptible = True
    h.connecttimeout = 1

    target = librepo.PackageTarget("texlive-collection-pstricks-svn30307.0-0.1.20130608_r30832.fc19.noarch.rpm",
                                   handle=h,
                                   progresscb=progress,
                                   cbdata="tyeah")
    librepo.download_packages([target])

if __name__ == '__main__':
    main()

Comment 1 Tomas Mlcoch 2014-02-18 16:01:07 UTC
Fix just pushed to HEAD.

During tomorrow I will add few more fixes and make a build.

Comment 2 Ales Kozumplik 2014-02-18 16:47:45 UTC
Looking at the fix I don't think it's going to show the traceback on an uncaught exception though, yes? Ideally, the Python layer should just transparently propagate the original exception up, either to be caught or let uncaught so we get the traceback.

Comment 3 Tomas Mlcoch 2014-02-19 13:04:50 UTC
In the original patch, there was missing proper "exception propagation" mechanism for the Handle.perform() method (but download_packages() was working properly).

Now, this is fixed and all uncaught exceptions are propagated properly from all functions that can call python callbacks (Handle.perform(), download_packages(), etc.).

Comment 4 Ales Kozumplik 2014-02-19 20:21:58 UTC
Excellent, thank you Tomas!

Comment 5 Fedora Update System 2014-02-25 08:38:57 UTC
librepo-1.6.0-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/librepo-1.6.0-1.fc20

Comment 6 Fedora Update System 2014-02-26 14:00:08 UTC
Package librepo-1.6.0-1.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing librepo-1.6.0-1.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-3120/librepo-1.6.0-1.fc20
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2014-03-06 08:19:08 UTC
librepo-1.6.0-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.