Opened 7 years ago

Closed 6 years ago

#5331 closed enhancement (fixed)

Improve image loading in (threaded?)

Reported by: Owned by:
Priority: normal Milestone: 0.15
Component: chat Version:
Severity: normal Keywords:
Cc: Blocked By:
Blocking: OS: All


Would be good to have image loading threaded or the like. Now it has 2 issues:

  • if there is heavy downloading in the background - it fails to load images completely because of timeouts.
  • if you increase timeout so it least works okay(i don't care about DDOS-es, i just want it to work okay) like this:
diff -r f6f16e7e3737 src/
--- a/src/	Sat Oct 17 10:18:11 2009 +0200
+++ b/src/	Sat Oct 17 21:41:19 2009 +0300
@@ -486,7 +486,7 @@
 		mem = ''
 			# Wait maximum 1s for connection
-			socket.setdefaulttimeout(1)
+			socket.setdefaulttimeout(5)
 				f = urllib2.urlopen(attrs['src'])
 			except Exception, ex:
@@ -496,7 +496,7 @@
 				# Wait 0.1s between each byte
-					f.fp._sock.fp._sock.settimeout(0.5)
+					f.fp._sock.fp._sock.settimeout(5)
 				except Exception:
 				# Max image size = 2 MB (to try to prevent DoS)

then it freezes gajim for too long just to load images.

Attachments (1)

img_load_timeouts_more.patch (792 bytes) - added by 7 years ago.

Download all attachments as: .zip

Change History (6)

Changed 7 years ago by

comment:1 Changed 7 years ago by

Added some more temporary timeout tweaks so it doesn't assume it can load any image in 3 secs. I don't have 1Gbit/s connection here.

comment:2 Changed 7 years ago by asterix

we indeed prefer to not load the image than to freeze Gajim, it's why we set small timeouts. for threaded load ... patches are welcome ...

comment:3 Changed 7 years ago by


I was thinking about relation this to #3724 - but if webkit will be optional and this parser will still be used in the absence of webkit - only then doing something on this ticket have sense.. But having webkit handle all this stuff would be nice indeed..

What do you think ?

comment:4 Changed 7 years ago by asterix

webkit could be nice, but that sounds a big requirement, and not everybody is interested in that. So I think it will stay optional

comment:5 Changed 6 years ago by Julien Pivotto <roidelapluie@…>

  • Milestone set to 0.15
  • Resolution set to fixed
  • Status changed from new to closed

(In [77d3b4e65b26]) Handle loading of images with a thread. See #5892. Fix #5331.

Note: See TracTickets for help on using tickets.