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 650439 - Race when proxy is enabled
Race when proxy is enabled
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: network
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2011-05-17 22:00 UTC by David Zeuthen (not reading bugmail)
Modified: 2011-05-18 15:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Saw this potential optimization in passing (1.11 KB, patch)
2011-05-18 14:45 UTC, David Zeuthen (not reading bugmail)
committed Details | Review
Add locking (2.17 KB, patch)
2011-05-18 14:46 UTC, David Zeuthen (not reading bugmail)
none Details | Review
Add locking v2 (2.37 KB, patch)
2011-05-18 14:53 UTC, David Zeuthen (not reading bugmail)
committed Details | Review

Description David Zeuthen (not reading bugmail) 2011-05-17 22:00:54 UTC
I have a program that tries to create three TLS connections at approximately the same time each from separate thread. Each thread is using a GSocketClient.

The result is that it always seem to fail for two of the connections (sometimes only one) while one of them works (almost always the first one). It fails with this error

 Proxy protocol 'http' is not supported. (g-io-error-quark, 15)

I captured a stack trace when it fails, see [1].

I wondered why it was trying to use a HTTP proxy and then I realized that it could be because I have my proxy settings set to

 Mode: Automatic
 Configuration URL: http://wpad/wpad.dat

If I disable the HTTP proxy then things work just fine.

As you can see, each socket client is trying to connect to

 host_and_port=0x638530 "imap.gmail.com"
 default_port=993

and I've also set the GSocketClient:tls property to TRUE. See

 http://cgit.freedesktop.org/~david/goa/tree/src/goabackend/goaimapclient.c#n217

for the actual code in question.

So this must be a bug with how proxying is handled.

Thoughts?

[1] :

(gdb) thread
[Current thread is 5 (Thread 0x7ffff5b03700 (LWP 24667))]
(gdb) print protocol 
$1 = (const gchar *) 0x7fffe00047a0 "http"
 
  • #0 g_socket_client_connect
    at gsocketclient.c line 857
  • #1 g_socket_client_connect_to_host
    at gsocketclient.c line 960
  • #2 goa_imap_client_connect_sync
    at goaimapclient.c line 223
  • #3 imap_client_sync_single
    at goaimapmail.c line 654
  • #4 imap_client_sync
    at goaimapmail.c line 842
  • #5 handle_create_monitor
  • #6 ffi_call_unix64
    from /usr/lib64/libffi.so.5
  • #7 ffi_call
    from /usr/lib64/libffi.so.5
  • #8 g_cclosure_marshal_generic
    at gclosure.c line 1129
  • #9 g_type_iface_meta_marshal
    at gclosure.c line 905
  • #10 g_closure_invoke
    at gclosure.c line 771
  • #11 signal_emit_unlocked_R
    at gsignal.c line 3294
  • #12 g_signal_emitv
    at gsignal.c line 2891
  • #13 _goa_mail_skeleton_handle_method_call
    at goa-generated.c line 9231
  • #14 dispatch_in_thread_func
    at gdbusinterfaceskeleton.c line 474
  • #15 io_job_thread
    at gioscheduler.c line 180
  • #16 g_thread_pool_thread_proxy
    at gthreadpool.c line 319
  • #17 g_thread_create_proxy
    at gthread.c line 1897
  • #18 start_thread
    at pthread_create.c line 305
  • #19 clone
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S line 115

Comment 1 David Zeuthen (not reading bugmail) 2011-05-17 22:09:40 UTC
Btw, why are we trying to use the proxy server at all for this kind of connection?
Comment 2 David Zeuthen (not reading bugmail) 2011-05-18 14:45:26 UTC
Created attachment 188029 [details] [review]
Saw this potential optimization in passing
Comment 3 David Zeuthen (not reading bugmail) 2011-05-18 14:46:02 UTC
Created attachment 188030 [details] [review]
Add locking

Just locking around the settings fixes the problem for me.
Comment 4 David Zeuthen (not reading bugmail) 2011-05-18 14:53:13 UTC
Created attachment 188033 [details] [review]
Add locking v2

Fix typo (s/lock/unlock)
Comment 5 Dan Winship 2011-05-18 14:59:21 UTC
Comment on attachment 188029 [details] [review]
Saw this potential optimization in passing

as mentioned on irc, good except for the spaces-vs-tabs
Comment 6 David Zeuthen (not reading bugmail) 2011-05-18 15:02:34 UTC
(In reply to comment #5)
> (From update of attachment 188029 [details] [review])
> as mentioned on irc, good except for the spaces-vs-tabs

This patch is already using tabs not spaces, no?
Comment 7 David Zeuthen (not reading bugmail) 2011-05-18 15:05:58 UTC
Thanks for the review, committed both patches!