Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.12.1
-
None
-
$ conda --version
conda 4.6.11
$ conda list | grep pyqt
pyqt 5.9.2 py37h05f1152_2
pyqt5 5.12.1 pypi_0 pypi
pyqt5-sip 4.19.15 pypi_0 pypi
$ conda list | grep urllib
urllib3 1.24.1 py37_0
$ conda list | grep certifi
ca-certificates 2018.03.07 0
certifi 2018.11.29 py37_0
$ lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic
Note: running xfce4 desktop
$ conda --version conda 4.6.11 $ conda list | grep pyqt pyqt 5.9.2 py37h05f1152_2 pyqt5 5.12.1 pypi_0 pypi pyqt5-sip 4.19.15 pypi_0 pypi $ conda list | grep urllib urllib3 1.24.1 py37_0 $ conda list | grep certifi ca-certificates 2018.03.07 0 certifi 2018.11.29 py37_0 $ lsb_release -a Distributor ID: Ubuntu Description: Ubuntu 18.04.2 LTS Release: 18.04 Codename: bionic Note: running xfce4 desktop
Description
PyQt5 is causing segmention fault when a urllib3 request to read a webpage is made from inside a QApplication event loop.
The error occurs if, for example, a PyQt5 button-click is used to execute the urllib3 request. The same error occurs if the urllib3 request is run inside the loop without any PyQt5 form being opened. (The same error also occurs with the basic version of urllib, though I have not demonstrated that here).
Attached routine - test_parse_script.py - shows that this is so. It can be used to run a urrllib3 request outside and inside the PyQt5 event loop, as well as opening a Qt form that runs a urrllib3 request as a button event.
I can provide more debug info if you would help by instructing me how to get it.
Below is shown the output of the test routine. It executes a urllib3 request in these different scenarios (and combinations thereof):
- upon script load
- during command-line execution of script
- during command-line execution of script, inside PyQt5 QApplication event loop
- from within a Qt form, upon button-click
- upon instantiation of a test class
- upon execution of a function
## test output ##
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
- read webpage from pyqt5 form
$ ./test_parse_script.py
run pre-test?n
initialise pool manager?n
run load-test?n
run QApplication?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING PYQT5 EVENT LOOP
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
attempt to read webpage now?n
run func test?n
run class test?n
****************
-
-
- URLS FORM ***
****************
[parse_webpage] testing URL text
https://www.w3.org/2019/03/pressrelease-webauthn-rec.html.en
[test_parse] running urllib3 poolmanager
[parse_url] running urllib3 request
Segmentation fault (core dumped)
- URLS FORM ***
-
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
- run function to read webpage during script loading, then read same webpage from pyqt5 form
$ ./test_parse_script.py
run pre-test?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING PRE-TEST
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
****************
-
-
- TEST FUNC ***
****************
testing urllib3 poolmanager
testing urllib3 request
page status: 200
page sample: b'<!DOCTYPE html>\n<html lang="en">\n <head>\n'
run load-test?n
run QApplication?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING PYQT5 EVENT LOOP
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
attempt to read webpage now?n
run func test?n
run class test?n
**************** - URLS FORM ***
****************
[parse_webpage] testing URL text
https://www.w3.org/2019/03/pressrelease-webauthn-rec.html.en
[test_parse] running urllib3 poolmanager
[parse_url] running urllib3 request
page status: 200
- TEST FUNC ***
-
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
- upon command-line execution, during pyqt5 event loop, read webpage
$ ./test_parse_script.py
run pre-test?n
initialise pool manager?n
run load-test?n
run QApplication?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING PYQT5 EVENT LOOP
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
attempt to read webpage now?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING READ WEBPAGE TEST
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
Segmentation fault (core dumped)
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
- upon command-line execution, during pyqt5 event loop, run function to read webpage
$ ./test_parse_script.py
run pre-test?n
initialise pool manager?n
run load-test?n
run QApplication?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING PYQT5 EVENT LOOP
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
run func test?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING TEST FUNC
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
****************
-
-
- TEST FUNC ***
****************
testing urllib3 poolmanager
testing urllib3 request
Segmentation fault (core dumped)
- TEST FUNC ***
-
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
- upon command-line execution, during pyqt5 event loop, instantiate class that reads webpage upon init
$ ./test_parse_script.py
run pre-test?n
initialise pool manager?n
run load-test?n
run QApplication?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING PYQT5 EVENT LOOP
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
attempt to read webpage now?n
run func test?n
run class test?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING TEST CLASS
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
****************
-
-
- URL TEST ***
****************
[URL_TEST] testing urllib3 request
Segmentation fault (core dumped)
- URL TEST ***
-
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
- upon command-line execution, without starting a pyqt5 event loop, read webpage, then run function to read webpage again, and instantiate class that reads webpage upon init
$ ./test_parse_script.py
run pre-test?n
initialise pool manager?n
run load-test?n
run QApplication?n
attempt to read webpage now?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING READ WEBPAGE TEST
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
page status: 200
page sample: b'<!DOCTYPE html>\n<html lang="en">\n <head>\n'
run func test?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING TEST FUNC
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
****************
-
-
- TEST FUNC ***
****************
testing urllib3 poolmanager
testing urllib3 request
page status: 200
page sample: b'<!DOCTYPE html>\n<html lang="en">\n <head>\n'
run class test?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING TEST CLASS
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
**************** - URL TEST ***
****************
[URL_TEST] testing urllib3 request
page status: 200
page sample: b'<!DOCTYPE html>\n<html lang="en">\n <head>\n'
- TEST FUNC ***
-
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
- upon script load, run function to read webpage, then upon command-line execution, during pyqt5 event loop, read webpage again, run function to read webpage again, instantiate class that reads webpage upon init, and run pyqt5 form that reads webpage upon button-click
$ ./test_parse_script.py
run pre-test?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING PRE-TEST
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
****************
-
-
- TEST FUNC ***
****************
testing urllib3 poolmanager
testing urllib3 request
page status: 200
page sample: b'<!DOCTYPE html>\n<html lang="en">\n <head>\n'
run load-test?n
run QApplication?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING PYQT5 EVENT LOOP
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
attempt to read webpage now?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING READ WEBPAGE TEST
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
page status: 200
page sample: b'<!DOCTYPE html>\n<html lang="en">\n <head>\n'
run func test?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING TEST FUNC
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
**************** - TEST FUNC ***
****************
testing urllib3 poolmanager
testing urllib3 request
page status: 200
page sample: b'<!DOCTYPE html>\n<html lang="en">\n <head>\n'
run class test?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING TEST CLASS
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
**************** - URL TEST ***
****************
[URL_TEST] testing urllib3 request
page status: 200
page sample: b'<!DOCTYPE html>\n<html lang="en">\n <head>\n'
- TEST FUNC ***
-
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
- upon script load, setup urllib poolManager, then upon command-line execution, during pyqt5 event loop, read webpage, run function to read webpage again, instantiate class that reads webpage upon init, and run pyqt5 form that reads webpage upon button-click
$ ./test_parse_script.py
run pre-test?n
initialise pool manager?y
run load-test?n
run QApplication?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING PYQT5 EVENT LOOP
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
attempt to read webpage now?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING READ WEBPAGE TEST
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
Segmentation fault (core dumped)
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
- upon script load, instantiate class that reads webpage upon init, then upon command-line execution, during pyqt5 event loop, read webpage again, run function to read webpage again, instantiate class that reads webpage upon init, and run pyqt5 form that reads webpage upon button-click
$ ./test_parse_script.py
run pre-test?n
initialise pool manager?n
run load-test?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING LOAD TEST
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
****************
-
-
- URL TEST ***
****************
[URL_TEST] testing urllib3 request
page status: 200
page sample: b'<!DOCTYPE html>\n<html lang="en">\n <head>\n'
run QApplication?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING PYQT5 EVENT LOOP
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
attempt to read webpage now?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING READ WEBPAGE TEST
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
page status: 200
page sample: b'<!DOCTYPE html>\n<html lang="en">\n <head>\n'
run func test?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING TEST FUNC
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
**************** - TEST FUNC ***
****************
testing urllib3 poolmanager
testing urllib3 request
page status: 200
page sample: b'<!DOCTYPE html>\n<html lang="en">\n <head>\n'
run class test?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING TEST CLASS
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
**************** - URL TEST ***
****************
[URL_TEST] testing urllib3 request
page status: 200
page sample: b'<!DOCTYPE html>\n<html lang="en">\n <head>\n'
- URL TEST ***
-
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
- upon script load, run function that reads webpage, then upon command-line execution, during pyqt5 event loop, read different webpage, run function to read webpage again, instantiate class that reads webpage upon init, and run pyqt5 form that reads webpage upon button-click
$ ./test_parse_script.py
run pre-test?n
run alternative pre-test?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING PRE-TEST
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
****************
-
-
- TEST FUNC ***
****************
testing urllib3 poolmanager
testing urllib3 request
page status: 200
page sample: b'<!DOCTYPE html>\n<html lang="en">\n <head>\n'
run load-test?n
run QApplication?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING PYQT5 EVENT LOOP
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
attempt to read webpage now?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING READ WEBPAGE TEST
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
page status: 200
page sample: b'<!DOCTYPE html>\n<html lang="en">\n <head>\n'
run func test?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING TEST FUNC
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
**************** - TEST FUNC ***
****************
testing urllib3 poolmanager
testing urllib3 request
page status: 200
page sample: b'<!DOCTYPE html>\n<html lang="en">\n <head>\n'
run class test?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING TEST CLASS
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
**************** - URL TEST ***
****************
[URL_TEST] testing urllib3 request
page status: 200
page sample: b'<!DOCTYPE html>\n<html lang="en">\n <head>\n'
**************** - URLS FORM ***
****************
[parse_webpage] testing URL text
https://www.w3.org/2019/03/pressrelease-webauthn-rec.html.en
[test_parse] running urllib3 poolmanager
[parse_url] running urllib3 request
page status: 200
- TEST FUNC ***
-
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
- upon script load, run function that reads webpage, then during pyqt5 event loop, run pyqt5 form that reads webpage upon button-click
$ ./test_parse_script.py
run pre-test?n
run alternative pre-test?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING PRE-TEST
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
****************
-
-
- TEST FUNC ***
****************
testing urllib3 poolmanager
testing urllib3 request
page status: 200
page sample: b'<!DOCTYPE html>\n<html lang="en">\n <head>\n'
run load-test?n
run QApplication?y
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
RUNNING PYQT5 EVENT LOOP
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
attempt to read webpage now?n
run func test?n
run class test?n
**************** - URLS FORM ***
****************
[parse_webpage] testing URL text
https://www.w3.org/2019/03/pressrelease-webauthn-rec.html.en
[test_parse] running urllib3 poolmanager
[parse_url] running urllib3 request
page status: 200
- TEST FUNC ***
-