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 660057 - Requeueing messages might re-use disconnected connection
Requeueing messages might re-use disconnected connection
Status: VERIFIED FIXED
Product: libsoup
Classification: Core
Component: HTTP Transport
2.34.x
Other Linux
: Normal normal
: ---
Assigned To: libsoup-maint@gnome.bugs
libsoup-maint@gnome.bugs
: 658814 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-09-25 14:05 UTC by Mads Chr. Olesen
Modified: 2011-11-22 17:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
When requeueing don't assume same connection can be re-used. (492 bytes, patch)
2011-09-25 14:05 UTC, Mads Chr. Olesen
none Details | Review
Waiting before giving password (1.59 KB, text/plain)
2011-11-22 16:59 UTC, Mads Chr. Olesen
  Details
Quickly giving password, succeeds. (3.03 KB, text/plain)
2011-11-22 17:00 UTC, Mads Chr. Olesen
  Details
New behaviour with patch, hangs. (2.15 KB, text/plain)
2011-11-22 17:00 UTC, Mads Chr. Olesen
  Details

Description Mads Chr. Olesen 2011-09-25 14:05:13 UTC
Created attachment 197427 [details] [review]
When requeueing don't assume same connection can be re-used.

I am using gvfs-dav to connect to an Apache WebDAV server which apparently has a 2 seconds idle timeout (sigh). Therefore I run into this problem, when trying to connect to a password protected share:
1. Try to connect
2. Get authentication required dialog
3. Meanwhile: Server closes connection
4. Fill out username, password
5. libsoup tries to send on disconnected, fails with
(process:21573): libsoup-CRITICAL **: soup_session_get_connection: assertion `soup_connection_get_state (item->conn) != SOUP_CONNECTION_DISCONNECTED' failed
6. After a while gvfs-dav times out.

The attached patch solves my problem: It does not assume the message should be sent on the exact same connection as was tried previously.
Comment 1 Sergio Villar 2011-09-28 09:03:01 UTC
I think this is exactly the same as https://bugzilla.gnome.org/show_bug.cgi?id=658814
Comment 2 Dan Winship 2011-09-28 12:56:59 UTC
*** Bug 658814 has been marked as a duplicate of this bug. ***
Comment 3 Sergio Villar 2011-09-30 00:38:24 UTC
Could you check if the fix for #651146 fixes also your problem?
Comment 4 Mads Chr. Olesen 2011-09-30 08:28:18 UTC
Attachment https://bugzilla.gnome.org/attachment.cgi?id=197743 does not fix my problem.
I cannot apply https://bugzilla.gnome.org/attachment.cgi?id=193442 cleanly to my libsoup version 2.34.0.
Comment 5 Sergio Villar 2011-09-30 14:24:58 UTC
(In reply to comment #4)
> Attachment https://bugzilla.gnome.org/attachment.cgi?id=197743 does not fix my
> problem.
> I cannot apply https://bugzilla.gnome.org/attachment.cgi?id=193442 cleanly to
> my libsoup version 2.34.0.

You need both patches, otherwise it won't work.
Comment 6 Dan Winship 2011-09-30 14:34:50 UTC
No, 193442 is only needed for the test program, not for the bugfix itself.

Pretty sure this is a different bug from that one. The problem here is that libsoup is noticing that the connection has been closed by the server (and so setting its state to DISCONNECTED), but it doesn't get removed from the SoupMessageQueueItem when it does that.
Comment 7 Sergio Villar 2011-09-30 15:35:07 UTC
(In reply to comment #6)
> No, 193442 is only needed for the test program, not for the bugfix itself.

Yeah I was talking about the process of applying the patch, maybe there was some conflict.
Comment 8 Dan Winship 2011-10-05 20:13:04 UTC
ok, actually the patch in bug 651146 half-fixes this; instead of hanging, it now gets a "Connection terminated unexpectedly" error right away (but should work if you try it a second time).
Comment 9 Dan Winship 2011-11-13 20:07:42 UTC
fixed in master
Comment 10 Mads Chr. Olesen 2011-11-22 16:55:54 UTC
I'm not entirely sure this fixes my issue: I tried with the following revision from libsoup:
:~/projects/libsoup$ git log | head -1
commit f03674c2e9999781da756b7579eb3a3404e6f2a4

and compiled a custom gvfsd, verified that it uses the custom gvfsd-dav, and that gvfsd-dav is linked to the custom version of libsoup.

Using this setup, I still get the bad behaviour as before. I attach two logs from running:
GVFS_DEBUG=1 GVFS_HTTP_DEBUG=1 ./gvfsd --replace

 * One where I wait a few seconds before inputting the password (gvfs-libsoup-bad-debug.txt), which fails.
 * One where I hurry up (gvfs-libsoup-good-debug.txt), which succeeds.

As you can see the bad one still tries to reuse the same socket.

I verified that my patch still applies to git, but now it doesn't succeed in connecting anymore (see gvfs-libsoup-withpatch-debug.txt): it hangs in the last step, but it succeeds in authenticating and using a different socket.

Is there any more information I can provide?
Comment 11 Mads Chr. Olesen 2011-11-22 16:59:56 UTC
Created attachment 201939 [details]
Waiting before giving password
Comment 12 Mads Chr. Olesen 2011-11-22 17:00:19 UTC
Created attachment 201940 [details]
Quickly giving password, succeeds.
Comment 13 Mads Chr. Olesen 2011-11-22 17:00:43 UTC
Created attachment 201941 [details]
New behaviour with patch, hangs.
Comment 14 Mads Chr. Olesen 2011-11-22 17:03:15 UTC
(I used gvfs version 1.8.0, as this is the one shipped with my distro. I tried to set the bug status, to something reasonable, but I think that failed.)