Bug report #8244

Plugin manager crashes when adding a repository

Added by Rudi von Staden over 7 years ago. Updated over 7 years ago.

Status:Closed
Priority:Severe/Regression
Assignee:Borys Jurgiel
Category:Plugin Manager
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:Yes Copied to github as #:17055

Description

I have created an unofficial plugin repository, which was working under 1.8. When I try to add it in master (e689364) using the plugin manager, QGIS crashes. Thereafter, every time I try to open the plugin manager, QGIS crashes again. I have tried reverting to a previously-known-working version of the XML (tested on 1.8), but still the repo causes a crash.

Repository URL: http://gator869.hostgator.com/~rudivs/plugins/plugins.xml

  • section of ~/.config/QGIS2.conf:*
    plugin-repos\\QGIS%20Official%20Plugin%20Repository\\url=http://plugins.qgis.org/plugins/plugins.xml
    plugin-installer\\checkOnStart=false
    plugin-installer\\checkOnStartInterval=0
    plugin-seen=sextante, tmsforkorea, db_manager, pointsamplingtool, quickfinder, imagemap_plugin, postgres91plusauditor, loopvisiblelayers, valuetool, simplesvg, plaingeometryeditor, openlayers_plugin, DistroMap, qgsexpressionsplus, pinpoint, rasterinterpolation, points2one, photo2shape, NewMemoryLayer, DataDrivenInputMask, lizmap, GdalTools, profiletool, zoomtocoordinates, DockableMirrorMap, layers_by_field, tablemanager, fTools, mapserver_export, VectorFieldRenderer, mmqgis, shapefile_encoding_fixer, pluginbuilder, tileindex, itembrowser, SANBI_Gazetteer, linkit, MemoryLayerSaver, scriptrunner
    plugin-installer\\[email protected](\\0\\0\\0\\xe\\0%{\\xa3)
    plugin-installer\\allowExperimental=true
    plugin-repos\\SANBI%20Plugin%20Repository\\url=http://gator869.hostgator.com/~rudivs/plugins/plugins.xml
    plugin-repos\\SANBI%20Plugin%20Repository\\enabled=true

plugins.xml:


<plugins>
<pyqgis_plugin name="Gazetteer" version="0.3.1">
<description>Gazetteer Search plugin</description>
<version>0.3.1</version>
<qgis_minimum_version>1.8</qgis_minimum_version>
<qgis_maximum_version>1.99</qgis_maximum_version>
<homepage>https://github.com/rudivs/QGIS-Gazetteer-Plugin&lt;/homepage>
<file_name>SANBI_Gazetteer.zip</file_name>
<author_name>Rudi von Staden</author_name>
<download_url>http://gator869.hostgator.com/~rudivs/plugins/SANBI_Gazetteer.zip&lt;/download_url>
<create_date>2013-07-07</create_date>
<update_date>None</update_date>
<experimental>False</experimental>
<deprecated>False</deprecated>
</pyqgis_plugin>
</plugins>

Associated revisions

Revision 682a89c9
Added by Borys Jurgiel over 7 years ago

[Plugin Installer] Fixes #8244 (crash on closing http request)

History

#1 Updated by Matthias Kuhn over 7 years ago

It does not crash here, but I get an error indicating "server replied: Not Acceptable"

#2 Updated by Rudi von Staden over 7 years ago

It seems that I can't add any repositories at the moment. I've tried adding the Sourcepole repo and Carson Farmer's repo (linked at https://issues.qgis.org/projects/quantum-gis/wiki/Python_Plugin_Repositories), and both crash. Could it be a build issue somewhere?

Here are the message outputs when running from command line:
Warning: loading of qt translation failed [/usr/share/qt4/translations/qt_en_ZA]
Warning: void DBusMenuExporterPrivate::addAction(QAction*, int): Already tracking action "&SEXTANTE toolbox" under id 261
Fatal: QGIS died on signal 11
Stacktrace (piped through c++filt):
/home/rudi/apps/qgis/bin/qgis(myMessageOutput(QtMsgType, char const*)+0x250)[0x816a810]
/usr/lib/i386-linux-gnu/libQtCore.so.4(qt_message_output(QtMsgType, char const*)+0x39)[0xb47b8629]
/usr/lib/i386-linux-gnu/libQtCore.so.4(+0x5cb39)[0xb47b8b39]
/usr/lib/i386-linux-gnu/libQtCore.so.4(qFatal(char const*, ...)+0x18)[0xb47b8c58]
/home/rudi/apps/qgis/bin/qgis(qgisCrash(int)+0x19)[0x816a5be]
[0xb774e400]
[0xc086218]
Aborted (core dumped)

#3 Updated by Borys Jurgiel over 7 years ago

  • Crashes QGIS or corrupts data changed from No to Yes

Ok, seems I can replicate the crash.

#4 Updated by Matthias Kuhn over 7 years ago

  • Priority changed from Normal to Severe/Regression

Confirmed here too after pulling

from py-bt:

build/output/python/pyplugin_installer/installer.py, line 125, in fetchAvailablePlugins (self=<QgsPluginInstaller(statusLabel=None) at remote 0x3edd710>, reloadMode=True, key=u'QGIS Official Repository')\
" 
>~"    repositories.killConnection(key)\
" 
>~"#12 (frame information optimized out)\
" 
>~"#15 (frame information optimized out)\
" 

#5 Updated by Borys Jurgiel over 7 years ago

  • Status changed from Open to Closed

#6 Updated by Borys Jurgiel over 7 years ago

It was a side-effect of the recent change in closing pending requests. Now it's fixed, however, your repository still returns the "406: Not Acceptable" status. Clearly your http server doesn't accept standard QNetworkRequest (with quite minimalistic headers I guess), while it works ok with web browsers. So I tried to set the headers exactly like my Chromium does (even if they doesn't seem to make much sense), without success:

setRawHeader( "Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" )
setRawHeader( "Accept-Encoding", "gzip,deflate,sdch" )
setRawHeader( "Accept-Language", "pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4" )

Maybe you can configure your server to work without the "Accept" headers?

#7 Updated by Rudi von Staden over 7 years ago

Thanks Borys, I'm compiling the updated code so I'm sure that'll fix the crash problem. It seems that the 406 error is related to Apache's mod_security module. It can be disabled in .htaccess using the directive below. But it was working in 1.8, so I wonder what was handled differently there, and whether the issue will affect others? The headers with 1.8 are pretty minimal too (well they seem that way checking with Wireshark):

@GET /~rudivs/plugins/plugins.xml HTTP/1.1\
\

Connection: Keep-Alive\
\

Host: gator869.hostgator.com\
\

\
\

@

Some people seem to have got it to work with setRawHeader( "User-Agent" , "Mozilla Firefox" ), but I don't know whether that would work here, or whether it would be a desirable solution.

For the benefit of anyone else with this issue, you can turn off mod_security by placing this in your .htaccess file:

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

I haven't disabled it yet in case you want to test any other settings for user agent.

#8 Updated by Borys Jurgiel over 7 years ago

Hi, we switched from simple QHttp requests to QgsNetworkAccessManager (mainly in order to properly support proxies) and it caused the difference. I'd avoid setting false User-Agent, I guess we'll rather set it to "QGIS-Something" some day to possibly collect statistics or so.

I don't have enough time to play with the headers right now, so feel free to disable mod_security in your repo. Other repositories works fine, so I guess we can leave it like is for now. However, thank you very much for the fruitful investigation. Now I know I need to enable mod_security in my test repo if further tests will occur necessary.

Also available in: Atom PDF