Ktorrent freeze and Firefox

I’ve run into a peculiar problem. When I open a magnet URL in Firefox, ktorrent will start downloading but will completely freeze after a short period of time. My estimate is anything between 20 seconds and 1 minute. Downloading halts (can see a sharp decline in network utilization in ksyshuard) and ktorrent UI becomes completely unresponsive. Trying to close it produces kwin’s terminate application prompt. If I do terminate it and relaunch it, downloading resumes to completion without any further freezes. Now, for the odd part. If I instead close Firefox, the ktorrent’s UI immediately becomes responsive and downloading resumes. This leads me to believe it’s the parent process of ktorrent that causes a lockup. Ksysguard points at kmozillahelper as the parent process. This would also be consistent with terminating ktorrent and manually relaunching it, thereby effectively changing it’s parent process.

My setup is very close to pure openSuse defaults:


zypper lr:

Repository priorities are without effect. All enabled repositories share the same priority.

# | Alias                               | Name                        | Enabled | GPG Check | Refresh
--+-------------------------------------+-----------------------------+---------+-----------+--------
1 | Local                               | Local                       | Yes     | ( p) Yes  | Yes    
2 | http-download.videolan.org-a752b8a7 | VLC                         | Yes     | (r ) Yes  | Yes    
3 | repo-debug                          | openSUSE-Tumbleweed-Debug   | No      | ----      | ----   
4 | repo-non-oss                        | openSUSE-Tumbleweed-Non-Oss | Yes     | (r ) Yes  | Yes    
5 | repo-oss                            | openSUSE-Tumbleweed-Oss     | Yes     | (r ) Yes  | Yes    
6 | repo-source                         | openSUSE-Tumbleweed-Source  | No      | ----      | ----   
7 | repo-update                         | openSUSE-Tumbleweed-Update  | Yes     | (r ) Yes  | Yes 

zypper info kmozillahelper MozillaFirefox ktorrent


Information for package kmozillahelper:
---------------------------------------
Repository     : @System                           
Name           : kmozillahelper                    
Version        : 5.0.1-2.1                         
Arch           : x86_64                            
Vendor         : obs://build.opensuse.org/mozilla  
Installed Size : 67,2 KiB                          
Installed      : Yes                               
Status         : up-to-date                        
Summary        : Helper for KDE Firefox Integration
Description    :                                   
    Package providing integration of Mozilla applications with KDE.


Information for package MozillaFirefox:
---------------------------------------
Repository     : openSUSE-Tumbleweed-Oss    
Name           : MozillaFirefox             
Version        : 51.0.1-1.2                 
Arch           : x86_64                     
Vendor         : openSUSE                   
Installed Size : 107,0 MiB                  
Installed      : Yes                        
Status         : up-to-date                 
Summary        : Mozilla Firefox Web Browser
Description    :                            
    Mozilla Firefox is a standalone web browser, designed for standards
    compliance and performance.  Its functionality can be enhanced via a
    plethora of extensions.


Information for package ktorrent:
---------------------------------
Repository     : openSUSE-Tumbleweed-Oss
Name           : ktorrent               
Version        : 5.0.1-2.1              
Arch           : x86_64                 
Vendor         : openSUSE               
Installed Size : 3,3 MiB                
Installed      : Yes                    
Status         : up-to-date             
Summary        : KDE BitTorrent Client  
Description    :                        
    KTorrent is a bittorrent application for KDE which allows you to download files
    using the BitTorrent protocol. It enables you to run multiple torrents at the
    same time and comes with extended features to make it a full-featured client
    for BitTorrent.

Has anyone else experienced similar ktorrent freezes/unresponsiveness? If so, have you used Firefox to open/load a torrent file or magnet URL in ktorrent?

Small update, ktorrent doesn’t freeze when a magnet url is loaded from other browsers (tested with qupzilla and google chrome). Here’s a more complete view of the repositories used:


pmargeti@loonix:~> zypper lr -d
Repository priorities are without effect. All enabled repositories share the same priority.

# | Alias                               | Name                        | Enabled | GPG Check | Refresh | Priority | Type     | URI                                                      | Service
--+-------------------------------------+-----------------------------+---------+-----------+---------+----------+----------+----------------------------------------------------------+--------
1 | Local                               | Local                       | Yes     | ( p) Yes  | Yes     |   99     | plaindir | dir:///usr/local/repository                              |         
2 | http-download.videolan.org-a752b8a7 | VLC                         | Yes     | (r ) Yes  | Yes     |   99     | rpm-md   | http://download.videolan.org/SuSE/Tumbleweed/            |         
3 | repo-debug                          | openSUSE-Tumbleweed-Debug   | No      | ----      | ----    |   99     | NONE     | http://download.opensuse.org/debug/tumbleweed/repo/oss/  |         
4 | repo-non-oss                        | openSUSE-Tumbleweed-Non-Oss | Yes     | (r ) Yes  | Yes     |   99     | yast2    | http://download.opensuse.org/tumbleweed/repo/non-oss/    |         
5 | repo-oss                            | openSUSE-Tumbleweed-Oss     | Yes     | (r ) Yes  | Yes     |   99     | yast2    | http://download.opensuse.org/tumbleweed/repo/oss/        |         
6 | repo-source                         | openSUSE-Tumbleweed-Source  | No      | ----      | ----    |   99     | NONE     | http://download.opensuse.org/source/tumbleweed/repo/oss/ |         
7 | repo-update                         | openSUSE-Tumbleweed-Update  | Yes     | (r ) Yes  | Yes     |   99     | rpm-md   | http://download.opensuse.org/update/tumbleweed/          |

A decade ago,
I wrote about how the default openSUSE is optimized for Personal and Small Server use.
If you’re running a Torrent application with a very large number of connections, and especially for torrent applications that themselves aren’t optimized to adjust for active or latent connections, and be able to prioritize for bandwidth, then your openSUSE is actually running like a high capacity server with inadequate networking resources. This can also be exacerbated by the default TCP/IP Congestion Control algorithm, which assumes a stable and reliable wired network connection not subject to various interference.

The article I wrote still applies to today’s current openSUSE, and will likely fix your problem by suggesting a TCP/IP Congestion Control algorithm change and re-allocating system resources from system processing to networking to support larger numbers of networking connections over other networking connections like WiFi, Gigabit, Telco carriers and more (It’s also a must-read for anyone running medium or large servers).

https://sites.google.com/site/4techsecrets/optimize-and-fix-your-network-connection

TSU

I’m already using westwood, so I guess we can rule TCP congestion out? How do you interpret the fact that ktorrent doesn’t go unresponsive when invoked through another browser?


pmargeti@loonix:~> cat /proc/sys/net/ipv4/tcp_congestion_control
westwood

I get exactly the same behaviour in Leap 42.2. Closing Firefox brings ktorrent to life, indeed.

Why are you using westwood?
Either look up its description or read the description in my article, it’s <sender side only> when you have fat, reliable pipes (like GigE) for Internet connections.
For most people, their connection is WiFi so should choose something like veno, but you need to evaluate what you have in your network.
And, as I describe in my article you should also increase the resources allocated to your networking stack… Unless you have something else more important.

https://sites.google.com/site/4techsecrets/optimize-and-fix-your-network-connection/linux

TSU