After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 676038 - Fix rygel test run
Fix rygel test run
Status: RESOLVED FIXED
Product: libsoup
Classification: Core
Component: Misc
unspecified
Other All
: Normal normal
: ---
Assigned To: libsoup-maint@gnome.bugs
libsoup-maint@gnome.bugs
Depends on:
Blocks:
 
 
Reported: 2012-05-14 18:15 UTC by Ray Strode [halfline]
Modified: 2012-05-15 16:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
soup-message-io: fix reference leak (893 bytes, patch)
2012-05-14 18:15 UTC, Ray Strode [halfline]
committed Details | Review
soup-message-io: keep cancellable alive for duration of io_run_until (2.02 KB, patch)
2012-05-14 18:15 UTC, Ray Strode [halfline]
none Details | Review

Description Ray Strode [halfline] 2012-05-14 18:15:15 UTC
I'm doing a jhbuild and it's failing at rygel's unit tests.

rygel does something along these lines (abridged):

public async void run () {
    SourceFunc run_continue = run.callback;
    size_t bytes_received = 0;

    this.msg.got_chunk.connect ((msg, chunk) => {
        bytes_received += chunk.length;

        if (bytes_received >= this.total_bytes) {
            this.context.session.cancel_message (this.msg,
                                                 KnownStatusCode.CANCELLED);
        }
    });

    this.context.session.queue_message (this.msg, (session, msg) => {
        run_continue ();
    });

    yield;

    this.completed ();
}

This crashes shortly after the cancel_message because libsoup tries to
access a cancellable that's been freed.
Comment 1 Ray Strode [halfline] 2012-05-14 18:15:17 UTC
Created attachment 214017 [details] [review]
soup-message-io: fix reference leak

io_run_until forgets to release a reference it takes
in a cancellation error path.

This commit fixes that.
Comment 2 Ray Strode [halfline] 2012-05-14 18:15:20 UTC
Created attachment 214018 [details] [review]
soup-message-io: keep cancellable alive for duration of io_run_until

io_run_until calls io_read/io_write which may ultimately cause the
passed in cancellable to be freed.

This commit refs the cancellable before the io operations, so it
can be checked for cancellation following those operations.

Fixes crasher in rygel test case.
Comment 3 Ray Strode [halfline] 2012-05-14 18:16:59 UTC
Please make sure the reference count leak (attachment 214017 [details] [review]) is actually a leak, and not something more subtle.  I just tossed that patch in at the same time because I noticed it when I was near those lines in the code.
Comment 4 Dan Winship 2012-05-14 20:05:41 UTC
Comment on attachment 214017 [details] [review]
soup-message-io: fix reference leak

this part is definitely right
Comment 5 Ray Strode [halfline] 2012-05-14 20:54:28 UTC
Comment on attachment 214017 [details] [review]
soup-message-io: fix reference leak

Attachment 214017 [details] pushed as dbc41f6 - soup-message-io: fix reference leak
Comment 6 Dan Winship 2012-05-15 16:24:25 UTC
Pushed a slightly different version of that patch, and updated
misc-test to crash in the absence of this fix.

Thanks for the patches