Bug 947388 - interrupting perform() hangs if mirrorlist is used
Summary: interrupting perform() hangs if mirrorlist is used
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: librepo
Version: rawhide
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: 2013-04-02 10:08 UTC by Ales Kozumplik
Modified: 2014-09-30 23:41 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-04-20 19:28:29 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
debug output (9.90 KB, text/plain)
2013-04-04 18:55 UTC, Ales Kozumplik
no flags Details

Description Ales Kozumplik 2013-04-02 10:08:47 UTC
Pressing ctrl-c after the download starts in the following program hangs perform() approximately once every five attempts on my machine:

#! /usr/bin/python

import librepo
import urlgrabber

def cb(*args):
    print args

if __name__ == "__main__":
    h = librepo.Handle()
    h.interruptible = True
    h.repotype = librepo.LR_YUMREPO
    h.setopt(librepo.LRO_MIRRORLIST,
             'https://mirrors.fedoraproject.org/metalink?repo=fedora-17&arch=x86_64')
    h.progresscb = cb
    h.yumdlist = ["primary", "filelists", "prestodelta"]
    r = librepo.Result()
    h.perform(r)

Stracing repeatedly shows:
poll([{fd=24, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 1000) = 0 (Timeout)

Strangely, this doesn't reproduce on my machine when a baseurl is used instead of the mirror list (could just be a heisenbug symptom).

I consider this a rather critical problem with the interruptible implementation.

Comment 1 Tomas Mlcoch 2013-04-03 12:20:12 UTC
Hi, I am unable to reproduce the problem :-/
I've done some refactoring: https://github.com/Tojaj/librepo/commit/b92c99da67a0d26bfc250e5d8aac399cb793c6c0 <- This could fix the problem.
Could you try the current git version of librepo and check if the problem still persists?

Comment 2 Ales Kozumplik 2013-04-03 15:43:11 UTC
I can't reproduce it from internal redhat machine but at home I'm reproducing it quite reliably, even with the latest c55a8d5 checkout.

Comment 3 Tomas Mlcoch 2013-04-04 12:47:18 UTC
Still cannot reproduce the bug . What version of libcurl are you using?
Could you try current git version of librepo + latest libcurl from fedora stable repositories (latest versions of libcurl in repositories support the CURL_GLOBAL_ACK_EINTR flag).

Comment 4 Ales Kozumplik 2013-04-04 18:55:46 UTC
Created attachment 731694 [details]
debug output

Tried again, git checkout 03e0293, libcurl-7.24.0-6.fc17.x86_64. I built librepo with debug output this time, got a hang, attaching what I got hope it's interesting.

the strace is still the same:

poll([{fd=22, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 1000) = 0 (Timeout)
poll([{fd=22, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 1000) = 0 (Timeout)
poll([{fd=22, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 1000) = 0 (Timeout)
poll([{fd=22, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 1000) = 0 (Timeout)
poll([{fd=22, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 1000) = 0 (Timeout)

FWIW, my current script is below (removed the urlgrabber, for reference and against doubts):
#! /usr/bin/python

import librepo

def cb(*args):
    print args

if __name__ == "__main__":
    h = librepo.Handle()
    h.interruptible = True
    h.repotype = librepo.LR_YUMREPO
    h.setopt(librepo.LRO_MIRRORLIST,
             'https://mirrors.fedoraproject.org/metalink?repo=fedora-17&arch=x86_64')
    h.progresscb = cb
    h.yumdlist = ["primary", "filelists", "prestodelta"]
    r = librepo.Result()
    h.perform(r)

Comment 5 Tomas Mlcoch 2013-04-05 14:09:50 UTC
It seems to stuck when cleanup curl handles. It's weird. I've added debug messages and change order of freeing of curl handles. Please try it again with debug output enabled (as you did last time) cmake -DCMAKE_BUILD_TYPE="DEBUG". Thank you

Comment 6 Ales Kozumplik 2013-04-06 08:07:55 UTC
(In reply to comment #5)
> It seems to stuck when cleanup curl handles. It's weird. I've added debug
> messages and change order of freeing of curl handles. Please try it again
> with debug output enabled (as you did last time) cmake
> -DCMAKE_BUILD_TYPE="DEBUG". Thank you

With 720d68d I can no longer reproduce this (tried 20 times). So the order of freeing the handles probably played a role. Thanks!

Comment 7 Fedora Update System 2013-04-08 14:40:10 UTC
librepo-0.0.2-3.20130408git720d68d.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/librepo-0.0.2-3.20130408git720d68d.fc19

Comment 8 Fedora Update System 2013-04-20 19:28:31 UTC
librepo-0.0.2-3.20130408git720d68d.fc19 has been pushed to the Fedora 19 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.